diff options
author | Bruce Momjian <bruce@momjian.us> | 2009-06-11 14:49:15 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2009-06-11 14:49:15 +0000 |
commit | d7471402794266078953f1bd113dab4913d631a1 (patch) | |
tree | 618e392a84eaf837e00bf78f8694097b78fec227 | |
parent | 4e86efb4e51b66ef57b3fe6f28576de23a1bf1c6 (diff) | |
download | postgresql-d7471402794266078953f1bd113dab4913d631a1.tar.gz |
8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list
provided by Andrew.
654 files changed, 11901 insertions, 11388 deletions
diff --git a/contrib/auto_explain/auto_explain.c b/contrib/auto_explain/auto_explain.c index 8e0f11038c..9108a77ba1 100644 --- a/contrib/auto_explain/auto_explain.c +++ b/contrib/auto_explain/auto_explain.c @@ -6,7 +6,7 @@ * Copyright (c) 2008-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/contrib/auto_explain/auto_explain.c,v 1.4 2009/01/05 13:35:38 tgl Exp $ + * $PostgreSQL: pgsql/contrib/auto_explain/auto_explain.c,v 1.5 2009/06/11 14:48:50 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -19,7 +19,7 @@ PG_MODULE_MAGIC; /* GUC variables */ -static int auto_explain_log_min_duration = -1; /* msec or -1 */ +static int auto_explain_log_min_duration = -1; /* msec or -1 */ static bool auto_explain_log_analyze = false; static bool auto_explain_log_verbose = false; static bool auto_explain_log_nested_statements = false; @@ -28,21 +28,21 @@ static bool auto_explain_log_nested_statements = false; static int nesting_level = 0; /* Saved hook values in case of unload */ -static ExecutorStart_hook_type prev_ExecutorStart = NULL; -static ExecutorRun_hook_type prev_ExecutorRun = NULL; -static ExecutorEnd_hook_type prev_ExecutorEnd = NULL; +static ExecutorStart_hook_type prev_ExecutorStart = NULL; +static ExecutorRun_hook_type prev_ExecutorRun = NULL; +static ExecutorEnd_hook_type prev_ExecutorEnd = NULL; #define auto_explain_enabled() \ (auto_explain_log_min_duration >= 0 && \ (nesting_level == 0 || auto_explain_log_nested_statements)) -void _PG_init(void); -void _PG_fini(void); +void _PG_init(void); +void _PG_fini(void); static void explain_ExecutorStart(QueryDesc *queryDesc, int eflags); static void explain_ExecutorRun(QueryDesc *queryDesc, - ScanDirection direction, - long count); + ScanDirection direction, + long count); static void explain_ExecutorEnd(QueryDesc *queryDesc); @@ -54,8 +54,8 @@ _PG_init(void) { /* Define custom GUC variables. */ DefineCustomIntVariable("auto_explain.log_min_duration", - "Sets the minimum execution time above which plans will be logged.", - "Zero prints all plans. -1 turns this feature off.", + "Sets the minimum execution time above which plans will be logged.", + "Zero prints all plans. -1 turns this feature off.", &auto_explain_log_min_duration, -1, -1, INT_MAX / 1000, @@ -138,9 +138,9 @@ explain_ExecutorStart(QueryDesc *queryDesc, int eflags) if (auto_explain_enabled()) { /* - * Set up to track total elapsed time in ExecutorRun. Make sure - * the space is allocated in the per-query context so it will go - * away at ExecutorEnd. + * Set up to track total elapsed time in ExecutorRun. Make sure the + * space is allocated in the per-query context so it will go away at + * ExecutorEnd. */ if (queryDesc->totaltime == NULL) { @@ -184,11 +184,11 @@ explain_ExecutorEnd(QueryDesc *queryDesc) { if (queryDesc->totaltime && auto_explain_enabled()) { - double msec; + double msec; /* - * Make sure stats accumulation is done. (Note: it's okay if - * several levels of hook all do this.) + * Make sure stats accumulation is done. (Note: it's okay if several + * levels of hook all do this.) */ InstrEndLoop(queryDesc->totaltime); @@ -196,11 +196,11 @@ explain_ExecutorEnd(QueryDesc *queryDesc) msec = queryDesc->totaltime->total * 1000.0; if (msec >= auto_explain_log_min_duration) { - StringInfoData buf; + StringInfoData buf; initStringInfo(&buf); ExplainPrintPlan(&buf, queryDesc, - queryDesc->doInstrument && auto_explain_log_analyze, + queryDesc->doInstrument && auto_explain_log_analyze, auto_explain_log_verbose); /* Remove last line break */ diff --git a/contrib/btree_gin/btree_gin.c b/contrib/btree_gin/btree_gin.c index 164eeb8d3b..6fae89cad5 100644 --- a/contrib/btree_gin/btree_gin.c +++ b/contrib/btree_gin/btree_gin.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gin/btree_gin.c,v 1.1 2009/03/25 23:20:01 tgl Exp $ + * $PostgreSQL: pgsql/contrib/btree_gin/btree_gin.c,v 1.2 2009/06/11 14:48:50 momjian Exp $ */ #include "postgres.h" @@ -19,20 +19,20 @@ PG_MODULE_MAGIC; typedef struct TypeInfo { - bool is_varlena; - Datum (*leftmostvalue)(void); - Datum (*typecmp)(FunctionCallInfo); + bool is_varlena; + Datum (*leftmostvalue) (void); + Datum (*typecmp) (FunctionCallInfo); } TypeInfo; typedef struct QueryInfo { - StrategyNumber strategy; - Datum datum; + StrategyNumber strategy; + Datum datum; } QueryInfo; #define GIN_EXTRACT_VALUE(type) \ PG_FUNCTION_INFO_V1(gin_extract_value_##type); \ -Datum gin_extract_value_##type(PG_FUNCTION_ARGS); \ +Datum gin_extract_value_##type(PG_FUNCTION_ARGS); \ Datum \ gin_extract_value_##type(PG_FUNCTION_ARGS) \ { \ @@ -59,7 +59,7 @@ gin_extract_value_##type(PG_FUNCTION_ARGS) \ #define GIN_EXTRACT_QUERY(type) \ PG_FUNCTION_INFO_V1(gin_extract_query_##type); \ -Datum gin_extract_query_##type(PG_FUNCTION_ARGS); \ +Datum gin_extract_query_##type(PG_FUNCTION_ARGS); \ Datum \ gin_extract_query_##type(PG_FUNCTION_ARGS) \ { \ @@ -67,7 +67,7 @@ gin_extract_query_##type(PG_FUNCTION_ARGS) \ int32 *nentries = (int32 *) PG_GETARG_POINTER(1); \ StrategyNumber strategy = PG_GETARG_UINT16(2); \ bool **partialmatch = (bool **) PG_GETARG_POINTER(3); \ - Pointer **extra_data = (Pointer **) PG_GETARG_POINTER(4); \ + Pointer **extra_data = (Pointer **) PG_GETARG_POINTER(4); \ Datum *entries = (Datum *) palloc(sizeof(Datum)); \ QueryInfo *data = (QueryInfo *) palloc(sizeof(QueryInfo)); \ bool *ptr_partialmatch; \ @@ -109,7 +109,7 @@ gin_extract_query_##type(PG_FUNCTION_ARGS) \ */ #define GIN_COMPARE_PREFIX(type) \ PG_FUNCTION_INFO_V1(gin_compare_prefix_##type); \ -Datum gin_compare_prefix_##type(PG_FUNCTION_ARGS); \ +Datum gin_compare_prefix_##type(PG_FUNCTION_ARGS); \ Datum \ gin_compare_prefix_##type(PG_FUNCTION_ARGS) \ { \ @@ -120,10 +120,10 @@ gin_compare_prefix_##type(PG_FUNCTION_ARGS) \ cmp; \ \ cmp = DatumGetInt32(DirectFunctionCall2( \ - TypeInfo_##type.typecmp, \ - (data->strategy == BTLessStrategyNumber || \ + TypeInfo_##type.typecmp, \ + (data->strategy == BTLessStrategyNumber || \ data->strategy == BTLessEqualStrategyNumber) \ - ? data->datum : a, \ + ? data->datum : a, \ b)); \ \ switch (data->strategy) \ @@ -166,7 +166,7 @@ gin_compare_prefix_##type(PG_FUNCTION_ARGS) \ res = 1; \ break; \ default: \ - elog(ERROR, "unrecognized strategy number: %d", \ + elog(ERROR, "unrecognized strategy number: %d", \ data->strategy); \ res = 0; \ } \ @@ -181,11 +181,11 @@ gin_compare_prefix_##type(PG_FUNCTION_ARGS) \ PG_FUNCTION_INFO_V1(gin_btree_consistent); -Datum gin_btree_consistent(PG_FUNCTION_ARGS); +Datum gin_btree_consistent(PG_FUNCTION_ARGS); Datum gin_btree_consistent(PG_FUNCTION_ARGS) { - bool *recheck = (bool *) PG_GETARG_POINTER(5); + bool *recheck = (bool *) PG_GETARG_POINTER(5); *recheck = false; PG_RETURN_BOOL(true); @@ -197,6 +197,7 @@ leftmostvalue_int2(void) return Int16GetDatum(SHRT_MIN); } static TypeInfo TypeInfo_int2 = {false, leftmostvalue_int2, btint2cmp}; + GIN_SUPPORT(int2) static Datum @@ -205,18 +206,20 @@ leftmostvalue_int4(void) return Int32GetDatum(INT_MIN); } static TypeInfo TypeInfo_int4 = {false, leftmostvalue_int4, btint4cmp}; + GIN_SUPPORT(int4) static Datum leftmostvalue_int8(void) { /* - * Use sequence's definition to keep compatibility. - * Another way may make a problem with INT64_IS_BUSTED + * Use sequence's definition to keep compatibility. Another way may make a + * problem with INT64_IS_BUSTED */ return Int64GetDatum(SEQ_MINVALUE); } static TypeInfo TypeInfo_int8 = {false, leftmostvalue_int8, btint8cmp}; + GIN_SUPPORT(int8) static Datum @@ -225,6 +228,7 @@ leftmostvalue_float4(void) return Float4GetDatum(-get_float4_infinity()); } static TypeInfo TypeInfo_float4 = {false, leftmostvalue_float4, btfloat4cmp}; + GIN_SUPPORT(float4) static Datum @@ -233,18 +237,20 @@ leftmostvalue_float8(void) return Float8GetDatum(-get_float8_infinity()); } static TypeInfo TypeInfo_float8 = {false, leftmostvalue_float8, btfloat8cmp}; + GIN_SUPPORT(float8) static Datum leftmostvalue_money(void) { /* - * Use sequence's definition to keep compatibility. - * Another way may make a problem with INT64_IS_BUSTED + * Use sequence's definition to keep compatibility. Another way may make a + * problem with INT64_IS_BUSTED */ return Int64GetDatum(SEQ_MINVALUE); } static TypeInfo TypeInfo_money = {false, leftmostvalue_money, cash_cmp}; + GIN_SUPPORT(money) static Datum @@ -253,6 +259,7 @@ leftmostvalue_oid(void) return ObjectIdGetDatum(0); } static TypeInfo TypeInfo_oid = {false, leftmostvalue_oid, btoidcmp}; + GIN_SUPPORT(oid) static Datum @@ -261,9 +268,11 @@ leftmostvalue_timestamp(void) return TimestampGetDatum(DT_NOBEGIN); } static TypeInfo TypeInfo_timestamp = {false, leftmostvalue_timestamp, timestamp_cmp}; + GIN_SUPPORT(timestamp) static TypeInfo TypeInfo_timestamptz = {false, leftmostvalue_timestamp, timestamp_cmp}; + GIN_SUPPORT(timestamptz) static Datum @@ -272,19 +281,21 @@ leftmostvalue_time(void) return TimeADTGetDatum(0); } static TypeInfo TypeInfo_time = {false, leftmostvalue_time, time_cmp}; + GIN_SUPPORT(time) static Datum leftmostvalue_timetz(void) { - TimeTzADT *v = palloc(sizeof(TimeTzADT)); + TimeTzADT *v = palloc(sizeof(TimeTzADT)); v->time = 0; - v->zone = -24*3600; /* XXX is that true? */ + v->zone = -24 * 3600; /* XXX is that true? */ return TimeTzADTPGetDatum(v); } static TypeInfo TypeInfo_timetz = {false, leftmostvalue_timetz, timetz_cmp}; + GIN_SUPPORT(timetz) static Datum @@ -293,12 +304,13 @@ leftmostvalue_date(void) return DateADTGetDatum(DATEVAL_NOBEGIN); } static TypeInfo TypeInfo_date = {false, leftmostvalue_date, date_cmp}; + GIN_SUPPORT(date) static Datum leftmostvalue_interval(void) { - Interval *v = palloc(sizeof(Interval)); + Interval *v = palloc(sizeof(Interval)); v->time = DT_NOBEGIN; v->day = 0; @@ -306,16 +318,18 @@ leftmostvalue_interval(void) return IntervalPGetDatum(v); } static TypeInfo TypeInfo_interval = {false, leftmostvalue_interval, interval_cmp}; + GIN_SUPPORT(interval) static Datum leftmostvalue_macaddr(void) { - macaddr *v = palloc0(sizeof(macaddr)); + macaddr *v = palloc0(sizeof(macaddr)); return MacaddrPGetDatum(v); } static TypeInfo TypeInfo_macaddr = {false, leftmostvalue_macaddr, macaddr_cmp}; + GIN_SUPPORT(macaddr) static Datum @@ -327,9 +341,11 @@ leftmostvalue_inet(void) Int32GetDatum(-1)); } static TypeInfo TypeInfo_inet = {true, leftmostvalue_inet, network_cmp}; + GIN_SUPPORT(inet) static TypeInfo TypeInfo_cidr = {true, leftmostvalue_inet, network_cmp}; + GIN_SUPPORT(cidr) static Datum @@ -338,6 +354,7 @@ leftmostvalue_text(void) return PointerGetDatum(cstring_to_text_with_len("", 0)); } static TypeInfo TypeInfo_text = {true, leftmostvalue_text, bttextcmp}; + GIN_SUPPORT(text) static Datum @@ -346,9 +363,11 @@ leftmostvalue_char(void) return CharGetDatum(SCHAR_MIN); } static TypeInfo TypeInfo_char = {false, leftmostvalue_char, btcharcmp}; + GIN_SUPPORT(char) static TypeInfo TypeInfo_bytea = {true, leftmostvalue_text, byteacmp}; + GIN_SUPPORT(bytea) static Datum @@ -360,6 +379,7 @@ leftmostvalue_bit(void) Int32GetDatum(-1)); } static TypeInfo TypeInfo_bit = {true, leftmostvalue_bit, bitcmp}; + GIN_SUPPORT(bit) static Datum @@ -371,6 +391,7 @@ leftmostvalue_varbit(void) Int32GetDatum(-1)); } static TypeInfo TypeInfo_varbit = {true, leftmostvalue_varbit, bitcmp}; + GIN_SUPPORT(varbit) /* @@ -383,20 +404,20 @@ GIN_SUPPORT(varbit) #define NUMERIC_IS_LEFTMOST(x) ((x) == NULL) PG_FUNCTION_INFO_V1(gin_numeric_cmp); -Datum gin_numeric_cmp(PG_FUNCTION_ARGS); +Datum gin_numeric_cmp(PG_FUNCTION_ARGS); Datum gin_numeric_cmp(PG_FUNCTION_ARGS) { - Numeric a = (Numeric)PG_GETARG_POINTER(0); - Numeric b = (Numeric)PG_GETARG_POINTER(1); - int res = 0; + Numeric a = (Numeric) PG_GETARG_POINTER(0); + Numeric b = (Numeric) PG_GETARG_POINTER(1); + int res = 0; - if ( NUMERIC_IS_LEFTMOST(a) ) + if (NUMERIC_IS_LEFTMOST(a)) { - res = ( NUMERIC_IS_LEFTMOST(b) ) ? 0 : -1; + res = (NUMERIC_IS_LEFTMOST(b)) ? 0 : -1; } - else if ( NUMERIC_IS_LEFTMOST(b) ) + else if (NUMERIC_IS_LEFTMOST(b)) { res = 1; } @@ -417,4 +438,5 @@ leftmostvalue_numeric(void) } static TypeInfo TypeInfo_numeric = {true, leftmostvalue_numeric, gin_numeric_cmp}; + GIN_SUPPORT(numeric) diff --git a/contrib/btree_gist/btree_bit.c b/contrib/btree_gist/btree_bit.c index feadf6be48..3c5a2e0ce5 100644 --- a/contrib/btree_gist/btree_bit.c +++ b/contrib/btree_gist/btree_bit.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_bit.c,v 1.9 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_bit.c,v 1.10 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" #include "btree_utils_var.h" @@ -82,7 +82,7 @@ gbt_bit_xfrm(bytea *leaf) static GBT_VARKEY * -gbt_bit_l2n(GBT_VARKEY * leaf) +gbt_bit_l2n(GBT_VARKEY *leaf) { GBT_VARKEY *out = leaf; @@ -131,6 +131,7 @@ gbt_bit_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); void *query = (void *) DatumGetByteaP(PG_GETARG_DATUM(1)); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); bool retval = FALSE; diff --git a/contrib/btree_gist/btree_bytea.c b/contrib/btree_gist/btree_bytea.c index 9619a7a0af..9977b201c6 100644 --- a/contrib/btree_gist/btree_bytea.c +++ b/contrib/btree_gist/btree_bytea.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_bytea.c,v 1.8 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_bytea.c,v 1.9 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" #include "btree_utils_var.h" @@ -101,6 +101,7 @@ gbt_bytea_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); void *query = (void *) DatumGetByteaP(PG_GETARG_DATUM(1)); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); bool retval; diff --git a/contrib/btree_gist/btree_cash.c b/contrib/btree_gist/btree_cash.c index 4543b082e9..fbc79c1330 100644 --- a/contrib/btree_gist/btree_cash.c +++ b/contrib/btree_gist/btree_cash.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_cash.c,v 1.8 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_cash.c,v 1.9 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" #include "btree_utils_num.h" @@ -9,7 +9,7 @@ typedef struct { Cash lower; Cash upper; -} cashKEY; +} cashKEY; /* ** Cash ops @@ -101,6 +101,7 @@ gbt_cash_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); Cash query = PG_GETARG_CASH(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); cashKEY *kkk = (cashKEY *) DatumGetPointer(entry->key); @@ -109,8 +110,8 @@ gbt_cash_consistent(PG_FUNCTION_ARGS) /* All cases served by this function are exact */ *recheck = false; - key.lower = (GBT_NUMKEY *) & kkk->lower; - key.upper = (GBT_NUMKEY *) & kkk->upper; + key.lower = (GBT_NUMKEY *) &kkk->lower; + key.upper = (GBT_NUMKEY *) &kkk->upper; PG_RETURN_BOOL( gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo) diff --git a/contrib/btree_gist/btree_date.c b/contrib/btree_gist/btree_date.c index 5ee7273a0b..b9929922fe 100644 --- a/contrib/btree_gist/btree_date.c +++ b/contrib/btree_gist/btree_date.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_date.c,v 1.6 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_date.c,v 1.7 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" #include "btree_utils_num.h" @@ -9,7 +9,7 @@ typedef struct { DateADT lower; DateADT upper; -} dateKEY; +} dateKEY; /* ** date ops @@ -117,6 +117,7 @@ gbt_date_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); DateADT query = PG_GETARG_DATEADT(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); dateKEY *kkk = (dateKEY *) DatumGetPointer(entry->key); @@ -125,8 +126,8 @@ gbt_date_consistent(PG_FUNCTION_ARGS) /* All cases served by this function are exact */ *recheck = false; - key.lower = (GBT_NUMKEY *) & kkk->lower; - key.upper = (GBT_NUMKEY *) & kkk->upper; + key.lower = (GBT_NUMKEY *) &kkk->lower; + key.upper = (GBT_NUMKEY *) &kkk->upper; PG_RETURN_BOOL( gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo) diff --git a/contrib/btree_gist/btree_float4.c b/contrib/btree_gist/btree_float4.c index 1def7479e0..3a508ec0a6 100644 --- a/contrib/btree_gist/btree_float4.c +++ b/contrib/btree_gist/btree_float4.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_float4.c,v 1.7 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_float4.c,v 1.8 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" #include "btree_utils_num.h" @@ -8,7 +8,7 @@ typedef struct float4key { float4 lower; float4 upper; -} float4KEY; +} float4KEY; /* ** float4 ops @@ -100,6 +100,7 @@ gbt_float4_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); float4 query = PG_GETARG_FLOAT4(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); float4KEY *kkk = (float4KEY *) DatumGetPointer(entry->key); @@ -108,8 +109,8 @@ gbt_float4_consistent(PG_FUNCTION_ARGS) /* All cases served by this function are exact */ *recheck = false; - key.lower = (GBT_NUMKEY *) & kkk->lower; - key.upper = (GBT_NUMKEY *) & kkk->upper; + key.lower = (GBT_NUMKEY *) &kkk->lower; + key.upper = (GBT_NUMKEY *) &kkk->upper; PG_RETURN_BOOL( gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo) diff --git a/contrib/btree_gist/btree_float8.c b/contrib/btree_gist/btree_float8.c index 6117adf19e..66e63f31f8 100644 --- a/contrib/btree_gist/btree_float8.c +++ b/contrib/btree_gist/btree_float8.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_float8.c,v 1.7 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_float8.c,v 1.8 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" #include "btree_utils_num.h" @@ -8,7 +8,7 @@ typedef struct float8key { float8 lower; float8 upper; -} float8KEY; +} float8KEY; /* ** float8 ops @@ -101,6 +101,7 @@ gbt_float8_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); float8 query = PG_GETARG_FLOAT8(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); float8KEY *kkk = (float8KEY *) DatumGetPointer(entry->key); @@ -109,8 +110,8 @@ gbt_float8_consistent(PG_FUNCTION_ARGS) /* All cases served by this function are exact */ *recheck = false; - key.lower = (GBT_NUMKEY *) & kkk->lower; - key.upper = (GBT_NUMKEY *) & kkk->upper; + key.lower = (GBT_NUMKEY *) &kkk->lower; + key.upper = (GBT_NUMKEY *) &kkk->upper; PG_RETURN_BOOL( gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo) diff --git a/contrib/btree_gist/btree_gist.c b/contrib/btree_gist/btree_gist.c index d3befb04f7..f109de4a64 100644 --- a/contrib/btree_gist/btree_gist.c +++ b/contrib/btree_gist/btree_gist.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_gist.c,v 1.12 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_gist.c,v 1.13 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" diff --git a/contrib/btree_gist/btree_gist.h b/contrib/btree_gist/btree_gist.h index dd708fb889..425ce8cff4 100644 --- a/contrib/btree_gist/btree_gist.h +++ b/contrib/btree_gist/btree_gist.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_gist.h,v 1.8 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_gist.h,v 1.9 2009/06/11 14:48:50 momjian Exp $ */ #ifndef __BTREE_GIST_H__ #define __BTREE_GIST_H__ diff --git a/contrib/btree_gist/btree_inet.c b/contrib/btree_gist/btree_inet.c index d8c85d7433..32f9d11102 100644 --- a/contrib/btree_gist/btree_inet.c +++ b/contrib/btree_gist/btree_inet.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_inet.c,v 1.9 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_inet.c,v 1.10 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" #include "btree_utils_num.h" @@ -11,7 +11,7 @@ typedef struct inetkey { double lower; double upper; -} inetKEY; +} inetKEY; /* ** inet ops @@ -118,6 +118,7 @@ gbt_inet_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); double query = convert_network_to_scalar(PG_GETARG_DATUM(1), INETOID); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); inetKEY *kkk = (inetKEY *) DatumGetPointer(entry->key); @@ -126,8 +127,8 @@ gbt_inet_consistent(PG_FUNCTION_ARGS) /* All cases served by this function are inexact */ *recheck = true; - key.lower = (GBT_NUMKEY *) & kkk->lower; - key.upper = (GBT_NUMKEY *) & kkk->upper; + key.lower = (GBT_NUMKEY *) &kkk->lower; + key.upper = (GBT_NUMKEY *) &kkk->upper; PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo)); diff --git a/contrib/btree_gist/btree_int2.c b/contrib/btree_gist/btree_int2.c index fa03f364f8..4a1b1c4a39 100644 --- a/contrib/btree_gist/btree_int2.c +++ b/contrib/btree_gist/btree_int2.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_int2.c,v 1.7 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_int2.c,v 1.8 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" #include "btree_utils_num.h" @@ -8,7 +8,7 @@ typedef struct int16key { int16 lower; int16 upper; -} int16KEY; +} int16KEY; /* ** int16 ops @@ -104,6 +104,7 @@ gbt_int2_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); int16 query = PG_GETARG_INT16(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); int16KEY *kkk = (int16KEY *) DatumGetPointer(entry->key); @@ -112,8 +113,8 @@ gbt_int2_consistent(PG_FUNCTION_ARGS) /* All cases served by this function are exact */ *recheck = false; - key.lower = (GBT_NUMKEY *) & kkk->lower; - key.upper = (GBT_NUMKEY *) & kkk->upper; + key.lower = (GBT_NUMKEY *) &kkk->lower; + key.upper = (GBT_NUMKEY *) &kkk->upper; PG_RETURN_BOOL( gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo) diff --git a/contrib/btree_gist/btree_int4.c b/contrib/btree_gist/btree_int4.c index 5d9b1a19f9..f3c29f6051 100644 --- a/contrib/btree_gist/btree_int4.c +++ b/contrib/btree_gist/btree_int4.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_int4.c,v 1.7 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_int4.c,v 1.8 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" #include "btree_utils_num.h" @@ -8,7 +8,7 @@ typedef struct int32key { int32 lower; int32 upper; -} int32KEY; +} int32KEY; /* ** int32 ops @@ -101,6 +101,7 @@ gbt_int4_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); int32 query = PG_GETARG_INT32(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); int32KEY *kkk = (int32KEY *) DatumGetPointer(entry->key); @@ -109,8 +110,8 @@ gbt_int4_consistent(PG_FUNCTION_ARGS) /* All cases served by this function are exact */ *recheck = false; - key.lower = (GBT_NUMKEY *) & kkk->lower; - key.upper = (GBT_NUMKEY *) & kkk->upper; + key.lower = (GBT_NUMKEY *) &kkk->lower; + key.upper = (GBT_NUMKEY *) &kkk->upper; PG_RETURN_BOOL( gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo) diff --git a/contrib/btree_gist/btree_int8.c b/contrib/btree_gist/btree_int8.c index 59493081bd..c65e1d214d 100644 --- a/contrib/btree_gist/btree_int8.c +++ b/contrib/btree_gist/btree_int8.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_int8.c,v 1.7 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_int8.c,v 1.8 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" #include "btree_utils_num.h" @@ -8,7 +8,7 @@ typedef struct int64key { int64 lower; int64 upper; -} int64KEY; +} int64KEY; /* ** int64 ops @@ -101,6 +101,7 @@ gbt_int8_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); int64 query = PG_GETARG_INT64(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); int64KEY *kkk = (int64KEY *) DatumGetPointer(entry->key); @@ -109,8 +110,8 @@ gbt_int8_consistent(PG_FUNCTION_ARGS) /* All cases served by this function are exact */ *recheck = false; - key.lower = (GBT_NUMKEY *) & kkk->lower; - key.upper = (GBT_NUMKEY *) & kkk->upper; + key.lower = (GBT_NUMKEY *) &kkk->lower; + key.upper = (GBT_NUMKEY *) &kkk->upper; PG_RETURN_BOOL( gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo) diff --git a/contrib/btree_gist/btree_interval.c b/contrib/btree_gist/btree_interval.c index e5c096cfda..b136847923 100644 --- a/contrib/btree_gist/btree_interval.c +++ b/contrib/btree_gist/btree_interval.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_interval.c,v 1.11 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_interval.c,v 1.12 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" #include "btree_utils_num.h" @@ -9,7 +9,7 @@ typedef struct { Interval lower, upper; -} intvKEY; +} intvKEY; /* @@ -169,6 +169,7 @@ gbt_intv_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); Interval *query = PG_GETARG_INTERVAL_P(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); intvKEY *kkk = (intvKEY *) DatumGetPointer(entry->key); @@ -177,8 +178,8 @@ gbt_intv_consistent(PG_FUNCTION_ARGS) /* All cases served by this function are exact */ *recheck = false; - key.lower = (GBT_NUMKEY *) & kkk->lower; - key.upper = (GBT_NUMKEY *) & kkk->upper; + key.lower = (GBT_NUMKEY *) &kkk->lower; + key.upper = (GBT_NUMKEY *) &kkk->upper; PG_RETURN_BOOL( gbt_num_consistent(&key, (void *) query, &strategy, GIST_LEAF(entry), &tinfo) diff --git a/contrib/btree_gist/btree_macaddr.c b/contrib/btree_gist/btree_macaddr.c index da57e6d4e3..5c5030faec 100644 --- a/contrib/btree_gist/btree_macaddr.c +++ b/contrib/btree_gist/btree_macaddr.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_macaddr.c,v 1.7 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_macaddr.c,v 1.8 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" #include "btree_utils_num.h" @@ -10,7 +10,7 @@ typedef struct { macaddr lower; macaddr upper; -} macKEY; +} macKEY; /* ** OID ops @@ -122,6 +122,7 @@ gbt_macad_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); macaddr *query = (macaddr *) PG_GETARG_POINTER(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); macKEY *kkk = (macKEY *) DatumGetPointer(entry->key); @@ -130,8 +131,8 @@ gbt_macad_consistent(PG_FUNCTION_ARGS) /* All cases served by this function are exact */ *recheck = false; - key.lower = (GBT_NUMKEY *) & kkk->lower; - key.upper = (GBT_NUMKEY *) & kkk->upper; + key.lower = (GBT_NUMKEY *) &kkk->lower; + key.upper = (GBT_NUMKEY *) &kkk->upper; PG_RETURN_BOOL( gbt_num_consistent(&key, (void *) query, &strategy, GIST_LEAF(entry), &tinfo) diff --git a/contrib/btree_gist/btree_numeric.c b/contrib/btree_gist/btree_numeric.c index 7b52d07353..810bb279da 100644 --- a/contrib/btree_gist/btree_numeric.c +++ b/contrib/btree_gist/btree_numeric.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_numeric.c,v 1.12 2008/06/19 00:46:02 alvherre Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_numeric.c,v 1.13 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" @@ -106,6 +106,7 @@ gbt_numeric_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); void *query = (void *) DatumGetNumeric(PG_GETARG_DATUM(1)); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); bool retval; diff --git a/contrib/btree_gist/btree_oid.c b/contrib/btree_gist/btree_oid.c index 3334275530..6a0805635d 100644 --- a/contrib/btree_gist/btree_oid.c +++ b/contrib/btree_gist/btree_oid.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_oid.c,v 1.7 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_oid.c,v 1.8 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" #include "btree_utils_num.h" @@ -8,7 +8,7 @@ typedef struct { Oid lower; Oid upper; -} oidKEY; +} oidKEY; /* ** OID ops @@ -101,6 +101,7 @@ gbt_oid_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); Oid query = PG_GETARG_OID(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); oidKEY *kkk = (oidKEY *) DatumGetPointer(entry->key); @@ -109,8 +110,8 @@ gbt_oid_consistent(PG_FUNCTION_ARGS) /* All cases served by this function are exact */ *recheck = false; - key.lower = (GBT_NUMKEY *) & kkk->lower; - key.upper = (GBT_NUMKEY *) & kkk->upper; + key.lower = (GBT_NUMKEY *) &kkk->lower; + key.upper = (GBT_NUMKEY *) &kkk->upper; PG_RETURN_BOOL( gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo) diff --git a/contrib/btree_gist/btree_text.c b/contrib/btree_gist/btree_text.c index a0e817780e..8b01eb7aac 100644 --- a/contrib/btree_gist/btree_text.c +++ b/contrib/btree_gist/btree_text.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_text.c,v 1.11 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_text.c,v 1.12 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" #include "btree_utils_var.h" @@ -135,6 +135,7 @@ gbt_text_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); void *query = (void *) DatumGetTextP(PG_GETARG_DATUM(1)); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); bool retval; @@ -161,6 +162,7 @@ gbt_bpchar_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); void *query = (void *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(1))); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); bool retval; diff --git a/contrib/btree_gist/btree_time.c b/contrib/btree_gist/btree_time.c index fff5e3b446..7287755fc7 100644 --- a/contrib/btree_gist/btree_time.c +++ b/contrib/btree_gist/btree_time.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_time.c,v 1.15 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_time.c,v 1.16 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" #include "btree_utils_num.h" @@ -10,7 +10,7 @@ typedef struct { TimeADT lower; TimeADT upper; -} timeKEY; +} timeKEY; /* ** time ops @@ -175,6 +175,7 @@ gbt_time_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); TimeADT query = PG_GETARG_TIMEADT(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); timeKEY *kkk = (timeKEY *) DatumGetPointer(entry->key); @@ -183,8 +184,8 @@ gbt_time_consistent(PG_FUNCTION_ARGS) /* All cases served by this function are exact */ *recheck = false; - key.lower = (GBT_NUMKEY *) & kkk->lower; - key.upper = (GBT_NUMKEY *) & kkk->upper; + key.lower = (GBT_NUMKEY *) &kkk->lower; + key.upper = (GBT_NUMKEY *) &kkk->upper; PG_RETURN_BOOL( gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo) @@ -197,6 +198,7 @@ gbt_timetz_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); TimeTzADT *query = PG_GETARG_TIMETZADT_P(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); timeKEY *kkk = (timeKEY *) DatumGetPointer(entry->key); @@ -212,8 +214,8 @@ gbt_timetz_consistent(PG_FUNCTION_ARGS) qqq = (query->time + query->zone); #endif - key.lower = (GBT_NUMKEY *) & kkk->lower; - key.upper = (GBT_NUMKEY *) & kkk->upper; + key.lower = (GBT_NUMKEY *) &kkk->lower; + key.upper = (GBT_NUMKEY *) &kkk->upper; PG_RETURN_BOOL( gbt_num_consistent(&key, (void *) &qqq, &strategy, GIST_LEAF(entry), &tinfo) @@ -244,15 +246,15 @@ gbt_time_penalty(PG_FUNCTION_ARGS) intr = DatumGetIntervalP(DirectFunctionCall2( time_mi_time, - TimeADTGetDatumFast(newentry->upper), - TimeADTGetDatumFast(origentry->upper))); + TimeADTGetDatumFast(newentry->upper), + TimeADTGetDatumFast(origentry->upper))); res = INTERVAL_TO_SEC(intr); res = Max(res, 0); intr = DatumGetIntervalP(DirectFunctionCall2( time_mi_time, - TimeADTGetDatumFast(origentry->lower), - TimeADTGetDatumFast(newentry->lower))); + TimeADTGetDatumFast(origentry->lower), + TimeADTGetDatumFast(newentry->lower))); res2 = INTERVAL_TO_SEC(intr); res2 = Max(res2, 0); @@ -264,8 +266,8 @@ gbt_time_penalty(PG_FUNCTION_ARGS) { intr = DatumGetIntervalP(DirectFunctionCall2( time_mi_time, - TimeADTGetDatumFast(origentry->upper), - TimeADTGetDatumFast(origentry->lower))); + TimeADTGetDatumFast(origentry->upper), + TimeADTGetDatumFast(origentry->lower))); *result += FLT_MIN; *result += (float) (res / (res + INTERVAL_TO_SEC(intr))); *result *= (FLT_MAX / (((GISTENTRY *) PG_GETARG_POINTER(0))->rel->rd_att->natts + 1)); diff --git a/contrib/btree_gist/btree_ts.c b/contrib/btree_gist/btree_ts.c index c20699fa91..e0780ef391 100644 --- a/contrib/btree_gist/btree_ts.c +++ b/contrib/btree_gist/btree_ts.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_ts.c,v 1.16 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_ts.c,v 1.17 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" #include "btree_utils_num.h" @@ -9,7 +9,7 @@ typedef struct { Timestamp lower; Timestamp upper; -} tsKEY; +} tsKEY; /* ** timestamp ops @@ -192,6 +192,7 @@ gbt_ts_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); Timestamp query = PG_GETARG_TIMESTAMP(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); tsKEY *kkk = (tsKEY *) DatumGetPointer(entry->key); @@ -200,8 +201,8 @@ gbt_ts_consistent(PG_FUNCTION_ARGS) /* All cases served by this function are exact */ *recheck = false; - key.lower = (GBT_NUMKEY *) & kkk->lower; - key.upper = (GBT_NUMKEY *) & kkk->upper; + key.lower = (GBT_NUMKEY *) &kkk->lower; + key.upper = (GBT_NUMKEY *) &kkk->upper; PG_RETURN_BOOL( gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo) @@ -212,8 +213,9 @@ Datum gbt_tstz_consistent(PG_FUNCTION_ARGS) { GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); - TimestampTz query = PG_GETARG_TIMESTAMPTZ(1); + TimestampTz query = PG_GETARG_TIMESTAMPTZ(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); char *kkk = (char *) DatumGetPointer(entry->key); @@ -223,8 +225,8 @@ gbt_tstz_consistent(PG_FUNCTION_ARGS) /* All cases served by this function are exact */ *recheck = false; - key.lower = (GBT_NUMKEY *) & kkk[0]; - key.upper = (GBT_NUMKEY *) & kkk[MAXALIGN(tinfo.size)]; + key.lower = (GBT_NUMKEY *) &kkk[0]; + key.upper = (GBT_NUMKEY *) &kkk[MAXALIGN(tinfo.size)]; qqq = tstz_to_ts_gmt(query); PG_RETURN_BOOL( diff --git a/contrib/btree_gist/btree_utils_num.c b/contrib/btree_gist/btree_utils_num.c index 357a8f165b..ff206dcda8 100644 --- a/contrib/btree_gist/btree_utils_num.c +++ b/contrib/btree_gist/btree_utils_num.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_utils_num.c,v 1.11 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_utils_num.c,v 1.12 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" #include "btree_utils_num.h" @@ -8,7 +8,7 @@ GISTENTRY * -gbt_num_compress(GISTENTRY *retval, GISTENTRY *entry, const gbtree_ninfo * tinfo) +gbt_num_compress(GISTENTRY *retval, GISTENTRY *entry, const gbtree_ninfo *tinfo) { if (entry->leafkey) { @@ -94,7 +94,7 @@ gbt_num_compress(GISTENTRY *retval, GISTENTRY *entry, const gbtree_ninfo * tinfo */ void * -gbt_num_union(GBT_NUMKEY * out, const GistEntryVector *entryvec, const gbtree_ninfo * tinfo) +gbt_num_union(GBT_NUMKEY *out, const GistEntryVector *entryvec, const gbtree_ninfo *tinfo) { int i, numranges; @@ -132,7 +132,7 @@ gbt_num_union(GBT_NUMKEY * out, const GistEntryVector *entryvec, const gbtree_ni */ bool -gbt_num_same(const GBT_NUMKEY * a, const GBT_NUMKEY * b, const gbtree_ninfo * tinfo) +gbt_num_same(const GBT_NUMKEY *a, const GBT_NUMKEY *b, const gbtree_ninfo *tinfo) { GBT_NUMKEY_R b1, @@ -154,7 +154,7 @@ gbt_num_same(const GBT_NUMKEY * a, const GBT_NUMKEY * b, const gbtree_ninfo * ti void -gbt_num_bin_union(Datum *u, GBT_NUMKEY * e, const gbtree_ninfo * tinfo) +gbt_num_bin_union(Datum *u, GBT_NUMKEY *e, const gbtree_ninfo *tinfo) { GBT_NUMKEY_R rd; @@ -189,11 +189,11 @@ gbt_num_bin_union(Datum *u, GBT_NUMKEY * e, const gbtree_ninfo * tinfo) bool gbt_num_consistent( - const GBT_NUMKEY_R * key, + const GBT_NUMKEY_R *key, const void *query, const StrategyNumber *strategy, bool is_leaf, - const gbtree_ninfo * tinfo + const gbtree_ninfo *tinfo ) { @@ -235,7 +235,7 @@ gbt_num_consistent( GIST_SPLITVEC * gbt_num_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v, - const gbtree_ninfo * tinfo) + const gbtree_ninfo *tinfo) { OffsetNumber i, maxoff = entryvec->n - 1; diff --git a/contrib/btree_gist/btree_utils_num.h b/contrib/btree_gist/btree_utils_num.h index 42573aa8e8..dcd17bc430 100644 --- a/contrib/btree_gist/btree_utils_num.h +++ b/contrib/btree_gist/btree_utils_num.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_utils_num.h,v 1.13 2008/06/19 00:46:02 alvherre Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_utils_num.h,v 1.14 2009/06/11 14:48:50 momjian Exp $ */ #ifndef __BTREE_UTILS_NUM_H__ #define __BTREE_UTILS_NUM_H__ @@ -17,7 +17,7 @@ typedef struct { const GBT_NUMKEY *lower, *upper; -} GBT_NUMKEY_R; +} GBT_NUMKEY_R; /* for sorting */ @@ -25,7 +25,7 @@ typedef struct { int i; GBT_NUMKEY *t; -} Nsrt; +} Nsrt; /* type description */ @@ -46,7 +46,7 @@ typedef struct bool (*f_le) (const void *, const void *); /* less equal */ bool (*f_lt) (const void *, const void *); /* less then */ int (*f_cmp) (const void *, const void *); /* key compare function */ -} gbtree_ninfo; +} gbtree_ninfo; /* @@ -92,24 +92,24 @@ typedef struct #endif -extern bool gbt_num_consistent(const GBT_NUMKEY_R * key, const void *query, +extern bool gbt_num_consistent(const GBT_NUMKEY_R *key, const void *query, const StrategyNumber *strategy, bool is_leaf, - const gbtree_ninfo * tinfo); + const gbtree_ninfo *tinfo); extern GIST_SPLITVEC *gbt_num_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v, - const gbtree_ninfo * tinfo); + const gbtree_ninfo *tinfo); extern GISTENTRY *gbt_num_compress(GISTENTRY *retval, GISTENTRY *entry, - const gbtree_ninfo * tinfo); + const gbtree_ninfo *tinfo); -extern void *gbt_num_union(GBT_NUMKEY * out, const GistEntryVector *entryvec, - const gbtree_ninfo * tinfo); +extern void *gbt_num_union(GBT_NUMKEY *out, const GistEntryVector *entryvec, + const gbtree_ninfo *tinfo); -extern bool gbt_num_same(const GBT_NUMKEY * a, const GBT_NUMKEY * b, - const gbtree_ninfo * tinfo); +extern bool gbt_num_same(const GBT_NUMKEY *a, const GBT_NUMKEY *b, + const gbtree_ninfo *tinfo); -extern void gbt_num_bin_union(Datum *u, GBT_NUMKEY * e, - const gbtree_ninfo * tinfo); +extern void gbt_num_bin_union(Datum *u, GBT_NUMKEY *e, + const gbtree_ninfo *tinfo); #endif diff --git a/contrib/btree_gist/btree_utils_var.c b/contrib/btree_gist/btree_utils_var.c index 4f1b7e49a3..57d12e4cda 100644 --- a/contrib/btree_gist/btree_utils_var.c +++ b/contrib/btree_gist/btree_utils_var.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_utils_var.c,v 1.20 2008/06/19 00:46:02 alvherre Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_utils_var.c,v 1.21 2009/06/11 14:48:50 momjian Exp $ */ #include "btree_gist.h" @@ -38,7 +38,7 @@ gbt_var_decompress(PG_FUNCTION_ARGS) /* Returns a better readable representaion of variable key ( sets pointer ) */ GBT_VARKEY_R -gbt_var_key_readable(const GBT_VARKEY * k) +gbt_var_key_readable(const GBT_VARKEY *k) { GBT_VARKEY_R r; @@ -53,7 +53,7 @@ gbt_var_key_readable(const GBT_VARKEY * k) GBT_VARKEY * -gbt_var_key_copy(const GBT_VARKEY_R * u, bool force_node) +gbt_var_key_copy(const GBT_VARKEY_R *u, bool force_node) { GBT_VARKEY *r = NULL; @@ -75,7 +75,7 @@ gbt_var_key_copy(const GBT_VARKEY_R * u, bool force_node) static GBT_VARKEY * -gbt_var_leaf2node(GBT_VARKEY * leaf, const gbtree_vinfo * tinfo) +gbt_var_leaf2node(GBT_VARKEY *leaf, const gbtree_vinfo *tinfo) { GBT_VARKEY *out = leaf; @@ -90,7 +90,7 @@ gbt_var_leaf2node(GBT_VARKEY * leaf, const gbtree_vinfo * tinfo) * returns the common prefix length of a node key */ static int32 -gbt_var_node_cp_len(const GBT_VARKEY * node, const gbtree_vinfo * tinfo) +gbt_var_node_cp_len(const GBT_VARKEY *node, const gbtree_vinfo *tinfo) { GBT_VARKEY_R r = gbt_var_key_readable(node); @@ -141,7 +141,7 @@ gbt_var_node_cp_len(const GBT_VARKEY * node, const gbtree_vinfo * tinfo) * returns true, if query matches prefix ( common prefix ) */ static bool -gbt_bytea_pf_match(const bytea *pf, const bytea *query, const gbtree_vinfo * tinfo) +gbt_bytea_pf_match(const bytea *pf, const bytea *query, const gbtree_vinfo *tinfo) { bool out = FALSE; @@ -186,7 +186,7 @@ gbt_bytea_pf_match(const bytea *pf, const bytea *query, const gbtree_vinfo * tin */ static bool -gbt_var_node_pf_match(const GBT_VARKEY_R * node, const bytea *query, const gbtree_vinfo * tinfo) +gbt_var_node_pf_match(const GBT_VARKEY_R *node, const bytea *query, const gbtree_vinfo *tinfo) { return (tinfo->trnc && ( @@ -202,7 +202,7 @@ gbt_var_node_pf_match(const GBT_VARKEY_R * node, const bytea *query, const gbtre * cpf_length .. common prefix length */ static GBT_VARKEY * -gbt_var_node_truncate(const GBT_VARKEY * node, int32 cpf_length, const gbtree_vinfo * tinfo) +gbt_var_node_truncate(const GBT_VARKEY *node, int32 cpf_length, const gbtree_vinfo *tinfo) { GBT_VARKEY *out = NULL; GBT_VARKEY_R r = gbt_var_key_readable(node); @@ -231,7 +231,7 @@ gbt_var_node_truncate(const GBT_VARKEY * node, int32 cpf_length, const gbtree_vi void -gbt_var_bin_union(Datum *u, GBT_VARKEY * e, const gbtree_vinfo * tinfo) +gbt_var_bin_union(Datum *u, GBT_VARKEY *e, const gbtree_vinfo *tinfo) { GBT_VARKEY *nk = NULL; @@ -279,7 +279,7 @@ gbt_var_bin_union(Datum *u, GBT_VARKEY * e, const gbtree_vinfo * tinfo) GISTENTRY * -gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo * tinfo) +gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo) { GISTENTRY *retval; @@ -307,7 +307,7 @@ gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo * tinfo) GBT_VARKEY * -gbt_var_union(const GistEntryVector *entryvec, int32 *size, const gbtree_vinfo * tinfo) +gbt_var_union(const GistEntryVector *entryvec, int32 *size, const gbtree_vinfo *tinfo) { int i = 0, @@ -346,7 +346,7 @@ gbt_var_union(const GistEntryVector *entryvec, int32 *size, const gbtree_vinfo * bool -gbt_var_same(bool *result, const Datum d1, const Datum d2, const gbtree_vinfo * tinfo) +gbt_var_same(bool *result, const Datum d1, const Datum d2, const gbtree_vinfo *tinfo) { GBT_VARKEY *t1 = (GBT_VARKEY *) DatumGetPointer(d1); @@ -371,7 +371,7 @@ gbt_var_same(bool *result, const Datum d1, const Datum d2, const gbtree_vinfo * float * -gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n, const gbtree_vinfo * tinfo) +gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n, const gbtree_vinfo *tinfo) { GBT_VARKEY *orge = (GBT_VARKEY *) DatumGetPointer(o->key); @@ -449,7 +449,7 @@ gbt_vsrt_cmp(const void *a, const void *b, void *arg) } GIST_SPLITVEC * -gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v, const gbtree_vinfo * tinfo) +gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v, const gbtree_vinfo *tinfo) { OffsetNumber i, maxoff = entryvec->n - 1; @@ -541,11 +541,11 @@ gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v, const gbtre */ bool gbt_var_consistent( - GBT_VARKEY_R * key, + GBT_VARKEY_R *key, const void *query, const StrategyNumber *strategy, bool is_leaf, - const gbtree_vinfo * tinfo + const gbtree_vinfo *tinfo ) { bool retval = FALSE; diff --git a/contrib/btree_gist/btree_utils_var.h b/contrib/btree_gist/btree_utils_var.h index 53d720adc5..49f5d59ee2 100644 --- a/contrib/btree_gist/btree_utils_var.h +++ b/contrib/btree_gist/btree_utils_var.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/btree_gist/btree_utils_var.h,v 1.8 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/btree_gist/btree_utils_var.h,v 1.9 2009/06/11 14:48:50 momjian Exp $ */ #ifndef __BTREE_UTILS_VAR_H__ #define __BTREE_UTILS_VAR_H__ @@ -16,14 +16,14 @@ typedef struct { bytea *lower, *upper; -} GBT_VARKEY_R; +} GBT_VARKEY_R; /* used for key sorting */ typedef struct { int i; GBT_VARKEY *t; -} Vsrt; +} Vsrt; /* type description @@ -49,32 +49,32 @@ typedef struct bool (*f_lt) (const void *, const void *); /* less then */ int32 (*f_cmp) (const bytea *, const bytea *); /* node compare */ GBT_VARKEY *(*f_l2n) (GBT_VARKEY *); /* convert leaf to node */ -} gbtree_vinfo; +} gbtree_vinfo; -extern GBT_VARKEY_R gbt_var_key_readable(const GBT_VARKEY * k); +extern GBT_VARKEY_R gbt_var_key_readable(const GBT_VARKEY *k); -extern GBT_VARKEY *gbt_var_key_copy(const GBT_VARKEY_R * u, bool force_node); +extern GBT_VARKEY *gbt_var_key_copy(const GBT_VARKEY_R *u, bool force_node); -extern GISTENTRY *gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo * tinfo); +extern GISTENTRY *gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo); extern GBT_VARKEY *gbt_var_union(const GistEntryVector *entryvec, int32 *size, - const gbtree_vinfo * tinfo); + const gbtree_vinfo *tinfo); extern bool gbt_var_same(bool *result, const Datum d1, const Datum d2, - const gbtree_vinfo * tinfo); + const gbtree_vinfo *tinfo); extern float *gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n, - const gbtree_vinfo * tinfo); + const gbtree_vinfo *tinfo); -extern bool gbt_var_consistent(GBT_VARKEY_R * key, const void *query, +extern bool gbt_var_consistent(GBT_VARKEY_R *key, const void *query, const StrategyNumber *strategy, bool is_leaf, - const gbtree_vinfo * tinfo); + const gbtree_vinfo *tinfo); extern GIST_SPLITVEC *gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v, - const gbtree_vinfo * tinfo); -extern void gbt_var_bin_union(Datum *u, GBT_VARKEY * e, - const gbtree_vinfo * tinfo); + const gbtree_vinfo *tinfo); +extern void gbt_var_bin_union(Datum *u, GBT_VARKEY *e, + const gbtree_vinfo *tinfo); #endif diff --git a/contrib/chkpass/chkpass.c b/contrib/chkpass/chkpass.c index ed6a7566b2..56a998ec83 100644 --- a/contrib/chkpass/chkpass.c +++ b/contrib/chkpass/chkpass.c @@ -4,7 +4,7 @@ * darcy@druid.net * http://www.druid.net/darcy/ * - * $PostgreSQL: pgsql/contrib/chkpass/chkpass.c,v 1.20 2008/03/25 22:42:41 tgl Exp $ + * $PostgreSQL: pgsql/contrib/chkpass/chkpass.c,v 1.21 2009/06/11 14:48:50 momjian Exp $ * best viewed with tabs set to 4 */ @@ -37,7 +37,7 @@ PG_MODULE_MAGIC; typedef struct chkpass { char password[16]; -} chkpass; +} chkpass; /* * Various forward declarations: diff --git a/contrib/citext/citext.c b/contrib/citext/citext.c index eb885c0037..371e70f74d 100644 --- a/contrib/citext/citext.c +++ b/contrib/citext/citext.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/citext/citext.c,v 1.1 2008/07/29 18:31:20 tgl Exp $ + * $PostgreSQL: pgsql/contrib/citext/citext.c,v 1.2 2009/06/11 14:48:50 momjian Exp $ */ #include "postgres.h" @@ -13,27 +13,27 @@ PG_MODULE_MAGIC; #endif /* - * ==================== - * FORWARD DECLARATIONS - * ==================== + * ==================== + * FORWARD DECLARATIONS + * ==================== */ -static int32 citextcmp (text *left, text *right); -extern Datum citext_cmp (PG_FUNCTION_ARGS); -extern Datum citext_hash (PG_FUNCTION_ARGS); -extern Datum citext_eq (PG_FUNCTION_ARGS); -extern Datum citext_ne (PG_FUNCTION_ARGS); -extern Datum citext_gt (PG_FUNCTION_ARGS); -extern Datum citext_ge (PG_FUNCTION_ARGS); -extern Datum citext_lt (PG_FUNCTION_ARGS); -extern Datum citext_le (PG_FUNCTION_ARGS); -extern Datum citext_smaller (PG_FUNCTION_ARGS); -extern Datum citext_larger (PG_FUNCTION_ARGS); +static int32 citextcmp(text *left, text *right); +extern Datum citext_cmp(PG_FUNCTION_ARGS); +extern Datum citext_hash(PG_FUNCTION_ARGS); +extern Datum citext_eq(PG_FUNCTION_ARGS); +extern Datum citext_ne(PG_FUNCTION_ARGS); +extern Datum citext_gt(PG_FUNCTION_ARGS); +extern Datum citext_ge(PG_FUNCTION_ARGS); +extern Datum citext_lt(PG_FUNCTION_ARGS); +extern Datum citext_le(PG_FUNCTION_ARGS); +extern Datum citext_smaller(PG_FUNCTION_ARGS); +extern Datum citext_larger(PG_FUNCTION_ARGS); /* - * ================= - * UTILITY FUNCTIONS - * ================= + * ================= + * UTILITY FUNCTIONS + * ================= */ /* @@ -42,27 +42,28 @@ extern Datum citext_larger (PG_FUNCTION_ARGS); * Returns int32 negative, zero, or positive. */ static int32 -citextcmp (text *left, text *right) +citextcmp(text *left, text *right) { - char *lcstr, *rcstr; - int32 result; + char *lcstr, + *rcstr; + int32 result; - lcstr = str_tolower(VARDATA_ANY(left), VARSIZE_ANY_EXHDR(left)); - rcstr = str_tolower(VARDATA_ANY(right), VARSIZE_ANY_EXHDR(right)); + lcstr = str_tolower(VARDATA_ANY(left), VARSIZE_ANY_EXHDR(left)); + rcstr = str_tolower(VARDATA_ANY(right), VARSIZE_ANY_EXHDR(right)); - result = varstr_cmp(lcstr, strlen(lcstr), - rcstr, strlen(rcstr)); + result = varstr_cmp(lcstr, strlen(lcstr), + rcstr, strlen(rcstr)); - pfree(lcstr); - pfree(rcstr); + pfree(lcstr); + pfree(rcstr); - return result; + return result; } /* - * ================== - * INDEXING FUNCTIONS - * ================== + * ================== + * INDEXING FUNCTIONS + * ================== */ PG_FUNCTION_INFO_V1(citext_cmp); @@ -70,16 +71,16 @@ PG_FUNCTION_INFO_V1(citext_cmp); Datum citext_cmp(PG_FUNCTION_ARGS) { - text *left = PG_GETARG_TEXT_PP(0); - text *right = PG_GETARG_TEXT_PP(1); - int32 result; + text *left = PG_GETARG_TEXT_PP(0); + text *right = PG_GETARG_TEXT_PP(1); + int32 result; - result = citextcmp(left, right); + result = citextcmp(left, right); - PG_FREE_IF_COPY(left, 0); - PG_FREE_IF_COPY(right, 1); + PG_FREE_IF_COPY(left, 0); + PG_FREE_IF_COPY(right, 1); - PG_RETURN_INT32(result); + PG_RETURN_INT32(result); } PG_FUNCTION_INFO_V1(citext_hash); @@ -87,24 +88,24 @@ PG_FUNCTION_INFO_V1(citext_hash); Datum citext_hash(PG_FUNCTION_ARGS) { - text *txt = PG_GETARG_TEXT_PP(0); - char *str; - Datum result; + text *txt = PG_GETARG_TEXT_PP(0); + char *str; + Datum result; - str = str_tolower(VARDATA_ANY(txt), VARSIZE_ANY_EXHDR(txt)); - result = hash_any((unsigned char *) str, strlen(str)); - pfree(str); + str = str_tolower(VARDATA_ANY(txt), VARSIZE_ANY_EXHDR(txt)); + result = hash_any((unsigned char *) str, strlen(str)); + pfree(str); - /* Avoid leaking memory for toasted inputs */ - PG_FREE_IF_COPY(txt, 0); + /* Avoid leaking memory for toasted inputs */ + PG_FREE_IF_COPY(txt, 0); - PG_RETURN_DATUM(result); + PG_RETURN_DATUM(result); } /* - * ================== - * OPERATOR FUNCTIONS - * ================== + * ================== + * OPERATOR FUNCTIONS + * ================== */ PG_FUNCTION_INFO_V1(citext_eq); @@ -112,29 +113,29 @@ PG_FUNCTION_INFO_V1(citext_eq); Datum citext_eq(PG_FUNCTION_ARGS) { - text *left = PG_GETARG_TEXT_PP(0); - text *right = PG_GETARG_TEXT_PP(1); - char *lcstr, *rcstr; - bool result; + text *left = PG_GETARG_TEXT_PP(0); + text *right = PG_GETARG_TEXT_PP(1); + char *lcstr, + *rcstr; + bool result; - /* We can't compare lengths in advance of downcasing ... */ + /* We can't compare lengths in advance of downcasing ... */ - lcstr = str_tolower(VARDATA_ANY(left), VARSIZE_ANY_EXHDR(left)); - rcstr = str_tolower(VARDATA_ANY(right), VARSIZE_ANY_EXHDR(right)); + lcstr = str_tolower(VARDATA_ANY(left), VARSIZE_ANY_EXHDR(left)); + rcstr = str_tolower(VARDATA_ANY(right), VARSIZE_ANY_EXHDR(right)); - /* - * Since we only care about equality or not-equality, we can - * avoid all the expense of strcoll() here, and just do bitwise - * comparison. - */ - result = (strcmp(lcstr, rcstr) == 0); + /* + * Since we only care about equality or not-equality, we can avoid all the + * expense of strcoll() here, and just do bitwise comparison. + */ + result = (strcmp(lcstr, rcstr) == 0); - pfree(lcstr); - pfree(rcstr); - PG_FREE_IF_COPY(left, 0); - PG_FREE_IF_COPY(right, 1); + pfree(lcstr); + pfree(rcstr); + PG_FREE_IF_COPY(left, 0); + PG_FREE_IF_COPY(right, 1); - PG_RETURN_BOOL(result); + PG_RETURN_BOOL(result); } PG_FUNCTION_INFO_V1(citext_ne); @@ -142,29 +143,29 @@ PG_FUNCTION_INFO_V1(citext_ne); Datum citext_ne(PG_FUNCTION_ARGS) { - text *left = PG_GETARG_TEXT_PP(0); - text *right = PG_GETARG_TEXT_PP(1); - char *lcstr, *rcstr; - bool result; + text *left = PG_GETARG_TEXT_PP(0); + text *right = PG_GETARG_TEXT_PP(1); + char *lcstr, + *rcstr; + bool result; - /* We can't compare lengths in advance of downcasing ... */ + /* We can't compare lengths in advance of downcasing ... */ - lcstr = str_tolower(VARDATA_ANY(left), VARSIZE_ANY_EXHDR(left)); - rcstr = str_tolower(VARDATA_ANY(right), VARSIZE_ANY_EXHDR(right)); + lcstr = str_tolower(VARDATA_ANY(left), VARSIZE_ANY_EXHDR(left)); + rcstr = str_tolower(VARDATA_ANY(right), VARSIZE_ANY_EXHDR(right)); - /* - * Since we only care about equality or not-equality, we can - * avoid all the expense of strcoll() here, and just do bitwise - * comparison. - */ - result = (strcmp(lcstr, rcstr) != 0); + /* + * Since we only care about equality or not-equality, we can avoid all the + * expense of strcoll() here, and just do bitwise comparison. + */ + result = (strcmp(lcstr, rcstr) != 0); - pfree(lcstr); - pfree(rcstr); - PG_FREE_IF_COPY(left, 0); - PG_FREE_IF_COPY(right, 1); + pfree(lcstr); + pfree(rcstr); + PG_FREE_IF_COPY(left, 0); + PG_FREE_IF_COPY(right, 1); - PG_RETURN_BOOL(result); + PG_RETURN_BOOL(result); } PG_FUNCTION_INFO_V1(citext_lt); @@ -172,16 +173,16 @@ PG_FUNCTION_INFO_V1(citext_lt); Datum citext_lt(PG_FUNCTION_ARGS) { - text *left = PG_GETARG_TEXT_PP(0); - text *right = PG_GETARG_TEXT_PP(1); - bool result; + text *left = PG_GETARG_TEXT_PP(0); + text *right = PG_GETARG_TEXT_PP(1); + bool result; - result = citextcmp(left, right) < 0; + result = citextcmp(left, right) < 0; - PG_FREE_IF_COPY(left, 0); - PG_FREE_IF_COPY(right, 1); + PG_FREE_IF_COPY(left, 0); + PG_FREE_IF_COPY(right, 1); - PG_RETURN_BOOL(result); + PG_RETURN_BOOL(result); } PG_FUNCTION_INFO_V1(citext_le); @@ -189,16 +190,16 @@ PG_FUNCTION_INFO_V1(citext_le); Datum citext_le(PG_FUNCTION_ARGS) { - text *left = PG_GETARG_TEXT_PP(0); - text *right = PG_GETARG_TEXT_PP(1); - bool result; + text *left = PG_GETARG_TEXT_PP(0); + text *right = PG_GETARG_TEXT_PP(1); + bool result; - result = citextcmp(left, right) <= 0; + result = citextcmp(left, right) <= 0; - PG_FREE_IF_COPY(left, 0); - PG_FREE_IF_COPY(right, 1); + PG_FREE_IF_COPY(left, 0); + PG_FREE_IF_COPY(right, 1); - PG_RETURN_BOOL(result); + PG_RETURN_BOOL(result); } PG_FUNCTION_INFO_V1(citext_gt); @@ -206,16 +207,16 @@ PG_FUNCTION_INFO_V1(citext_gt); Datum citext_gt(PG_FUNCTION_ARGS) { - text *left = PG_GETARG_TEXT_PP(0); - text *right = PG_GETARG_TEXT_PP(1); - bool result; + text *left = PG_GETARG_TEXT_PP(0); + text *right = PG_GETARG_TEXT_PP(1); + bool result; - result = citextcmp(left, right) > 0; + result = citextcmp(left, right) > 0; - PG_FREE_IF_COPY(left, 0); - PG_FREE_IF_COPY(right, 1); + PG_FREE_IF_COPY(left, 0); + PG_FREE_IF_COPY(right, 1); - PG_RETURN_BOOL(result); + PG_RETURN_BOOL(result); } PG_FUNCTION_INFO_V1(citext_ge); @@ -223,22 +224,22 @@ PG_FUNCTION_INFO_V1(citext_ge); Datum citext_ge(PG_FUNCTION_ARGS) { - text *left = PG_GETARG_TEXT_PP(0); - text *right = PG_GETARG_TEXT_PP(1); - bool result; + text *left = PG_GETARG_TEXT_PP(0); + text *right = PG_GETARG_TEXT_PP(1); + bool result; - result = citextcmp(left, right) >= 0; + result = citextcmp(left, right) >= 0; - PG_FREE_IF_COPY(left, 0); - PG_FREE_IF_COPY(right, 1); + PG_FREE_IF_COPY(left, 0); + PG_FREE_IF_COPY(right, 1); - PG_RETURN_BOOL(result); + PG_RETURN_BOOL(result); } /* - * =================== - * AGGREGATE FUNCTIONS - * =================== + * =================== + * AGGREGATE FUNCTIONS + * =================== */ PG_FUNCTION_INFO_V1(citext_smaller); @@ -246,12 +247,12 @@ PG_FUNCTION_INFO_V1(citext_smaller); Datum citext_smaller(PG_FUNCTION_ARGS) { - text *left = PG_GETARG_TEXT_PP(0); - text *right = PG_GETARG_TEXT_PP(1); - text *result; + text *left = PG_GETARG_TEXT_PP(0); + text *right = PG_GETARG_TEXT_PP(1); + text *result; - result = citextcmp(left, right) < 0 ? left : right; - PG_RETURN_TEXT_P(result); + result = citextcmp(left, right) < 0 ? left : right; + PG_RETURN_TEXT_P(result); } PG_FUNCTION_INFO_V1(citext_larger); @@ -259,10 +260,10 @@ PG_FUNCTION_INFO_V1(citext_larger); Datum citext_larger(PG_FUNCTION_ARGS) { - text *left = PG_GETARG_TEXT_PP(0); - text *right = PG_GETARG_TEXT_PP(1); - text *result; + text *left = PG_GETARG_TEXT_PP(0); + text *right = PG_GETARG_TEXT_PP(1); + text *result; - result = citextcmp(left, right) > 0 ? left : right; - PG_RETURN_TEXT_P(result); + result = citextcmp(left, right) > 0 ? left : right; + PG_RETURN_TEXT_P(result); } diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c index 72ec3ba2ad..62cd3a2d02 100644 --- a/contrib/cube/cube.c +++ b/contrib/cube/cube.c @@ -1,5 +1,5 @@ /****************************************************************************** - $PostgreSQL: pgsql/contrib/cube/cube.c,v 1.36 2008/05/29 18:46:40 tgl Exp $ + $PostgreSQL: pgsql/contrib/cube/cube.c,v 1.37 2009/06/11 14:48:50 momjian Exp $ This file contains routines that can be bound to a Postgres backend and called by the backend in the process of processing queries. The calling @@ -134,14 +134,14 @@ Datum cube_enlarge(PG_FUNCTION_ARGS); /* ** For internal use only */ -int32 cube_cmp_v0(NDBOX * a, NDBOX * b); -bool cube_contains_v0(NDBOX * a, NDBOX * b); -bool cube_overlap_v0(NDBOX * a, NDBOX * b); -NDBOX *cube_union_v0(NDBOX * a, NDBOX * b); -void rt_cube_size(NDBOX * a, double *sz); -NDBOX *g_cube_binary_union(NDBOX * r1, NDBOX * r2, int *sizep); -bool g_cube_leaf_consistent(NDBOX * key, NDBOX * query, StrategyNumber strategy); -bool g_cube_internal_consistent(NDBOX * key, NDBOX * query, StrategyNumber strategy); +int32 cube_cmp_v0(NDBOX *a, NDBOX *b); +bool cube_contains_v0(NDBOX *a, NDBOX *b); +bool cube_overlap_v0(NDBOX *a, NDBOX *b); +NDBOX *cube_union_v0(NDBOX *a, NDBOX *b); +void rt_cube_size(NDBOX *a, double *sz); +NDBOX *g_cube_binary_union(NDBOX *r1, NDBOX *r2, int *sizep); +bool g_cube_leaf_consistent(NDBOX *key, NDBOX *query, StrategyNumber strategy); +bool g_cube_internal_consistent(NDBOX *key, NDBOX *query, StrategyNumber strategy); /* ** Auxiliary funxtions @@ -201,7 +201,7 @@ cube_a_f8_f8(PG_FUNCTION_ARGS) dur = ARRPTR(ur); dll = ARRPTR(ll); - size = offsetof(NDBOX, x[0]) + sizeof(double) * 2 * dim; + size = offsetof(NDBOX, x[0]) +sizeof(double) * 2 * dim; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = dim; @@ -237,7 +237,7 @@ cube_a_f8(PG_FUNCTION_ARGS) dur = ARRPTR(ur); - size = offsetof(NDBOX, x[0]) + sizeof(double) * 2 * dim; + size = offsetof(NDBOX, x[0]) +sizeof(double) * 2 * dim; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = dim; @@ -270,7 +270,7 @@ cube_subset(PG_FUNCTION_ARGS) dx = (int4 *) ARR_DATA_PTR(idx); dim = ARRNELEMS(idx); - size = offsetof(NDBOX, x[0]) + sizeof(double) * 2 * dim; + size = offsetof(NDBOX, x[0]) +sizeof(double) * 2 * dim; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = dim; @@ -359,6 +359,7 @@ g_cube_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); NDBOX *query = PG_GETARG_NDBOX(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); bool res; @@ -652,8 +653,8 @@ g_cube_same(PG_FUNCTION_ARGS) ** SUPPORT ROUTINES */ bool -g_cube_leaf_consistent(NDBOX * key, - NDBOX * query, +g_cube_leaf_consistent(NDBOX *key, + NDBOX *query, StrategyNumber strategy) { bool retval; @@ -684,8 +685,8 @@ g_cube_leaf_consistent(NDBOX * key, } bool -g_cube_internal_consistent(NDBOX * key, - NDBOX * query, +g_cube_internal_consistent(NDBOX *key, + NDBOX *query, StrategyNumber strategy) { bool retval; @@ -714,7 +715,7 @@ g_cube_internal_consistent(NDBOX * key, } NDBOX * -g_cube_binary_union(NDBOX * r1, NDBOX * r2, int *sizep) +g_cube_binary_union(NDBOX *r1, NDBOX *r2, int *sizep) { NDBOX *retval; @@ -727,7 +728,7 @@ g_cube_binary_union(NDBOX * r1, NDBOX * r2, int *sizep) /* cube_union_v0 */ NDBOX * -cube_union_v0(NDBOX * a, NDBOX * b) +cube_union_v0(NDBOX *a, NDBOX *b) { int i; NDBOX *result; @@ -887,7 +888,7 @@ cube_size(PG_FUNCTION_ARGS) } void -rt_cube_size(NDBOX * a, double *size) +rt_cube_size(NDBOX *a, double *size) { int i, j; @@ -906,7 +907,7 @@ rt_cube_size(NDBOX * a, double *size) /* make up a metric in which one box will be 'lower' than the other -- this can be useful for sorting and to determine uniqueness */ int32 -cube_cmp_v0(NDBOX * a, NDBOX * b) +cube_cmp_v0(NDBOX *a, NDBOX *b) { int i; int dim; @@ -1093,7 +1094,7 @@ cube_ge(PG_FUNCTION_ARGS) /* Contains */ /* Box(A) CONTAINS Box(B) IFF pt(A) < pt(B) */ bool -cube_contains_v0(NDBOX * a, NDBOX * b) +cube_contains_v0(NDBOX *a, NDBOX *b) { int i; @@ -1163,7 +1164,7 @@ cube_contained(PG_FUNCTION_ARGS) /* Overlap */ /* Box(A) Overlap Box(B) IFF (pt(a)LL < pt(B)UR) && (pt(b)LL < pt(a)UR) */ bool -cube_overlap_v0(NDBOX * a, NDBOX * b) +cube_overlap_v0(NDBOX *a, NDBOX *b) { int i; @@ -1374,7 +1375,7 @@ cube_enlarge(PG_FUNCTION_ARGS) dim = n; if (a->dim > dim) dim = a->dim; - size = offsetof(NDBOX, x[0]) + sizeof(double) * dim * 2; + size = offsetof(NDBOX, x[0]) +sizeof(double) * dim * 2; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = dim; @@ -1415,7 +1416,7 @@ cube_f8(PG_FUNCTION_ARGS) NDBOX *result; int size; - size = offsetof(NDBOX, x[0]) + sizeof(double) * 2; + size = offsetof(NDBOX, x[0]) +sizeof(double) * 2; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = 1; @@ -1433,7 +1434,7 @@ cube_f8_f8(PG_FUNCTION_ARGS) NDBOX *result; int size; - size = offsetof(NDBOX, x[0]) + sizeof(double) * 2; + size = offsetof(NDBOX, x[0]) +sizeof(double) * 2; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = 1; @@ -1454,7 +1455,7 @@ cube_c_f8(PG_FUNCTION_ARGS) int size; int i; - size = offsetof(NDBOX, x[0]) + sizeof(double) * (c->dim + 1) *2; + size = offsetof(NDBOX, x[0]) +sizeof(double) * (c->dim + 1) *2; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = c->dim + 1; @@ -1481,7 +1482,7 @@ cube_c_f8_f8(PG_FUNCTION_ARGS) int size; int i; - size = offsetof(NDBOX, x[0]) + sizeof(double) * (c->dim + 1) *2; + size = offsetof(NDBOX, x[0]) +sizeof(double) * (c->dim + 1) *2; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = c->dim + 1; diff --git a/contrib/cube/cubedata.h b/contrib/cube/cubedata.h index b5ec0e70c6..1100602cfc 100644 --- a/contrib/cube/cubedata.h +++ b/contrib/cube/cubedata.h @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/contrib/cube/cubedata.h,v 1.9 2007/03/07 21:21:12 teodor Exp $ */ +/* $PostgreSQL: pgsql/contrib/cube/cubedata.h,v 1.10 2009/06/11 14:48:50 momjian Exp $ */ #define CUBE_MAX_DIM (100) @@ -7,7 +7,7 @@ typedef struct NDBOX int32 vl_len_; /* varlena header (do not touch directly!) */ unsigned int dim; double x[1]; -} NDBOX; +} NDBOX; #define DatumGetNDBOX(x) ((NDBOX*)DatumGetPointer(x)) #define PG_GETARG_NDBOX(x) DatumGetNDBOX( PG_DETOAST_DATUM(PG_GETARG_DATUM(x)) ) diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c index 9cd047b1ea..6f3cc71f16 100644 --- a/contrib/dblink/dblink.c +++ b/contrib/dblink/dblink.c @@ -8,7 +8,7 @@ * Darko Prenosil <Darko.Prenosil@finteh.hr> * Shridhar Daithankar <shridhar_daithankar@persistent.co.in> * - * $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.81 2009/06/09 17:41:02 tgl Exp $ + * $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.82 2009/06/11 14:48:50 momjian Exp $ * Copyright (c) 2001-2009, PostgreSQL Global Development Group * ALL RIGHTS RESERVED; * @@ -74,7 +74,7 @@ typedef struct remoteConn PGconn *conn; /* Hold the remote connection */ int openCursorCount; /* The number of open cursors */ bool newXactForCursor; /* Opened a transaction for a cursor */ -} remoteConn; +} remoteConn; /* * Internal declarations @@ -82,7 +82,7 @@ typedef struct remoteConn static Datum dblink_record_internal(FunctionCallInfo fcinfo, bool is_async); static remoteConn *getConnectionByName(const char *name); static HTAB *createConnHash(void); -static void createNewConnection(const char *name, remoteConn * rconn); +static void createNewConnection(const char *name, remoteConn *rconn); static void deleteConnection(const char *name); static char **get_pkey_attnames(Oid relid, int16 *numatts); static char **get_text_array_contents(ArrayType *array, int *numitems); @@ -116,7 +116,7 @@ typedef struct remoteConnHashEnt { char name[NAMEDATALEN]; remoteConn *rconn; -} remoteConnHashEnt; +} remoteConnHashEnt; /* initial number of connection hashes */ #define NUMCONN 16 @@ -576,9 +576,9 @@ dblink_fetch(PG_FUNCTION_ARGS) funcctx = SRF_FIRSTCALL_INIT(); /* - * Try to execute the query. Note that since libpq uses malloc, - * the PGresult will be long-lived even though we are still in - * a short-lived memory context. + * Try to execute the query. Note that since libpq uses malloc, the + * PGresult will be long-lived even though we are still in a + * short-lived memory context. */ res = PQexec(conn, buf.data); if (!res || @@ -629,8 +629,8 @@ dblink_fetch(PG_FUNCTION_ARGS) "the specified FROM clause rowtype"))); /* - * fast track when no results. We could exit earlier, but then - * we'd not report error if the result tuple type is wrong. + * fast track when no results. We could exit earlier, but then we'd + * not report error if the result tuple type is wrong. */ if (funcctx->max_calls < 1) { @@ -815,7 +815,7 @@ dblink_record_internal(FunctionCallInfo fcinfo, bool is_async) /* shouldn't happen */ elog(ERROR, "wrong number of arguments"); } - else /* is_async */ + else /* is_async */ { /* get async result */ if (PG_NARGS() == 2) @@ -837,106 +837,105 @@ dblink_record_internal(FunctionCallInfo fcinfo, bool is_async) if (!conn) DBLINK_CONN_NOT_AVAIL; - /* synchronous query, or async result retrieval */ - if (!is_async) - res = PQexec(conn, sql); - else - { - res = PQgetResult(conn); - /* NULL means we're all done with the async results */ - if (!res) - { - MemoryContextSwitchTo(oldcontext); - SRF_RETURN_DONE(funcctx); - } - } - - if (!res || - (PQresultStatus(res) != PGRES_COMMAND_OK && - PQresultStatus(res) != PGRES_TUPLES_OK)) + /* synchronous query, or async result retrieval */ + if (!is_async) + res = PQexec(conn, sql); + else + { + res = PQgetResult(conn); + /* NULL means we're all done with the async results */ + if (!res) { - dblink_res_error(conname, res, "could not execute query", fail); - if (freeconn) - PQfinish(conn); MemoryContextSwitchTo(oldcontext); SRF_RETURN_DONE(funcctx); } + } - if (PQresultStatus(res) == PGRES_COMMAND_OK) - { - is_sql_cmd = true; - - /* need a tuple descriptor representing one TEXT column */ - tupdesc = CreateTemplateTupleDesc(1, false); - TupleDescInitEntry(tupdesc, (AttrNumber) 1, "status", - TEXTOID, -1, 0); - - /* - * and save a copy of the command status string to return as - * our result tuple - */ - sql_cmd_status = PQcmdStatus(res); - funcctx->max_calls = 1; - } - else - funcctx->max_calls = PQntuples(res); - - /* got results, keep track of them */ - funcctx->user_fctx = res; - - /* if needed, close the connection to the database and cleanup */ + if (!res || + (PQresultStatus(res) != PGRES_COMMAND_OK && + PQresultStatus(res) != PGRES_TUPLES_OK)) + { + dblink_res_error(conname, res, "could not execute query", fail); if (freeconn) PQfinish(conn); + MemoryContextSwitchTo(oldcontext); + SRF_RETURN_DONE(funcctx); + } - if (!is_sql_cmd) - { - /* get a tuple descriptor for our result type */ - switch (get_call_result_type(fcinfo, NULL, &tupdesc)) - { - case TYPEFUNC_COMPOSITE: - /* success */ - break; - case TYPEFUNC_RECORD: - /* failed to determine actual type of RECORD */ - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("function returning record called in context " - "that cannot accept type record"))); - break; - default: - /* result type isn't composite */ - elog(ERROR, "return type must be a row type"); - break; - } + if (PQresultStatus(res) == PGRES_COMMAND_OK) + { + is_sql_cmd = true; - /* make sure we have a persistent copy of the tupdesc */ - tupdesc = CreateTupleDescCopy(tupdesc); - } + /* need a tuple descriptor representing one TEXT column */ + tupdesc = CreateTemplateTupleDesc(1, false); + TupleDescInitEntry(tupdesc, (AttrNumber) 1, "status", + TEXTOID, -1, 0); /* - * check result and tuple descriptor have the same number of - * columns + * and save a copy of the command status string to return as our + * result tuple */ - if (PQnfields(res) != tupdesc->natts) - ereport(ERROR, - (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("remote query result rowtype does not match " - "the specified FROM clause rowtype"))); + sql_cmd_status = PQcmdStatus(res); + funcctx->max_calls = 1; + } + else + funcctx->max_calls = PQntuples(res); - /* fast track when no results */ - if (funcctx->max_calls < 1) + /* got results, keep track of them */ + funcctx->user_fctx = res; + + /* if needed, close the connection to the database and cleanup */ + if (freeconn) + PQfinish(conn); + + if (!is_sql_cmd) + { + /* get a tuple descriptor for our result type */ + switch (get_call_result_type(fcinfo, NULL, &tupdesc)) { - if (res) - PQclear(res); - MemoryContextSwitchTo(oldcontext); - SRF_RETURN_DONE(funcctx); + case TYPEFUNC_COMPOSITE: + /* success */ + break; + case TYPEFUNC_RECORD: + /* failed to determine actual type of RECORD */ + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("function returning record called in context " + "that cannot accept type record"))); + break; + default: + /* result type isn't composite */ + elog(ERROR, "return type must be a row type"); + break; } - /* store needed metadata for subsequent calls */ - attinmeta = TupleDescGetAttInMetadata(tupdesc); - funcctx->attinmeta = attinmeta; + /* make sure we have a persistent copy of the tupdesc */ + tupdesc = CreateTupleDescCopy(tupdesc); + } + /* + * check result and tuple descriptor have the same number of columns + */ + if (PQnfields(res) != tupdesc->natts) + ereport(ERROR, + (errcode(ERRCODE_DATATYPE_MISMATCH), + errmsg("remote query result rowtype does not match " + "the specified FROM clause rowtype"))); + + /* fast track when no results */ + if (funcctx->max_calls < 1) + { + if (res) + PQclear(res); MemoryContextSwitchTo(oldcontext); + SRF_RETURN_DONE(funcctx); + } + + /* store needed metadata for subsequent calls */ + attinmeta = TupleDescGetAttInMetadata(tupdesc); + funcctx->attinmeta = attinmeta; + + MemoryContextSwitchTo(oldcontext); } @@ -2014,7 +2013,7 @@ quote_literal_cstr(char *rawstr) rawstr_text = cstring_to_text(rawstr); result_text = DatumGetTextP(DirectFunctionCall1(quote_literal, - PointerGetDatum(rawstr_text))); + PointerGetDatum(rawstr_text))); result = text_to_cstring(result_text); return result; @@ -2033,7 +2032,7 @@ quote_ident_cstr(char *rawstr) rawstr_text = cstring_to_text(rawstr); result_text = DatumGetTextP(DirectFunctionCall1(quote_ident, - PointerGetDatum(rawstr_text))); + PointerGetDatum(rawstr_text))); result = text_to_cstring(result_text); return result; @@ -2229,7 +2228,7 @@ createConnHash(void) } static void -createNewConnection(const char *name, remoteConn * rconn) +createNewConnection(const char *name, remoteConn *rconn) { remoteConnHashEnt *hentry; bool found; @@ -2296,7 +2295,7 @@ dblink_security_check(PGconn *conn, remoteConn *rconn) } /* - * For non-superusers, insist that the connstr specify a password. This + * For non-superusers, insist that the connstr specify a password. This * prevents a password from being picked up from .pgpass, a service file, * the environment, etc. We don't want the postgres user's passwords * to be accessible to non-superusers. @@ -2306,9 +2305,9 @@ dblink_connstr_check(const char *connstr) { if (!superuser()) { - PQconninfoOption *options; - PQconninfoOption *option; - bool connstr_gives_password = false; + PQconninfoOption *options; + PQconninfoOption *option; + bool connstr_gives_password = false; options = PQconninfoParse(connstr, NULL); if (options) @@ -2329,9 +2328,9 @@ dblink_connstr_check(const char *connstr) if (!connstr_gives_password) ereport(ERROR, - (errcode(ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED), - errmsg("password is required"), - errdetail("Non-superusers must provide a password in the connection string."))); + (errcode(ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED), + errmsg("password is required"), + errdetail("Non-superusers must provide a password in the connection string."))); } } @@ -2377,13 +2376,13 @@ dblink_res_error(const char *conname, PGresult *res, const char *dblink_context_ dblink_context_conname = conname; ereport(level, - (errcode(sqlstate), - message_primary ? errmsg("%s", message_primary) : errmsg("unknown error"), - message_detail ? errdetail("%s", message_detail) : 0, - message_hint ? errhint("%s", message_hint) : 0, - message_context ? errcontext("%s", message_context) : 0, - errcontext("Error occurred on dblink connection named \"%s\": %s.", - dblink_context_conname, dblink_context_msg))); + (errcode(sqlstate), + message_primary ? errmsg("%s", message_primary) : errmsg("unknown error"), + message_detail ? errdetail("%s", message_detail) : 0, + message_hint ? errhint("%s", message_hint) : 0, + message_context ? errcontext("%s", message_context) : 0, + errcontext("Error occurred on dblink connection named \"%s\": %s.", + dblink_context_conname, dblink_context_msg))); } /* @@ -2392,12 +2391,12 @@ dblink_res_error(const char *conname, PGresult *res, const char *dblink_context_ static char * get_connect_string(const char *servername) { - ForeignServer *foreign_server = NULL; - UserMapping *user_mapping; - ListCell *cell; - StringInfo buf = makeStringInfo(); + ForeignServer *foreign_server = NULL; + UserMapping *user_mapping; + ListCell *cell; + StringInfo buf = makeStringInfo(); ForeignDataWrapper *fdw; - AclResult aclresult; + AclResult aclresult; /* first gather the server connstr options */ if (strlen(servername) < NAMEDATALEN) @@ -2405,39 +2404,39 @@ get_connect_string(const char *servername) if (foreign_server) { - Oid serverid = foreign_server->serverid; - Oid fdwid = foreign_server->fdwid; - Oid userid = GetUserId(); + Oid serverid = foreign_server->serverid; + Oid fdwid = foreign_server->fdwid; + Oid userid = GetUserId(); user_mapping = GetUserMapping(userid, serverid); - fdw = GetForeignDataWrapper(fdwid); + fdw = GetForeignDataWrapper(fdwid); /* Check permissions, user must have usage on the server. */ aclresult = pg_foreign_server_aclcheck(serverid, userid, ACL_USAGE); if (aclresult != ACLCHECK_OK) aclcheck_error(aclresult, ACL_KIND_FOREIGN_SERVER, foreign_server->servername); - foreach (cell, fdw->options) + foreach(cell, fdw->options) { - DefElem *def = lfirst(cell); + DefElem *def = lfirst(cell); appendStringInfo(buf, "%s='%s' ", def->defname, escape_param_str(strVal(def->arg))); } - foreach (cell, foreign_server->options) + foreach(cell, foreign_server->options) { - DefElem *def = lfirst(cell); - + DefElem *def = lfirst(cell); + appendStringInfo(buf, "%s='%s' ", def->defname, escape_param_str(strVal(def->arg))); } - - foreach (cell, user_mapping->options) + + foreach(cell, user_mapping->options) { - - DefElem *def = lfirst(cell); - + + DefElem *def = lfirst(cell); + appendStringInfo(buf, "%s='%s' ", def->defname, escape_param_str(strVal(def->arg))); } @@ -2456,8 +2455,8 @@ get_connect_string(const char *servername) static char * escape_param_str(const char *str) { - const char *cp; - StringInfo buf = makeStringInfo(); + const char *cp; + StringInfo buf = makeStringInfo(); for (cp = str; *cp; cp++) { diff --git a/contrib/dict_int/dict_int.c b/contrib/dict_int/dict_int.c index 36562a2d7f..e555cdb893 100644 --- a/contrib/dict_int/dict_int.c +++ b/contrib/dict_int/dict_int.c @@ -6,7 +6,7 @@ * Copyright (c) 2007-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/contrib/dict_int/dict_int.c,v 1.4 2009/01/01 17:23:32 momjian Exp $ + * $PostgreSQL: pgsql/contrib/dict_int/dict_int.c,v 1.5 2009/06/11 14:48:50 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -23,7 +23,7 @@ typedef struct { int maxlen; bool rejectlong; -} DictInt; +} DictInt; PG_FUNCTION_INFO_V1(dintdict_init); diff --git a/contrib/earthdistance/earthdistance.c b/contrib/earthdistance/earthdistance.c index 6c191a5c38..4dce1f828e 100644 --- a/contrib/earthdistance/earthdistance.c +++ b/contrib/earthdistance/earthdistance.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/contrib/earthdistance/earthdistance.c,v 1.15 2008/04/21 01:11:43 tgl Exp $ */ +/* $PostgreSQL: pgsql/contrib/earthdistance/earthdistance.c,v 1.16 2009/06/11 14:48:51 momjian Exp $ */ #include "postgres.h" @@ -91,7 +91,7 @@ geo_distance_internal(Point *pt1, Point *pt2) * distance between the points in miles on earth's surface * * If float8 is passed-by-value, the oldstyle version-0 calling convention - * is unportable, so we use version-1. However, if it's passed-by-reference, + * is unportable, so we use version-1. However, if it's passed-by-reference, * continue to use oldstyle. This is just because we'd like earthdistance * to serve as a canary for any unintentional breakage of version-0 functions * with float8 results. @@ -100,6 +100,7 @@ geo_distance_internal(Point *pt1, Point *pt2) #ifdef USE_FLOAT8_BYVAL Datum geo_distance(PG_FUNCTION_ARGS); + PG_FUNCTION_INFO_V1(geo_distance); Datum @@ -112,8 +113,7 @@ geo_distance(PG_FUNCTION_ARGS) result = geo_distance_internal(pt1, pt2); PG_RETURN_FLOAT8(result); } - -#else /* !USE_FLOAT8_BYVAL */ +#else /* !USE_FLOAT8_BYVAL */ double *geo_distance(Point *pt1, Point *pt2); @@ -126,4 +126,4 @@ geo_distance(Point *pt1, Point *pt2) return resultp; } -#endif /* USE_FLOAT8_BYVAL */ +#endif /* USE_FLOAT8_BYVAL */ diff --git a/contrib/fuzzystrmatch/dmetaphone.c b/contrib/fuzzystrmatch/dmetaphone.c index 5bb07640bf..113acb566a 100644 --- a/contrib/fuzzystrmatch/dmetaphone.c +++ b/contrib/fuzzystrmatch/dmetaphone.c @@ -1,7 +1,7 @@ /* * This is a port of the Double Metaphone algorithm for use in PostgreSQL. * - * $PostgreSQL: pgsql/contrib/fuzzystrmatch/dmetaphone.c,v 1.12 2008/03/25 22:42:41 tgl Exp $ + * $PostgreSQL: pgsql/contrib/fuzzystrmatch/dmetaphone.c,v 1.13 2009/06/11 14:48:51 momjian Exp $ * * Double Metaphone computes 2 "sounds like" strings - a primary and an * alternate. In most cases they are the same, but for foreign names @@ -224,7 +224,7 @@ typedef struct int free_string_on_destroy; } - metastring; +metastring; /* * remaining perl module funcs unchanged except for declaring them static @@ -258,7 +258,7 @@ NewMetaString(char *init_str) static void -DestroyMetaString(metastring * s) +DestroyMetaString(metastring *s) { if (s == NULL) return; @@ -271,7 +271,7 @@ DestroyMetaString(metastring * s) static void -IncreaseBuffer(metastring * s, int chars_needed) +IncreaseBuffer(metastring *s, int chars_needed) { META_REALLOC(s->str, (s->bufsize + chars_needed + 10), char); assert(s->str != NULL); @@ -280,7 +280,7 @@ IncreaseBuffer(metastring * s, int chars_needed) static void -MakeUpper(metastring * s) +MakeUpper(metastring *s) { char *i; @@ -290,7 +290,7 @@ MakeUpper(metastring * s) static int -IsVowel(metastring * s, int pos) +IsVowel(metastring *s, int pos) { char c; @@ -307,7 +307,7 @@ IsVowel(metastring * s, int pos) static int -SlavoGermanic(metastring * s) +SlavoGermanic(metastring *s) { if ((char *) strstr(s->str, "W")) return 1; @@ -323,7 +323,7 @@ SlavoGermanic(metastring * s) static char -GetAt(metastring * s, int pos) +GetAt(metastring *s, int pos) { if ((pos < 0) || (pos >= s->length)) return '\0'; @@ -333,7 +333,7 @@ GetAt(metastring * s, int pos) static void -SetAt(metastring * s, int pos, char c) +SetAt(metastring *s, int pos, char c) { if ((pos < 0) || (pos >= s->length)) return; @@ -346,7 +346,7 @@ SetAt(metastring * s, int pos, char c) Caveats: the START value is 0 based */ static int -StringAt(metastring * s, int start, int length,...) +StringAt(metastring *s, int start, int length,...) { char *test; char *pos; @@ -373,7 +373,7 @@ StringAt(metastring * s, int start, int length,...) static void -MetaphAdd(metastring * s, char *new_str) +MetaphAdd(metastring *s, char *new_str) { int add_length; diff --git a/contrib/fuzzystrmatch/fuzzystrmatch.c b/contrib/fuzzystrmatch/fuzzystrmatch.c index 387f124942..b3def054a9 100644 --- a/contrib/fuzzystrmatch/fuzzystrmatch.c +++ b/contrib/fuzzystrmatch/fuzzystrmatch.c @@ -5,7 +5,7 @@ * * Joe Conway <mail@joeconway.com> * - * $PostgreSQL: pgsql/contrib/fuzzystrmatch/fuzzystrmatch.c,v 1.29 2009/04/07 15:53:54 tgl Exp $ + * $PostgreSQL: pgsql/contrib/fuzzystrmatch/fuzzystrmatch.c,v 1.30 2009/06/11 14:48:51 momjian Exp $ * Copyright (c) 2001-2009, PostgreSQL Global Development Group * ALL RIGHTS RESERVED; * @@ -90,8 +90,8 @@ soundex_code(char letter) */ #define MAX_LEVENSHTEIN_STRLEN 255 -static int levenshtein_internal(const char *s, const char *t, - int ins_c, int del_c, int sub_c); +static int levenshtein_internal(const char *s, const char *t, + int ins_c, int del_c, int sub_c); /* @@ -186,18 +186,20 @@ getcode(char c) /* * levenshtein_internal - Calculates Levenshtein distance metric - * between supplied strings. Generally - * (1, 1, 1) penalty costs suffices common - * cases, but your mileage may vary. + * between supplied strings. Generally + * (1, 1, 1) penalty costs suffices common + * cases, but your mileage may vary. */ static int levenshtein_internal(const char *s, const char *t, int ins_c, int del_c, int sub_c) { - int m, n; - int *prev; - int *curr; - int i, j; + int m, + n; + int *prev; + int *curr; + int i, + j; const char *x; const char *y; @@ -205,9 +207,8 @@ levenshtein_internal(const char *s, const char *t, n = strlen(t); /* - * If either m or n is 0, the answer is the other value. This makes - * sense since it would take that many insertions to build a matching - * string + * If either m or n is 0, the answer is the other value. This makes sense + * since it would take that many insertions to build a matching string */ if (!m) return n; @@ -230,10 +231,10 @@ levenshtein_internal(const char *s, const char *t, ++n; /* - * Instead of building an (m+1)x(n+1) array, we'll use two - * different arrays of size m+1 for storing accumulated values. - * At each step one represents the "previous" row and one is the - * "current" row of the notional large array. + * Instead of building an (m+1)x(n+1) array, we'll use two different + * arrays of size m+1 for storing accumulated values. At each step one + * represents the "previous" row and one is the "current" row of the + * notional large array. */ prev = (int *) palloc(2 * m * sizeof(int)); curr = prev + m; @@ -245,24 +246,24 @@ levenshtein_internal(const char *s, const char *t, /* Loop through rows of the notional array */ for (y = t, j = 1; j < n; y++, j++) { - int *temp; + int *temp; /* - * First cell must increment sequentially, as we're on the - * j'th row of the (m+1)x(n+1) array. + * First cell must increment sequentially, as we're on the j'th row of + * the (m+1)x(n+1) array. */ curr[0] = j; - + for (x = s, i = 1; i < m; x++, i++) { - int ins; - int del; - int sub; + int ins; + int del; + int sub; /* Calculate costs for probable operations. */ - ins = prev[i] + ins_c; /* Insertion */ - del = curr[i-1] + del_c; /* Deletion */ - sub = prev[i-1] + ((*x == *y) ? 0 : sub_c); /* Substitution */ + ins = prev[i] + ins_c; /* Insertion */ + del = curr[i - 1] + del_c; /* Deletion */ + sub = prev[i - 1] + ((*x == *y) ? 0 : sub_c); /* Substitution */ /* Take the one with minimum cost. */ curr[i] = Min(ins, del); @@ -276,10 +277,10 @@ levenshtein_internal(const char *s, const char *t, } /* - * Because the final value was swapped from the previous row to - * the current row, that's where we'll find it. + * Because the final value was swapped from the previous row to the + * current row, that's where we'll find it. */ - return prev[m-1]; + return prev[m - 1]; } @@ -287,11 +288,11 @@ PG_FUNCTION_INFO_V1(levenshtein_with_costs); Datum levenshtein_with_costs(PG_FUNCTION_ARGS) { - char *src = TextDatumGetCString(PG_GETARG_DATUM(0)); - char *dst = TextDatumGetCString(PG_GETARG_DATUM(1)); - int ins_c = PG_GETARG_INT32(2); - int del_c = PG_GETARG_INT32(3); - int sub_c = PG_GETARG_INT32(4); + char *src = TextDatumGetCString(PG_GETARG_DATUM(0)); + char *dst = TextDatumGetCString(PG_GETARG_DATUM(1)); + int ins_c = PG_GETARG_INT32(2); + int del_c = PG_GETARG_INT32(3); + int sub_c = PG_GETARG_INT32(4); PG_RETURN_INT32(levenshtein_internal(src, dst, ins_c, del_c, sub_c)); } @@ -301,8 +302,8 @@ PG_FUNCTION_INFO_V1(levenshtein); Datum levenshtein(PG_FUNCTION_ARGS) { - char *src = TextDatumGetCString(PG_GETARG_DATUM(0)); - char *dst = TextDatumGetCString(PG_GETARG_DATUM(1)); + char *src = TextDatumGetCString(PG_GETARG_DATUM(0)); + char *dst = TextDatumGetCString(PG_GETARG_DATUM(1)); PG_RETURN_INT32(levenshtein_internal(src, dst, 1, 1, 1)); } @@ -417,9 +418,9 @@ Lookahead(char *word, int how_far) static int -_metaphone(char *word, /* IN */ +_metaphone(char *word, /* IN */ int max_phonemes, - char **phoned_word) /* OUT */ + char **phoned_word) /* OUT */ { int w_idx = 0; /* point in the phonization we're at. */ int p_idx = 0; /* end of the phoned phrase */ diff --git a/contrib/hstore/crc32.c b/contrib/hstore/crc32.c index b1f80fde07..dc5765d056 100644 --- a/contrib/hstore/crc32.c +++ b/contrib/hstore/crc32.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/hstore/crc32.c,v 1.3 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/hstore/crc32.c,v 1.4 2009/06/11 14:48:51 momjian Exp $ * * Both POSIX and CRC32 checksums */ diff --git a/contrib/hstore/crc32.h b/contrib/hstore/crc32.h index d2d6c8bd9a..e008b1a664 100644 --- a/contrib/hstore/crc32.h +++ b/contrib/hstore/crc32.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/hstore/crc32.h,v 1.2 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/hstore/crc32.h,v 1.3 2009/06/11 14:48:51 momjian Exp $ */ #ifndef _CRC32_H #define _CRC32_H diff --git a/contrib/hstore/hstore.h b/contrib/hstore/hstore.h index 2a2c3bad58..e8ea58b567 100644 --- a/contrib/hstore/hstore.h +++ b/contrib/hstore/hstore.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/hstore/hstore.h,v 1.7 2009/03/15 22:05:17 tgl Exp $ + * $PostgreSQL: pgsql/contrib/hstore/hstore.h,v 1.8 2009/06/11 14:48:51 momjian Exp $ */ #ifndef __HSTORE_H__ #define __HSTORE_H__ @@ -14,7 +14,7 @@ typedef struct uint32 valisnull:1, pos:31; -} HEntry; +} HEntry; /* these are determined by the sizes of the keylen and vallen fields */ /* in struct HEntry and struct Pairs */ @@ -27,7 +27,7 @@ typedef struct int32 vl_len_; /* varlena header (do not touch directly!) */ int4 size; char data[1]; -} HStore; +} HStore; #define HSHRDSIZE (VARHDRSZ + sizeof(int4)) #define CALCDATASIZE(x, lenstr) ( (x) * sizeof(HEntry) + HSHRDSIZE + (lenstr) ) @@ -45,15 +45,15 @@ typedef struct uint16 vallen; bool isnull; bool needfree; -} Pairs; +} Pairs; int comparePairs(const void *a, const void *b); -int uniquePairs(Pairs * a, int4 l, int4 *buflen); +int uniquePairs(Pairs *a, int4 l, int4 *buflen); -size_t hstoreCheckKeyLen(size_t len); -size_t hstoreCheckValLen(size_t len); +size_t hstoreCheckKeyLen(size_t len); +size_t hstoreCheckValLen(size_t len); #define HStoreContainsStrategyNumber 7 #define HStoreExistsStrategyNumber 9 -#endif /* __HSTORE_H__ */ +#endif /* __HSTORE_H__ */ diff --git a/contrib/hstore/hstore_gin.c b/contrib/hstore/hstore_gin.c index 01d7258f8f..9c9a83d128 100644 --- a/contrib/hstore/hstore_gin.c +++ b/contrib/hstore/hstore_gin.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/hstore/hstore_gin.c,v 1.5 2009/03/25 22:19:01 tgl Exp $ + * $PostgreSQL: pgsql/contrib/hstore/hstore_gin.c,v 1.6 2009/06/11 14:48:51 momjian Exp $ */ #include "postgres.h" @@ -122,6 +122,7 @@ gin_consistent_hstore(PG_FUNCTION_ARGS) bool *check = (bool *) PG_GETARG_POINTER(0); StrategyNumber strategy = PG_GETARG_UINT16(1); HStore *query = PG_GETARG_HS(2); + /* int32 nkeys = PG_GETARG_INT32(3); */ /* Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); */ bool *recheck = (bool *) PG_GETARG_POINTER(5); @@ -132,8 +133,8 @@ gin_consistent_hstore(PG_FUNCTION_ARGS) int i; /* - * Index lost information about correspondence of keys - * and values, so we need recheck + * Index lost information about correspondence of keys and values, so + * we need recheck */ *recheck = true; for (i = 0; res && i < 2 * query->size; i++) diff --git a/contrib/hstore/hstore_gist.c b/contrib/hstore/hstore_gist.c index ecfed0f5da..0f6eac347c 100644 --- a/contrib/hstore/hstore_gist.c +++ b/contrib/hstore/hstore_gist.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/hstore/hstore_gist.c,v 1.9 2008/05/12 00:00:42 alvherre Exp $ + * $PostgreSQL: pgsql/contrib/hstore/hstore_gist.c,v 1.10 2009/06/11 14:48:51 momjian Exp $ */ #include "postgres.h" @@ -42,7 +42,7 @@ typedef struct int32 vl_len_; /* varlena header (do not touch directly!) */ int4 flag; char data[1]; -} GISTTYPE; +} GISTTYPE; #define ALLISTRUE 0x04 @@ -255,7 +255,7 @@ hemdistsign(BITVECP a, BITVECP b) } static int -hemdist(GISTTYPE * a, GISTTYPE * b) +hemdist(GISTTYPE *a, GISTTYPE *b) { if (ISALLTRUE(a)) { @@ -271,7 +271,7 @@ hemdist(GISTTYPE * a, GISTTYPE * b) } static int4 -unionkey(BITVECP sbase, GISTTYPE * add) +unionkey(BITVECP sbase, GISTTYPE *add) { int4 i; BITVECP sadd = GETSIGN(add); @@ -514,6 +514,7 @@ ghstore_consistent(PG_FUNCTION_ARGS) { GISTTYPE *entry = (GISTTYPE *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(0))->key); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); bool res = true; diff --git a/contrib/hstore/hstore_io.c b/contrib/hstore/hstore_io.c index 140336a2e6..3b19702520 100644 --- a/contrib/hstore/hstore_io.c +++ b/contrib/hstore/hstore_io.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/hstore/hstore_io.c,v 1.10 2009/04/02 17:57:05 teodor Exp $ + * $PostgreSQL: pgsql/contrib/hstore/hstore_io.c,v 1.11 2009/06/11 14:48:51 momjian Exp $ */ #include "postgres.h" @@ -20,7 +20,7 @@ typedef struct Pairs *pairs; int pcur; int plen; -} HSParser; +} HSParser; #define RESIZEPRSBUF \ do { \ @@ -41,7 +41,7 @@ do { \ #define GV_WAITESCESCIN 4 static bool -get_val(HSParser * state, bool ignoreeq, bool *escaped) +get_val(HSParser *state, bool ignoreeq, bool *escaped) { int st = GV_WAITVAL; @@ -165,7 +165,7 @@ get_val(HSParser * state, bool ignoreeq, bool *escaped) static void -parse_hstore(HSParser * state) +parse_hstore(HSParser *state) { int st = WKEY; bool escaped = false; @@ -287,7 +287,7 @@ comparePairs(const void *a, const void *b) } int -uniquePairs(Pairs * a, int4 l, int4 *buflen) +uniquePairs(Pairs *a, int4 l, int4 *buflen) { Pairs *ptr, *res; @@ -328,7 +328,7 @@ uniquePairs(Pairs * a, int4 l, int4 *buflen) } static void -freeHSParse(HSParser * state) +freeHSParse(HSParser *state) { int i; @@ -447,7 +447,7 @@ hstore_out(PG_FUNCTION_ARGS) HStore *in = PG_GETARG_HS(0); int buflen, i, - nnulls=0; + nnulls = 0; char *out, *ptr; char *base = STRPTR(in); @@ -465,11 +465,11 @@ hstore_out(PG_FUNCTION_ARGS) if (entries[i].valisnull) nnulls++; - buflen = (4 /* " */ + 2 /* => */ ) * ( in->size - nnulls ) + - ( 2 /* " */ + 2 /* => */ + 4 /* NULL */ ) * nnulls + - 2 /* , */ * ( in->size - 1 ) + - 2 /* esc */ * (VARSIZE(in) - CALCDATASIZE(in->size, 0)) + - 1 /* \0 */; + buflen = (4 /* " */ + 2 /* => */ ) * (in->size - nnulls) + + (2 /* " */ + 2 /* => */ + 4 /* NULL */ ) * nnulls + + 2 /* , */ * (in->size - 1) + + 2 /* esc */ * (VARSIZE(in) - CALCDATASIZE(in->size, 0)) + + 1 /* \0 */ ; out = ptr = palloc(buflen); for (i = 0; i < in->size; i++) diff --git a/contrib/hstore/hstore_op.c b/contrib/hstore/hstore_op.c index dfd762b029..8d471e30f1 100644 --- a/contrib/hstore/hstore_op.c +++ b/contrib/hstore/hstore_op.c @@ -12,7 +12,7 @@ static HEntry * -findkey(HStore * hs, char *key, int keylen) +findkey(HStore *hs, char *key, int keylen) { HEntry *StopLow = ARRPTR(hs); HEntry *StopHigh = StopLow + hs->size; @@ -407,10 +407,10 @@ typedef struct { HStore *hs; int i; -} AKStore; +} AKStore; static void -setup_firstcall(FuncCallContext *funcctx, HStore * hs) +setup_firstcall(FuncCallContext *funcctx, HStore *hs) { MemoryContext oldcontext; AKStore *st; diff --git a/contrib/intarray/_int.h b/contrib/intarray/_int.h index debc324933..35dbb54796 100644 --- a/contrib/intarray/_int.h +++ b/contrib/intarray/_int.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/intarray/_int.h,v 1.16 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/intarray/_int.h,v 1.17 2009/06/11 14:48:51 momjian Exp $ */ #ifndef ___INT_H__ #define ___INT_H__ @@ -78,7 +78,7 @@ typedef struct int32 vl_len_; /* varlena header (do not touch directly!) */ int4 flag; char data[1]; -} GISTTYPE; +} GISTTYPE; #define ALLISTRUE 0x04 @@ -131,14 +131,14 @@ typedef struct ITEM int2 type; int2 left; int4 val; -} ITEM; +} ITEM; typedef struct { int32 vl_len_; /* varlena header (do not touch directly!) */ int4 size; char data[1]; -} QUERYTYPE; +} QUERYTYPE; #define HDRSIZEQT (VARHDRSZ + sizeof(int4)) #define COMPUTESIZE(size) ( HDRSIZEQT + size * sizeof(ITEM) ) @@ -151,10 +151,10 @@ typedef struct #define OPEN 4 #define CLOSE 5 -bool signconsistent(QUERYTYPE * query, BITVEC sign, bool calcnot); -bool execconsistent(QUERYTYPE * query, ArrayType *array, bool calcnot); -bool ginconsistent(QUERYTYPE * query, bool *check); -int4 shorterquery(ITEM * q, int4 len); +bool signconsistent(QUERYTYPE *query, BITVEC sign, bool calcnot); +bool execconsistent(QUERYTYPE *query, ArrayType *array, bool calcnot); +bool ginconsistent(QUERYTYPE *query, bool *check); +int4 shorterquery(ITEM *q, int4 len); int compASC(const void *a, const void *b); @@ -165,4 +165,4 @@ if (ARRNELEMS(a) > 1) \ qsort((void*)ARRPTR(a), ARRNELEMS(a),sizeof(int4), \ (direction) ? compASC : compDESC ) -#endif /* ___INT_H__ */ +#endif /* ___INT_H__ */ diff --git a/contrib/intarray/_int_bool.c b/contrib/intarray/_int_bool.c index 2cba9b66c1..438db2ca95 100644 --- a/contrib/intarray/_int_bool.c +++ b/contrib/intarray/_int_bool.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/intarray/_int_bool.c,v 1.15 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/intarray/_int_bool.c,v 1.16 2009/06/11 14:48:51 momjian Exp $ */ #include "postgres.h" @@ -54,13 +54,13 @@ typedef struct NODE *str; /* number in str */ int4 num; -} WORKSTATE; +} WORKSTATE; /* * get token from query string */ static int4 -gettoken(WORKSTATE * state, int4 *val) +gettoken(WORKSTATE *state, int4 *val) { char nnn[16], *curnnn; @@ -143,7 +143,7 @@ gettoken(WORKSTATE * state, int4 *val) * push new one in polish notation reverse view */ static void -pushquery(WORKSTATE * state, int4 type, int4 val) +pushquery(WORKSTATE *state, int4 type, int4 val) { NODE *tmp = (NODE *) palloc(sizeof(NODE)); @@ -160,7 +160,7 @@ pushquery(WORKSTATE * state, int4 type, int4 val) * make polish notation of query */ static int4 -makepol(WORKSTATE * state) +makepol(WORKSTATE *state) { int4 val, type; @@ -239,7 +239,7 @@ typedef struct * is there value 'val' in array or not ? */ static bool -checkcondition_arr(void *checkval, ITEM * item) +checkcondition_arr(void *checkval, ITEM *item) { int4 *StopLow = ((CHKVAL *) checkval)->arrb; int4 *StopHigh = ((CHKVAL *) checkval)->arre; @@ -261,7 +261,7 @@ checkcondition_arr(void *checkval, ITEM * item) } static bool -checkcondition_bit(void *checkval, ITEM * item) +checkcondition_bit(void *checkval, ITEM *item) { return GETBIT(checkval, HASHVAL(item->val)); } @@ -270,7 +270,7 @@ checkcondition_bit(void *checkval, ITEM * item) * check for boolean condition */ static bool -execute(ITEM * curitem, void *checkval, bool calcnot, bool (*chkcond) (void *checkval, ITEM * item)) +execute(ITEM *curitem, void *checkval, bool calcnot, bool (*chkcond) (void *checkval, ITEM *item)) { if (curitem->type == VAL) @@ -302,7 +302,7 @@ execute(ITEM * curitem, void *checkval, bool calcnot, bool (*chkcond) (void *che * signconsistent & execconsistent called by *_consistent */ bool -signconsistent(QUERYTYPE * query, BITVEC sign, bool calcnot) +signconsistent(QUERYTYPE *query, BITVEC sign, bool calcnot) { return execute( GETQUERY(query) + query->size - 1, @@ -312,7 +312,7 @@ signconsistent(QUERYTYPE * query, BITVEC sign, bool calcnot) } bool -execconsistent(QUERYTYPE * query, ArrayType *array, bool calcnot) +execconsistent(QUERYTYPE *query, ArrayType *array, bool calcnot) { CHKVAL chkval; @@ -333,7 +333,7 @@ typedef struct } GinChkVal; static bool -checkcondition_gin(void *checkval, ITEM * item) +checkcondition_gin(void *checkval, ITEM *item) { GinChkVal *gcv = (GinChkVal *) checkval; @@ -341,7 +341,7 @@ checkcondition_gin(void *checkval, ITEM * item) } bool -ginconsistent(QUERYTYPE * query, bool *check) +ginconsistent(QUERYTYPE *query, bool *check) { GinChkVal gcv; ITEM *items = GETQUERY(query); @@ -408,7 +408,7 @@ boolop(PG_FUNCTION_ARGS) } static void -findoprnd(ITEM * ptr, int4 *pos) +findoprnd(ITEM *ptr, int4 *pos) { #ifdef BS_DEBUG elog(DEBUG3, (ptr[*pos].type == OPR) ? @@ -618,7 +618,7 @@ bqarr_out(PG_FUNCTION_ARGS) } static int4 -countdroptree(ITEM * q, int4 pos) +countdroptree(ITEM *q, int4 pos) { if (q[pos].type == VAL) return 1; @@ -634,7 +634,7 @@ countdroptree(ITEM * q, int4 pos) * we can modify query tree for clearing */ int4 -shorterquery(ITEM * q, int4 len) +shorterquery(ITEM *q, int4 len) { int4 index, posnot, diff --git a/contrib/intarray/_int_gin.c b/contrib/intarray/_int_gin.c index 598cdeca57..2bf8fc54bb 100644 --- a/contrib/intarray/_int_gin.c +++ b/contrib/intarray/_int_gin.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/intarray/_int_gin.c,v 1.9 2009/03/25 22:19:01 tgl Exp $ + * $PostgreSQL: pgsql/contrib/intarray/_int_gin.c,v 1.10 2009/06/11 14:48:51 momjian Exp $ */ #include "postgres.h" @@ -90,6 +90,7 @@ ginint4_consistent(PG_FUNCTION_ARGS) { bool *check = (bool *) PG_GETARG_POINTER(0); StrategyNumber strategy = PG_GETARG_UINT16(1); + /* int32 nkeys = PG_GETARG_INT32(3); */ /* Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); */ bool *recheck = (bool *) PG_GETARG_POINTER(5); diff --git a/contrib/intarray/_int_gist.c b/contrib/intarray/_int_gist.c index 13fee25ec7..29e08eda66 100644 --- a/contrib/intarray/_int_gist.c +++ b/contrib/intarray/_int_gist.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/intarray/_int_gist.c,v 1.22 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/intarray/_int_gist.c,v 1.23 2009/06/11 14:48:51 momjian Exp $ */ #include "postgres.h" @@ -42,6 +42,7 @@ g_int_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); ArrayType *query = (ArrayType *) PG_DETOAST_DATUM_COPY(PG_GETARG_POINTER(1)); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); bool retval; diff --git a/contrib/intarray/_int_op.c b/contrib/intarray/_int_op.c index b29a405e35..54858322a2 100644 --- a/contrib/intarray/_int_op.c +++ b/contrib/intarray/_int_op.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/intarray/_int_op.c,v 1.8 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/intarray/_int_op.c,v 1.9 2009/06/11 14:48:51 momjian Exp $ */ #include "postgres.h" diff --git a/contrib/intarray/_int_tool.c b/contrib/intarray/_int_tool.c index 7f7e4d43a9..8c0ec29c31 100644 --- a/contrib/intarray/_int_tool.c +++ b/contrib/intarray/_int_tool.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/intarray/_int_tool.c,v 1.11 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/intarray/_int_tool.c,v 1.12 2009/06/11 14:48:51 momjian Exp $ */ #include "postgres.h" diff --git a/contrib/intarray/_intbig_gist.c b/contrib/intarray/_intbig_gist.c index d1e3f19037..f9c5986db2 100644 --- a/contrib/intarray/_intbig_gist.c +++ b/contrib/intarray/_intbig_gist.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/intarray/_intbig_gist.c,v 1.19 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/intarray/_intbig_gist.c,v 1.20 2009/06/11 14:48:51 momjian Exp $ */ #include "postgres.h" @@ -78,7 +78,7 @@ _intbig_out(PG_FUNCTION_ARGS) ** intbig functions *********************************************************************/ static bool -_intbig_overlap(GISTTYPE * a, ArrayType *b) +_intbig_overlap(GISTTYPE *a, ArrayType *b) { int num = ARRNELEMS(b); int4 *ptr = ARRPTR(b); @@ -96,7 +96,7 @@ _intbig_overlap(GISTTYPE * a, ArrayType *b) } static bool -_intbig_contains(GISTTYPE * a, ArrayType *b) +_intbig_contains(GISTTYPE *a, ArrayType *b) { int num = ARRNELEMS(b); int4 *ptr = ARRPTR(b); @@ -243,7 +243,7 @@ hemdistsign(BITVECP a, BITVECP b) } static int -hemdist(GISTTYPE * a, GISTTYPE * b) +hemdist(GISTTYPE *a, GISTTYPE *b) { if (ISALLTRUE(a)) { @@ -265,7 +265,7 @@ g_intbig_decompress(PG_FUNCTION_ARGS) } static int4 -unionkey(BITVECP sbase, GISTTYPE * add) +unionkey(BITVECP sbase, GISTTYPE *add) { int4 i; BITVECP sadd = GETSIGN(add); @@ -506,6 +506,7 @@ g_intbig_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); ArrayType *query = (ArrayType *) PG_DETOAST_DATUM(PG_GETARG_POINTER(1)); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); bool retval; diff --git a/contrib/isn/isn.c b/contrib/isn/isn.c index 4991616915..449f70b811 100644 --- a/contrib/isn/isn.c +++ b/contrib/isn/isn.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/contrib/isn/isn.c,v 1.10 2009/01/01 17:23:32 momjian Exp $ + * $PostgreSQL: pgsql/contrib/isn/isn.c,v 1.11 2009/06/11 14:48:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -33,7 +33,7 @@ enum isn_type INVALID, ANY, EAN13, ISBN, ISMN, ISSN, UPC }; -static const char * const isn_names[] = {"EAN13/UPC/ISxN", "EAN13/UPC/ISxN", "EAN13", "ISBN", "ISMN", "ISSN", "UPC"}; +static const char *const isn_names[] = {"EAN13/UPC/ISxN", "EAN13/UPC/ISxN", "EAN13", "ISBN", "ISMN", "ISSN", "UPC"}; static bool g_weak = false; static bool g_initialized = false; @@ -336,7 +336,7 @@ checkdig(char *num, unsigned size) * If errorOK is true, just return "false" for bad input. */ static bool -ean2isn(ean13 ean, bool errorOK, ean13 * result, enum isn_type accept) +ean2isn(ean13 ean, bool errorOK, ean13 *result, enum isn_type accept) { enum isn_type type = INVALID; @@ -668,7 +668,7 @@ eantoobig: * (even if the check digit is valid) */ static bool -string2ean(const char *str, bool errorOK, ean13 * result, +string2ean(const char *str, bool errorOK, ean13 *result, enum isn_type accept) { bool digit, diff --git a/contrib/ltree/_ltree_gist.c b/contrib/ltree/_ltree_gist.c index 3d9145cf6b..15c4cc022d 100644 --- a/contrib/ltree/_ltree_gist.c +++ b/contrib/ltree/_ltree_gist.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/ltree/_ltree_gist.c,v 1.25 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/ltree/_ltree_gist.c,v 1.26 2009/06/11 14:48:51 momjian Exp $ * * * GiST support for ltree[] @@ -59,7 +59,7 @@ static const uint8 number_of_ones[256] = { static void -hashing(BITVECP sign, ltree * t) +hashing(BITVECP sign, ltree *t) { int tlen = t->numlevel; ltree_level *cur = LTREE_FIRST(t); @@ -173,7 +173,7 @@ _ltree_same(PG_FUNCTION_ARGS) } static int4 -unionkey(BITVECP sbase, ltree_gist * add) +unionkey(BITVECP sbase, ltree_gist *add) { int4 i; BITVECP sadd = LTG_SIGN(add); @@ -245,7 +245,7 @@ hemdistsign(BITVECP a, BITVECP b) } static int -hemdist(ltree_gist * a, ltree_gist * b) +hemdist(ltree_gist *a, ltree_gist *b) { if (LTG_ISALLTRUE(a)) { @@ -448,7 +448,7 @@ _ltree_picksplit(PG_FUNCTION_ARGS) } static bool -gist_te(ltree_gist * key, ltree * query) +gist_te(ltree_gist *key, ltree *query) { ltree_level *curq = LTREE_FIRST(query); BITVECP sign = LTG_SIGN(key); @@ -471,13 +471,13 @@ gist_te(ltree_gist * key, ltree * query) } static bool -checkcondition_bit(void *checkval, ITEM * val) +checkcondition_bit(void *checkval, ITEM *val) { return (FLG_CANLOOKSIGN(val->flag)) ? GETBIT(checkval, AHASHVAL(val->val)) : true; } static bool -gist_qtxt(ltree_gist * key, ltxtquery * query) +gist_qtxt(ltree_gist *key, ltxtquery *query) { if (LTG_ISALLTRUE(key)) return true; @@ -490,7 +490,7 @@ gist_qtxt(ltree_gist * key, ltxtquery * query) } static bool -gist_qe(ltree_gist * key, lquery * query) +gist_qe(ltree_gist *key, lquery *query) { lquery_level *curq = LQUERY_FIRST(query); BITVECP sign = LTG_SIGN(key); @@ -529,7 +529,7 @@ gist_qe(ltree_gist * key, lquery * query) } static bool -_arrq_cons(ltree_gist * key, ArrayType *_query) +_arrq_cons(ltree_gist *key, ArrayType *_query) { lquery *query = (lquery *) ARR_DATA_PTR(_query); int num = ArrayGetNItems(ARR_NDIM(_query), ARR_DIMS(_query)); @@ -559,6 +559,7 @@ _ltree_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); char *query = (char *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(1))); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); ltree_gist *key = (ltree_gist *) DatumGetPointer(entry->key); diff --git a/contrib/ltree/_ltree_op.c b/contrib/ltree/_ltree_op.c index c0d0a95001..f9e90e978d 100644 --- a/contrib/ltree/_ltree_op.c +++ b/contrib/ltree/_ltree_op.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/ltree/_ltree_op.c,v 1.12 2008/05/17 01:28:19 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/ltree/_ltree_op.c,v 1.13 2009/06/11 14:48:51 momjian Exp $ * * * op function for ltree[] @@ -43,7 +43,7 @@ typedef Datum (*PGCALL2) (PG_FUNCTION_ARGS); #define NEXTVAL(x) ( (ltree*)( (char*)(x) + INTALIGN( VARSIZE(x) ) ) ) static bool -array_iterator(ArrayType *la, PGCALL2 callback, void *param, ltree ** found) +array_iterator(ArrayType *la, PGCALL2 callback, void *param, ltree **found) { int num = ArrayGetNItems(ARR_NDIM(la), ARR_DIMS(la)); ltree *item = (ltree *) ARR_DATA_PTR(la); diff --git a/contrib/ltree/lquery_op.c b/contrib/ltree/lquery_op.c index 9dc7105574..df4f0794f2 100644 --- a/contrib/ltree/lquery_op.c +++ b/contrib/ltree/lquery_op.c @@ -1,7 +1,7 @@ /* * op function for ltree and lquery * Teodor Sigaev <teodor@stack.net> - * $PostgreSQL: pgsql/contrib/ltree/lquery_op.c,v 1.13 2008/06/30 18:30:48 teodor Exp $ + * $PostgreSQL: pgsql/contrib/ltree/lquery_op.c,v 1.14 2009/06/11 14:48:51 momjian Exp $ */ #include "postgres.h" @@ -27,22 +27,22 @@ typedef struct int nt; int posq; int post; -} FieldNot; +} FieldNot; static char * getlexeme(char *start, char *end, int *len) { char *ptr; - int charlen; - - while (start < end && (charlen = pg_mblen(start)) == 1 && t_iseq(start,'_') ) + int charlen; + + while (start < end && (charlen = pg_mblen(start)) == 1 && t_iseq(start, '_')) start += charlen; ptr = start; if (ptr >= end) return NULL; - while (ptr < end && !( (charlen = pg_mblen(ptr)) == 1 && t_iseq(ptr, '_') ) ) + while (ptr < end && !((charlen = pg_mblen(ptr)) == 1 && t_iseq(ptr, '_'))) ptr += charlen; *len = ptr - start; @@ -50,7 +50,7 @@ getlexeme(char *start, char *end, int *len) } bool -compare_subnode(ltree_level * t, char *qn, int len, int (*cmpptr) (const char *, const char *, size_t), bool anyend) + compare_subnode(ltree_level *t, char *qn, int len, int (*cmpptr) (const char *, const char *, size_t), bool anyend) { char *endt = t->name + t->len; char *endq = qn + len; @@ -90,11 +90,11 @@ compare_subnode(ltree_level * t, char *qn, int len, int (*cmpptr) (const char *, int ltree_strncasecmp(const char *a, const char *b, size_t s) { - char *al = str_tolower(a, s); - char *bl = str_tolower(b, s); - int res; - - res = strncmp(al, bl,s); + char *al = str_tolower(a, s); + char *bl = str_tolower(b, s); + int res; + + res = strncmp(al, bl, s); pfree(al); pfree(bl); @@ -103,7 +103,7 @@ ltree_strncasecmp(const char *a, const char *b, size_t s) } static bool -checkLevel(lquery_level * curq, ltree_level * curt) +checkLevel(lquery_level *curq, ltree_level *curt) { int (*cmpptr) (const char *, const char *, size_t); lquery_variant *curvar = LQL_FIRST(curq); @@ -154,7 +154,7 @@ static struct }; static bool -checkCond(lquery_level * curq, int query_numlevel, ltree_level * curt, int tree_numlevel, FieldNot * ptr) +checkCond(lquery_level *curq, int query_numlevel, ltree_level *curt, int tree_numlevel, FieldNot *ptr) { uint32 low_pos = 0, high_pos = 0, diff --git a/contrib/ltree/ltree.h b/contrib/ltree/ltree.h index 9cdfedab04..f16c6f9a32 100644 --- a/contrib/ltree/ltree.h +++ b/contrib/ltree/ltree.h @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/contrib/ltree/ltree.h,v 1.21 2008/06/30 18:30:48 teodor Exp $ */ +/* $PostgreSQL: pgsql/contrib/ltree/ltree.h,v 1.22 2009/06/11 14:48:51 momjian Exp $ */ #ifndef __LTREE_H__ #define __LTREE_H__ @@ -11,7 +11,7 @@ typedef struct { uint16 len; char name[1]; -} ltree_level; +} ltree_level; #define LEVEL_HDRSIZE (offsetof(ltree_level,name)) #define LEVEL_NEXT(x) ( (ltree_level*)( ((char*)(x)) + MAXALIGN(((ltree_level*)(x))->len + LEVEL_HDRSIZE) ) ) @@ -21,7 +21,7 @@ typedef struct int32 vl_len_; /* varlena header (do not touch directly!) */ uint16 numlevel; char data[1]; -} ltree; +} ltree; #define LTREE_HDRSIZE MAXALIGN( offsetof(ltree, data) ) #define LTREE_FIRST(x) ( (ltree_level*)( ((char*)(x))+LTREE_HDRSIZE ) ) @@ -35,7 +35,7 @@ typedef struct uint16 len; uint8 flag; char name[1]; -} lquery_variant; +} lquery_variant; #define LVAR_HDRSIZE MAXALIGN(offsetof(lquery_variant, name)) #define LVAR_NEXT(x) ( (lquery_variant*)( ((char*)(x)) + MAXALIGN(((lquery_variant*)(x))->len) + LVAR_HDRSIZE ) ) @@ -52,7 +52,7 @@ typedef struct uint16 low; uint16 high; char variants[1]; -} lquery_level; +} lquery_level; #define LQL_HDRSIZE MAXALIGN( offsetof(lquery_level,variants) ) #define LQL_NEXT(x) ( (lquery_level*)( ((char*)(x)) + MAXALIGN(((lquery_level*)(x))->totallen) ) ) @@ -73,14 +73,14 @@ typedef struct uint16 firstgood; uint16 flag; char data[1]; -} lquery; +} lquery; #define LQUERY_HDRSIZE MAXALIGN( offsetof(lquery, data) ) #define LQUERY_FIRST(x) ( (lquery_level*)( ((char*)(x))+LQUERY_HDRSIZE ) ) #define LQUERY_HASNOT 0x01 -#define ISALNUM(x) ( t_isalpha(x) || t_isdigit(x) || ( pg_mblen(x) == 1 && t_iseq((x), '_') ) ) +#define ISALNUM(x) ( t_isalpha(x) || t_isdigit(x) || ( pg_mblen(x) == 1 && t_iseq((x), '_') ) ) /* full text query */ @@ -97,7 +97,7 @@ typedef struct ITEM /* user-friendly value */ uint8 length; uint16 distance; -} ITEM; +} ITEM; /* *Storage: @@ -108,7 +108,7 @@ typedef struct int32 vl_len_; /* varlena header (do not touch directly!) */ int4 size; char data[1]; -} ltxtquery; +} ltxtquery; #define HDRSIZEQT MAXALIGN(VARHDRSZ + sizeof(int4)) #define COMPUTESIZE(size,lenofoperand) ( HDRSIZEQT + (size) * sizeof(ITEM) + (lenofoperand) ) @@ -153,15 +153,15 @@ Datum ltree_textadd(PG_FUNCTION_ARGS); /* Util function */ Datum ltree_in(PG_FUNCTION_ARGS); -bool ltree_execute(ITEM * curitem, void *checkval, - bool calcnot, bool (*chkcond) (void *checkval, ITEM * val)); +bool ltree_execute(ITEM *curitem, void *checkval, + bool calcnot, bool (*chkcond) (void *checkval, ITEM *val)); -int ltree_compare(const ltree * a, const ltree * b); -bool inner_isparent(const ltree * c, const ltree * p); -bool compare_subnode(ltree_level * t, char *q, int len, - int (*cmpptr) (const char *, const char *, size_t), bool anyend); -ltree *lca_inner(ltree ** a, int len); -int ltree_strncasecmp(const char *a, const char *b, size_t s); +int ltree_compare(const ltree *a, const ltree *b); +bool inner_isparent(const ltree *c, const ltree *p); +bool compare_subnode(ltree_level *t, char *q, int len, + int (*cmpptr) (const char *, const char *, size_t), bool anyend); +ltree *lca_inner(ltree **a, int len); +int ltree_strncasecmp(const char *a, const char *b, size_t s); #define PG_GETARG_LTREE(x) ((ltree*)DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(x)))) #define PG_GETARG_LTREE_COPY(x) ((ltree*)DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(x)))) @@ -207,7 +207,7 @@ typedef struct int32 vl_len_; /* varlena header (do not touch directly!) */ uint32 flag; char data[1]; -} ltree_gist; +} ltree_gist; #define LTG_ONENODE 0x01 #define LTG_ALLTRUE 0x02 diff --git a/contrib/ltree/ltree_gist.c b/contrib/ltree/ltree_gist.c index d7c9403dc7..d48ca8e1d4 100644 --- a/contrib/ltree/ltree_gist.c +++ b/contrib/ltree/ltree_gist.c @@ -1,7 +1,7 @@ /* * GiST support for ltree * Teodor Sigaev <teodor@stack.net> - * $PostgreSQL: pgsql/contrib/ltree/ltree_gist.c,v 1.24 2008/05/12 00:00:42 alvherre Exp $ + * $PostgreSQL: pgsql/contrib/ltree/ltree_gist.c,v 1.25 2009/06/11 14:48:51 momjian Exp $ */ #include "postgres.h" @@ -150,7 +150,7 @@ ltree_same(PG_FUNCTION_ARGS) } static void -hashing(BITVECP sign, ltree * t) +hashing(BITVECP sign, ltree *t) { int tlen = t->numlevel; ltree_level *cur = LTREE_FIRST(t); @@ -271,7 +271,7 @@ typedef struct rix { int index; ltree *r; -} RIX; +} RIX; static int treekey_cmp(const void *a, const void *b) @@ -441,7 +441,7 @@ ltree_picksplit(PG_FUNCTION_ARGS) } static bool -gist_isparent(ltree_gist * key, ltree * query) +gist_isparent(ltree_gist *key, ltree *query) { int4 numlevel = query->numlevel; int i; @@ -461,7 +461,7 @@ gist_isparent(ltree_gist * key, ltree * query) } static ltree * -copy_ltree(ltree * src) +copy_ltree(ltree *src) { ltree *dst = (ltree *) palloc(VARSIZE(src)); @@ -470,7 +470,7 @@ copy_ltree(ltree * src) } static bool -gist_ischild(ltree_gist * key, ltree * query) +gist_ischild(ltree_gist *key, ltree *query) { ltree *left = copy_ltree(LTG_GETLNODE(key)); ltree *right = copy_ltree(LTG_GETRNODE(key)); @@ -495,7 +495,7 @@ gist_ischild(ltree_gist * key, ltree * query) } static bool -gist_qe(ltree_gist * key, lquery * query) +gist_qe(ltree_gist *key, lquery *query) { lquery_level *curq = LQUERY_FIRST(query); BITVECP sign = LTG_SIGN(key); @@ -534,7 +534,7 @@ gist_qe(ltree_gist * key, lquery * query) } static int -gist_tqcmp(ltree * t, lquery * q) +gist_tqcmp(ltree *t, lquery *q) { ltree_level *al = LTREE_FIRST(t); lquery_level *ql = LQUERY_FIRST(q); @@ -563,7 +563,7 @@ gist_tqcmp(ltree * t, lquery * q) } static bool -gist_between(ltree_gist * key, lquery * query) +gist_between(ltree_gist *key, lquery *query) { if (query->firstgood == 0) return true; @@ -578,13 +578,13 @@ gist_between(ltree_gist * key, lquery * query) } static bool -checkcondition_bit(void *checkval, ITEM * val) +checkcondition_bit(void *checkval, ITEM *val) { return (FLG_CANLOOKSIGN(val->flag)) ? GETBIT(checkval, HASHVAL(val->val)) : true; } static bool -gist_qtxt(ltree_gist * key, ltxtquery * query) +gist_qtxt(ltree_gist *key, ltxtquery *query) { if (LTG_ISALLTRUE(key)) return true; @@ -597,7 +597,7 @@ gist_qtxt(ltree_gist * key, ltxtquery * query) } static bool -arrq_cons(ltree_gist * key, ArrayType *_query) +arrq_cons(ltree_gist *key, ArrayType *_query) { lquery *query = (lquery *) ARR_DATA_PTR(_query); int num = ArrayGetNItems(ARR_NDIM(_query), ARR_DIMS(_query)); @@ -626,6 +626,7 @@ ltree_consistent(PG_FUNCTION_ARGS) { GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); ltree_gist *key = (ltree_gist *) DatumGetPointer(entry->key); diff --git a/contrib/ltree/ltree_io.c b/contrib/ltree/ltree_io.c index 19645be38f..a88eb16cb9 100644 --- a/contrib/ltree/ltree_io.c +++ b/contrib/ltree/ltree_io.c @@ -1,7 +1,7 @@ /* * in/out function for ltree and lquery * Teodor Sigaev <teodor@stack.net> - * $PostgreSQL: pgsql/contrib/ltree/ltree_io.c,v 1.17 2008/06/30 18:30:48 teodor Exp $ + * $PostgreSQL: pgsql/contrib/ltree/ltree_io.c,v 1.18 2009/06/11 14:48:51 momjian Exp $ */ #include "postgres.h" @@ -32,10 +32,10 @@ Datum lquery_out(PG_FUNCTION_ARGS); typedef struct { char *start; - int len; /* length in bytes */ + int len; /* length in bytes */ int flag; - int wlen; /* length in characters */ -} nodeitem; + int wlen; /* length in characters */ +} nodeitem; #define LTPRS_WAITNAME 0 #define LTPRS_WAITDELIM 1 @@ -52,16 +52,16 @@ ltree_in(PG_FUNCTION_ARGS) int state = LTPRS_WAITNAME; ltree *result; ltree_level *curlevel; - int charlen; - int pos=0; + int charlen; + int pos = 0; ptr = buf; while (*ptr) { charlen = pg_mblen(ptr); - if ( charlen == 1 && t_iseq(ptr, '.') ) + if (charlen == 1 && t_iseq(ptr, '.')) num++; - ptr+=charlen; + ptr += charlen; } list = lptr = (nodeitem *) palloc(sizeof(nodeitem) * (num + 1)); @@ -83,7 +83,7 @@ ltree_in(PG_FUNCTION_ARGS) } else if (state == LTPRS_WAITDELIM) { - if ( charlen == 1 && t_iseq(ptr, '.') ) + if (charlen == 1 && t_iseq(ptr, '.')) { lptr->len = ptr - lptr->start; if (lptr->wlen > 255) @@ -92,7 +92,7 @@ ltree_in(PG_FUNCTION_ARGS) errmsg("name of level is too long"), errdetail("Name length is %d, must " "be < 256, in position %d.", - lptr->wlen, pos))); + lptr->wlen, pos))); totallen += MAXALIGN(lptr->len + LEVEL_HDRSIZE); lptr++; @@ -105,7 +105,7 @@ ltree_in(PG_FUNCTION_ARGS) /* internal error */ elog(ERROR, "internal error in parser"); - ptr+=charlen; + ptr += charlen; lptr->wlen++; pos++; } @@ -209,14 +209,14 @@ lquery_in(PG_FUNCTION_ARGS) bool hasnot = false; bool wasbad = false; int charlen; - int pos=0; + int pos = 0; ptr = buf; while (*ptr) { charlen = pg_mblen(ptr); - if ( charlen == 1 ) + if (charlen == 1) { if (t_iseq(ptr, '.')) num++; @@ -224,7 +224,7 @@ lquery_in(PG_FUNCTION_ARGS) numOR++; } - ptr+=charlen; + ptr += charlen; } num++; @@ -243,7 +243,7 @@ lquery_in(PG_FUNCTION_ARGS) state = LQPRS_WAITDELIM; curqlevel->numvar = 1; } - else if (charlen==1 && t_iseq(ptr, '!')) + else if (charlen == 1 && t_iseq(ptr, '!')) { GETVAR(curqlevel) = lptr = (nodeitem *) palloc0(sizeof(nodeitem) * (numOR + 1)); lptr->start = ptr + 1; @@ -252,7 +252,7 @@ lquery_in(PG_FUNCTION_ARGS) curqlevel->flag |= LQL_NOT; hasnot = true; } - else if (charlen==1 && t_iseq(ptr, '*')) + else if (charlen == 1 && t_iseq(ptr, '*')) state = LQPRS_WAITOPEN; else UNCHAR; @@ -271,28 +271,28 @@ lquery_in(PG_FUNCTION_ARGS) } else if (state == LQPRS_WAITDELIM) { - if (charlen==1 && t_iseq(ptr, '@')) + if (charlen == 1 && t_iseq(ptr, '@')) { if (lptr->start == ptr) UNCHAR; lptr->flag |= LVAR_INCASE; curqlevel->flag |= LVAR_INCASE; } - else if (charlen==1 && t_iseq(ptr, '*')) + else if (charlen == 1 && t_iseq(ptr, '*')) { if (lptr->start == ptr) UNCHAR; lptr->flag |= LVAR_ANYEND; curqlevel->flag |= LVAR_ANYEND; } - else if (charlen==1 && t_iseq(ptr, '%')) + else if (charlen == 1 && t_iseq(ptr, '%')) { if (lptr->start == ptr) UNCHAR; lptr->flag |= LVAR_SUBLEXEME; curqlevel->flag |= LVAR_SUBLEXEME; } - else if (charlen==1 && t_iseq(ptr, '|')) + else if (charlen == 1 && t_iseq(ptr, '|')) { lptr->len = ptr - lptr->start - ((lptr->flag & LVAR_SUBLEXEME) ? 1 : 0) - @@ -304,11 +304,11 @@ lquery_in(PG_FUNCTION_ARGS) errmsg("name of level is too long"), errdetail("Name length is %d, must " "be < 256, in position %d.", - lptr->wlen, pos))); + lptr->wlen, pos))); state = LQPRS_WAITVAR; } - else if (charlen==1 && t_iseq(ptr, '.')) + else if (charlen == 1 && t_iseq(ptr, '.')) { lptr->len = ptr - lptr->start - ((lptr->flag & LVAR_SUBLEXEME) ? 1 : 0) - @@ -320,7 +320,7 @@ lquery_in(PG_FUNCTION_ARGS) errmsg("name of level is too long"), errdetail("Name length is %d, must " "be < 256, in position %d.", - lptr->wlen, pos))); + lptr->wlen, pos))); state = LQPRS_WAITLEVEL; curqlevel = NEXTLEV(curqlevel); @@ -335,9 +335,9 @@ lquery_in(PG_FUNCTION_ARGS) } else if (state == LQPRS_WAITOPEN) { - if (charlen==1 && t_iseq(ptr, '{')) + if (charlen == 1 && t_iseq(ptr, '{')) state = LQPRS_WAITFNUM; - else if (charlen==1 && t_iseq(ptr, '.')) + else if (charlen == 1 && t_iseq(ptr, '.')) { curqlevel->low = 0; curqlevel->high = 0xffff; @@ -349,7 +349,7 @@ lquery_in(PG_FUNCTION_ARGS) } else if (state == LQPRS_WAITFNUM) { - if (charlen==1 && t_iseq(ptr, ',')) + if (charlen == 1 && t_iseq(ptr, ',')) state = LQPRS_WAITSNUM; else if (t_isdigit(ptr)) { @@ -366,7 +366,7 @@ lquery_in(PG_FUNCTION_ARGS) curqlevel->high = atoi(ptr); state = LQPRS_WAITCLOSE; } - else if (charlen==1 && t_iseq(ptr, '}')) + else if (charlen == 1 && t_iseq(ptr, '}')) { curqlevel->high = 0xffff; state = LQPRS_WAITEND; @@ -376,26 +376,26 @@ lquery_in(PG_FUNCTION_ARGS) } else if (state == LQPRS_WAITCLOSE) { - if (charlen==1 && t_iseq(ptr, '}')) + if (charlen == 1 && t_iseq(ptr, '}')) state = LQPRS_WAITEND; else if (!t_isdigit(ptr)) UNCHAR; } else if (state == LQPRS_WAITND) { - if (charlen==1 && t_iseq(ptr, '}')) + if (charlen == 1 && t_iseq(ptr, '}')) { curqlevel->high = curqlevel->low; state = LQPRS_WAITEND; } - else if (charlen==1 && t_iseq(ptr, ',')) + else if (charlen == 1 && t_iseq(ptr, ',')) state = LQPRS_WAITSNUM; else if (!t_isdigit(ptr)) UNCHAR; } else if (state == LQPRS_WAITEND) { - if (charlen==1 && t_iseq(ptr, '.')) + if (charlen == 1 && t_iseq(ptr, '.')) { state = LQPRS_WAITLEVEL; curqlevel = NEXTLEV(curqlevel); @@ -407,8 +407,8 @@ lquery_in(PG_FUNCTION_ARGS) /* internal error */ elog(ERROR, "internal error in parser"); - ptr+=charlen; - if ( state == LQPRS_WAITDELIM ) + ptr += charlen; + if (state == LQPRS_WAITDELIM) lptr->wlen++; pos++; } diff --git a/contrib/ltree/ltree_op.c b/contrib/ltree/ltree_op.c index a6f0ef3f24..2e6d5367d8 100644 --- a/contrib/ltree/ltree_op.c +++ b/contrib/ltree/ltree_op.c @@ -1,7 +1,7 @@ /* * op function for ltree * Teodor Sigaev <teodor@stack.net> - * $PostgreSQL: pgsql/contrib/ltree/ltree_op.c,v 1.19 2008/05/12 00:00:43 alvherre Exp $ + * $PostgreSQL: pgsql/contrib/ltree/ltree_op.c,v 1.20 2009/06/11 14:48:51 momjian Exp $ */ #include "postgres.h" @@ -58,7 +58,7 @@ Datum text2ltree(PG_FUNCTION_ARGS); Datum ltreeparentsel(PG_FUNCTION_ARGS); int -ltree_compare(const ltree * a, const ltree * b) +ltree_compare(const ltree *a, const ltree *b) { ltree_level *al = LTREE_FIRST(a); ltree_level *bl = LTREE_FIRST(b); @@ -152,7 +152,7 @@ nlevel(PG_FUNCTION_ARGS) } bool -inner_isparent(const ltree * c, const ltree * p) +inner_isparent(const ltree *c, const ltree *p) { ltree_level *cl = LTREE_FIRST(c); ltree_level *pl = LTREE_FIRST(p); @@ -201,7 +201,7 @@ ltree_risparent(PG_FUNCTION_ARGS) static ltree * -inner_subltree(ltree * t, int4 startpos, int4 endpos) +inner_subltree(ltree *t, int4 startpos, int4 endpos) { char *start = NULL, *end = NULL; @@ -283,7 +283,7 @@ subpath(PG_FUNCTION_ARGS) } static ltree * -ltree_concat(ltree * a, ltree * b) +ltree_concat(ltree *a, ltree *b) { ltree *r; @@ -422,7 +422,7 @@ ltree_textadd(PG_FUNCTION_ARGS) } ltree * -lca_inner(ltree ** a, int len) +lca_inner(ltree **a, int len) { int tmp, num = ((*a)->numlevel) ? (*a)->numlevel - 1 : 0; @@ -626,11 +626,11 @@ ltreeparentsel(PG_FUNCTION_ARGS) else if (hist_size < 100) { /* - * For histogram sizes from 10 to 100, we combine the - * histogram and default selectivities, putting increasingly - * more trust in the histogram for larger sizes. + * For histogram sizes from 10 to 100, we combine the histogram + * and default selectivities, putting increasingly more trust in + * the histogram for larger sizes. */ - double hist_weight = hist_size / 100.0; + double hist_weight = hist_size / 100.0; selec = selec * hist_weight + DEFAULT_PARENT_SEL * (1.0 - hist_weight); diff --git a/contrib/ltree/ltxtquery_io.c b/contrib/ltree/ltxtquery_io.c index eece52972a..b158c4b441 100644 --- a/contrib/ltree/ltxtquery_io.c +++ b/contrib/ltree/ltxtquery_io.c @@ -1,7 +1,7 @@ /* * txtquery io * Teodor Sigaev <teodor@stack.net> - * $PostgreSQL: pgsql/contrib/ltree/ltxtquery_io.c,v 1.16 2008/06/30 18:30:48 teodor Exp $ + * $PostgreSQL: pgsql/contrib/ltree/ltxtquery_io.c,v 1.17 2009/06/11 14:48:51 momjian Exp $ */ #include "postgres.h" @@ -51,30 +51,30 @@ typedef struct int4 sumlen; char *op; char *curop; -} QPRS_STATE; +} QPRS_STATE; /* * get token from query string */ static int4 -gettoken_query(QPRS_STATE * state, int4 *val, int4 *lenval, char **strval, uint16 *flag) +gettoken_query(QPRS_STATE *state, int4 *val, int4 *lenval, char **strval, uint16 *flag) { - int charlen; + int charlen; - for(;;) + for (;;) { charlen = pg_mblen(state->buf); switch (state->state) { case WAITOPERAND: - if (charlen==1 && t_iseq(state->buf, '!')) + if (charlen == 1 && t_iseq(state->buf, '!')) { (state->buf)++; *val = (int4) '!'; return OPR; } - else if (charlen==1 && t_iseq(state->buf, '(')) + else if (charlen == 1 && t_iseq(state->buf, '(')) { state->count++; (state->buf)++; @@ -101,11 +101,11 @@ gettoken_query(QPRS_STATE * state, int4 *val, int4 *lenval, char **strval, uint1 errmsg("modificators syntax error"))); *lenval += charlen; } - else if (charlen==1 && t_iseq(state->buf, '%')) + else if (charlen == 1 && t_iseq(state->buf, '%')) *flag |= LVAR_SUBLEXEME; - else if (charlen==1 && t_iseq(state->buf, '@')) + else if (charlen == 1 && t_iseq(state->buf, '@')) *flag |= LVAR_INCASE; - else if (charlen==1 && t_iseq(state->buf, '*')) + else if (charlen == 1 && t_iseq(state->buf, '*')) *flag |= LVAR_ANYEND; else { @@ -114,14 +114,14 @@ gettoken_query(QPRS_STATE * state, int4 *val, int4 *lenval, char **strval, uint1 } break; case WAITOPERATOR: - if (charlen==1 && ( t_iseq(state->buf, '&') || t_iseq(state->buf, '|') )) + if (charlen == 1 && (t_iseq(state->buf, '&') || t_iseq(state->buf, '|'))) { state->state = WAITOPERAND; *val = (int4) *(state->buf); (state->buf)++; return OPR; } - else if (charlen==1 && t_iseq(state->buf, ')')) + else if (charlen == 1 && t_iseq(state->buf, ')')) { (state->buf)++; state->count--; @@ -129,7 +129,7 @@ gettoken_query(QPRS_STATE * state, int4 *val, int4 *lenval, char **strval, uint1 } else if (*(state->buf) == '\0') return (state->count) ? ERR : END; - else if (charlen==1 && !t_iseq(state->buf, ' ')) + else if (charlen == 1 && !t_iseq(state->buf, ' ')) return ERR; break; default: @@ -146,7 +146,7 @@ gettoken_query(QPRS_STATE * state, int4 *val, int4 *lenval, char **strval, uint1 * push new one in polish notation reverse view */ static void -pushquery(QPRS_STATE * state, int4 type, int4 val, int4 distance, int4 lenval, uint16 flag) +pushquery(QPRS_STATE *state, int4 type, int4 val, int4 distance, int4 lenval, uint16 flag) { NODE *tmp = (NODE *) palloc(sizeof(NODE)); @@ -172,7 +172,7 @@ pushquery(QPRS_STATE * state, int4 type, int4 val, int4 distance, int4 lenval, u * This function is used for query_txt parsing */ static void -pushval_asis(QPRS_STATE * state, int type, char *strval, int lenval, uint16 flag) +pushval_asis(QPRS_STATE *state, int type, char *strval, int lenval, uint16 flag) { if (lenval > 0xffff) ereport(ERROR, @@ -203,7 +203,7 @@ pushval_asis(QPRS_STATE * state, int type, char *strval, int lenval, uint16 flag * make polish notaion of query */ static int4 -makepol(QPRS_STATE * state) +makepol(QPRS_STATE *state) { int4 val = 0, type; @@ -275,7 +275,7 @@ makepol(QPRS_STATE * state) } static void -findoprnd(ITEM * ptr, int4 *pos) +findoprnd(ITEM *ptr, int4 *pos) { if (ptr[*pos].type == VAL || ptr[*pos].type == VALTRUE) { diff --git a/contrib/ltree/ltxtquery_op.c b/contrib/ltree/ltxtquery_op.c index 647d978fec..559c05e2bf 100644 --- a/contrib/ltree/ltxtquery_op.c +++ b/contrib/ltree/ltxtquery_op.c @@ -1,7 +1,7 @@ /* * txtquery operations with ltree * Teodor Sigaev <teodor@stack.net> - * $PostgreSQL: pgsql/contrib/ltree/ltxtquery_op.c,v 1.9 2008/06/30 18:30:48 teodor Exp $ + * $PostgreSQL: pgsql/contrib/ltree/ltxtquery_op.c,v 1.10 2009/06/11 14:48:51 momjian Exp $ */ #include "postgres.h" @@ -16,7 +16,7 @@ PG_FUNCTION_INFO_V1(ltxtq_rexec); * check for boolean condition */ bool -ltree_execute(ITEM * curitem, void *checkval, bool calcnot, bool (*chkcond) (void *checkval, ITEM * val)) +ltree_execute(ITEM *curitem, void *checkval, bool calcnot, bool (*chkcond) (void *checkval, ITEM *val)) { if (curitem->type == VAL) return (*chkcond) (checkval, curitem); @@ -50,7 +50,7 @@ typedef struct } CHKVAL; static bool -checkcondition_str(void *checkval, ITEM * val) +checkcondition_str(void *checkval, ITEM *val) { ltree_level *level = LTREE_FIRST(((CHKVAL *) checkval)->node); int tlen = ((CHKVAL *) checkval)->node->numlevel; diff --git a/contrib/oid2name/oid2name.c b/contrib/oid2name/oid2name.c index 7b9046bb18..9d896b84f5 100644 --- a/contrib/oid2name/oid2name.c +++ b/contrib/oid2name/oid2name.c @@ -5,7 +5,7 @@ * Originally by * B. Palmer, bpalmer@crimelabs.net 1-17-2001 * - * $PostgreSQL: pgsql/contrib/oid2name/oid2name.c,v 1.35 2009/02/27 09:30:21 petere Exp $ + * $PostgreSQL: pgsql/contrib/oid2name/oid2name.c,v 1.36 2009/06/11 14:48:51 momjian Exp $ */ #include "postgres_fe.h" @@ -24,7 +24,7 @@ typedef struct char **array; int num; int alloc; -} eary; +} eary; /* these are the opts structures for command line params */ struct options @@ -51,8 +51,8 @@ static void help(const char *progname); void get_opts(int, char **, struct options *); void *myalloc(size_t size); char *mystrdup(const char *str); -void add_one_elt(char *eltname, eary * eary); -char *get_comma_elts(eary * eary); +void add_one_elt(char *eltname, eary *eary); +char *get_comma_elts(eary *eary); PGconn *sql_conn(struct options *); int sql_exec(PGconn *, const char *sql, bool quiet); void sql_exec_dumpalldbs(PGconn *, struct options *); @@ -230,18 +230,19 @@ mystrdup(const char *str) * Add one element to a (possibly empty) eary struct. */ void -add_one_elt(char *eltname, eary * eary) +add_one_elt(char *eltname, eary *eary) { if (eary->alloc == 0) { - eary->alloc = 8; - eary->array = (char **) myalloc(8 * sizeof(char *)); + eary ->alloc = 8; + eary ->array = (char **) myalloc(8 * sizeof(char *)); } else if (eary->num >= eary->alloc) { - eary->alloc *= 2; - eary->array = (char **) - realloc(eary->array, eary->alloc * sizeof(char *)); + eary ->alloc *= 2; + eary ->array = (char **) + realloc(eary->array, eary->alloc * sizeof(char *)); + if (!eary->array) { fprintf(stderr, "out of memory"); @@ -249,8 +250,8 @@ add_one_elt(char *eltname, eary * eary) } } - eary->array[eary->num] = mystrdup(eltname); - eary->num++; + eary ->array[eary->num] = mystrdup(eltname); + eary ->num++; } /* @@ -261,7 +262,7 @@ add_one_elt(char *eltname, eary * eary) * SQL statement. */ char * -get_comma_elts(eary * eary) +get_comma_elts(eary *eary) { char *ret, *ptr; @@ -310,8 +311,8 @@ sql_conn(struct options * my_opts) new_pass = false; conn = PQsetdbLogin(my_opts->hostname, my_opts->port, - NULL, /* options */ - NULL, /* tty */ + NULL, /* options */ + NULL, /* tty */ my_opts->dbname, my_opts->username, password); diff --git a/contrib/pageinspect/btreefuncs.c b/contrib/pageinspect/btreefuncs.c index 85935b9990..4f56864d2e 100644 --- a/contrib/pageinspect/btreefuncs.c +++ b/contrib/pageinspect/btreefuncs.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/pageinspect/btreefuncs.c,v 1.9 2009/03/31 22:54:31 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pageinspect/btreefuncs.c,v 1.10 2009/06/11 14:48:51 momjian Exp $ * * * btreefuncs.c @@ -83,7 +83,7 @@ typedef struct BTPageStat } btpo; uint16 btpo_flags; BTCycleId btpo_cycleid; -} BTPageStat; +} BTPageStat; /* ------------------------------------------------- @@ -93,7 +93,7 @@ typedef struct BTPageStat * ------------------------------------------------- */ static void -GetBTPageStatistics(BlockNumber blkno, Buffer buffer, BTPageStat * stat) +GetBTPageStatistics(BlockNumber blkno, Buffer buffer, BTPageStat *stat) { Page page = BufferGetPage(buffer); PageHeader phdr = (PageHeader) page; @@ -191,9 +191,9 @@ bt_page_stats(PG_FUNCTION_ARGS) RelationGetRelationName(rel)); /* - * Reject attempts to read non-local temporary relations; we would - * be likely to get wrong data since we have no visibility into the - * owning session's local buffers. + * Reject attempts to read non-local temporary relations; we would be + * likely to get wrong data since we have no visibility into the owning + * session's local buffers. */ if (RELATION_IS_OTHER_TEMP(rel)) ereport(ERROR, @@ -309,14 +309,14 @@ bt_page_items(PG_FUNCTION_ARGS) RelationGetRelationName(rel)); /* - * Reject attempts to read non-local temporary relations; we would - * be likely to get wrong data since we have no visibility into the + * Reject attempts to read non-local temporary relations; we would be + * likely to get wrong data since we have no visibility into the * owning session's local buffers. */ if (RELATION_IS_OTHER_TEMP(rel)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot access temporary tables of other sessions"))); + errmsg("cannot access temporary tables of other sessions"))); if (blkno == 0) elog(ERROR, "block 0 is a meta page"); @@ -458,9 +458,9 @@ bt_metap(PG_FUNCTION_ARGS) RelationGetRelationName(rel)); /* - * Reject attempts to read non-local temporary relations; we would - * be likely to get wrong data since we have no visibility into the - * owning session's local buffers. + * Reject attempts to read non-local temporary relations; we would be + * likely to get wrong data since we have no visibility into the owning + * session's local buffers. */ if (RELATION_IS_OTHER_TEMP(rel)) ereport(ERROR, diff --git a/contrib/pageinspect/fsmfuncs.c b/contrib/pageinspect/fsmfuncs.c index 71f1e23fa6..7f87726651 100644 --- a/contrib/pageinspect/fsmfuncs.c +++ b/contrib/pageinspect/fsmfuncs.c @@ -12,7 +12,7 @@ * Copyright (c) 2007-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/contrib/pageinspect/fsmfuncs.c,v 1.2 2009/01/01 17:23:32 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pageinspect/fsmfuncs.c,v 1.3 2009/06/11 14:48:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -24,7 +24,7 @@ #include "miscadmin.h" #include "funcapi.h" -Datum fsm_page_contents(PG_FUNCTION_ARGS); +Datum fsm_page_contents(PG_FUNCTION_ARGS); /* * Dumps the contents of a FSM page. @@ -50,7 +50,7 @@ fsm_page_contents(PG_FUNCTION_ARGS) initStringInfo(&sinfo); - for(i=0; i < NodesPerPage; i++) + for (i = 0; i < NodesPerPage; i++) { if (fsmpage->fp_nodes[i] != 0) appendStringInfo(&sinfo, "%d: %d\n", i, fsmpage->fp_nodes[i]); diff --git a/contrib/pageinspect/heapfuncs.c b/contrib/pageinspect/heapfuncs.c index 2b8688d0fb..bdd742db5d 100644 --- a/contrib/pageinspect/heapfuncs.c +++ b/contrib/pageinspect/heapfuncs.c @@ -18,7 +18,7 @@ * Copyright (c) 2007-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/contrib/pageinspect/heapfuncs.c,v 1.6 2009/01/01 17:23:32 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pageinspect/heapfuncs.c,v 1.7 2009/06/11 14:48:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -72,7 +72,7 @@ typedef struct heap_page_items_state TupleDesc tupd; Page page; uint16 offset; -} heap_page_items_state; +} heap_page_items_state; Datum heap_page_items(PG_FUNCTION_ARGS) @@ -189,7 +189,7 @@ heap_page_items(PG_FUNCTION_ARGS) (((char *) tuphdr->t_bits) -((char *) tuphdr)); values[11] = CStringGetTextDatum( - bits_to_text(tuphdr->t_bits, bits_len * 8)); + bits_to_text(tuphdr->t_bits, bits_len * 8)); } else nulls[11] = true; diff --git a/contrib/pageinspect/rawpage.c b/contrib/pageinspect/rawpage.c index 00e2535eae..9430e855bf 100644 --- a/contrib/pageinspect/rawpage.c +++ b/contrib/pageinspect/rawpage.c @@ -8,7 +8,7 @@ * Copyright (c) 2007-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/contrib/pageinspect/rawpage.c,v 1.12 2009/06/08 16:22:44 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pageinspect/rawpage.c,v 1.13 2009/06/11 14:48:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -33,7 +33,7 @@ Datum get_raw_page_fork(PG_FUNCTION_ARGS); Datum page_header(PG_FUNCTION_ARGS); static bytea *get_raw_page_internal(text *relname, ForkNumber forknum, - BlockNumber blkno); + BlockNumber blkno); /* @@ -121,9 +121,9 @@ get_raw_page_internal(text *relname, ForkNumber forknum, BlockNumber blkno) RelationGetRelationName(rel)))); /* - * Reject attempts to read non-local temporary relations; we would - * be likely to get wrong data since we have no visibility into the - * owning session's local buffers. + * Reject attempts to read non-local temporary relations; we would be + * likely to get wrong data since we have no visibility into the owning + * session's local buffers. */ if (RELATION_IS_OTHER_TEMP(rel)) ereport(ERROR, diff --git a/contrib/pg_buffercache/pg_buffercache_pages.c b/contrib/pg_buffercache/pg_buffercache_pages.c index ef18fa1048..5939f52a04 100644 --- a/contrib/pg_buffercache/pg_buffercache_pages.c +++ b/contrib/pg_buffercache/pg_buffercache_pages.c @@ -3,7 +3,7 @@ * pg_buffercache_pages.c * display some contents of the buffer cache * - * $PostgreSQL: pgsql/contrib/pg_buffercache/pg_buffercache_pages.c,v 1.15 2008/08/14 12:56:41 heikki Exp $ + * $PostgreSQL: pgsql/contrib/pg_buffercache/pg_buffercache_pages.c,v 1.16 2009/06/11 14:48:51 momjian Exp $ *------------------------------------------------------------------------- */ #include "postgres.h" @@ -37,7 +37,7 @@ typedef struct bool isvalid; bool isdirty; uint16 usagecount; -} BufferCachePagesRec; +} BufferCachePagesRec; /* @@ -47,7 +47,7 @@ typedef struct { TupleDesc tupdesc; BufferCachePagesRec *record; -} BufferCachePagesContext; +} BufferCachePagesContext; /* diff --git a/contrib/pg_freespacemap/pg_freespacemap.c b/contrib/pg_freespacemap/pg_freespacemap.c index 9c16335671..4b1dece12a 100644 --- a/contrib/pg_freespacemap/pg_freespacemap.c +++ b/contrib/pg_freespacemap/pg_freespacemap.c @@ -3,7 +3,7 @@ * pg_freespacemap.c * display contents of a free space map * - * $PostgreSQL: pgsql/contrib/pg_freespacemap/pg_freespacemap.c,v 1.13 2009/04/07 17:57:50 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pg_freespacemap/pg_freespacemap.c,v 1.14 2009/06/11 14:48:51 momjian Exp $ *------------------------------------------------------------------------- */ #include "postgres.h" @@ -27,10 +27,10 @@ PG_FUNCTION_INFO_V1(pg_freespace); Datum pg_freespace(PG_FUNCTION_ARGS) { - Oid relid = PG_GETARG_OID(0); - int64 blkno = PG_GETARG_INT64(1); - int16 freespace; - Relation rel; + Oid relid = PG_GETARG_OID(0); + int64 blkno = PG_GETARG_INT64(1); + int16 freespace; + Relation rel; rel = relation_open(relid, AccessShareLock); diff --git a/contrib/pg_standby/pg_standby.c b/contrib/pg_standby/pg_standby.c index f2a7697178..01f1b1fa38 100644 --- a/contrib/pg_standby/pg_standby.c +++ b/contrib/pg_standby/pg_standby.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/pg_standby/pg_standby.c,v 1.22 2009/05/14 20:31:09 heikki Exp $ + * $PostgreSQL: pgsql/contrib/pg_standby/pg_standby.c,v 1.23 2009/06/11 14:48:51 momjian Exp $ * * * pg_standby.c @@ -91,7 +91,7 @@ char exclusiveCleanupFileName[MAXPGPATH]; /* the file we need to #define SmartFailover 1 #define FastFailover 2 -static int Failover = NoFailover; +static int Failover = NoFailover; #define RESTORE_COMMAND_COPY 0 #define RESTORE_COMMAND_LINK 1 @@ -205,10 +205,10 @@ CustomizableNextWALFileReady() /* * Windows 'cp' sets the final file size before the copy is - * complete, and not yet ready to be opened by pg_standby. - * So we wait for sleeptime secs before attempting to restore. - * If that is not enough, we will rely on the retry/holdoff - * mechanism. GNUWin32's cp does not have this problem. + * complete, and not yet ready to be opened by pg_standby. So we + * wait for sleeptime secs before attempting to restore. If that + * is not enough, we will rely on the retry/holdoff mechanism. + * GNUWin32's cp does not have this problem. */ pg_usleep(sleeptime * 1000000L); #endif @@ -327,10 +327,10 @@ SetWALFileNameForCleanup(void) if (restartWALFileName) { /* - * Don't do cleanup if the restartWALFileName provided - * is later than the xlog file requested. This is an error - * and we must not remove these files from archive. - * This shouldn't happen, but better safe than sorry. + * Don't do cleanup if the restartWALFileName provided is later than + * the xlog file requested. This is an error and we must not remove + * these files from archive. This shouldn't happen, but better safe + * than sorry. */ if (strcmp(restartWALFileName, nextWALFileName) > 0) return false; @@ -376,15 +376,15 @@ SetWALFileNameForCleanup(void) * CheckForExternalTrigger() * * Is there a trigger file? Sets global 'Failover' variable to indicate - * what kind of a trigger file it was. A "fast" trigger file is turned - * into a "smart" file as a side-effect. + * what kind of a trigger file it was. A "fast" trigger file is turned + * into a "smart" file as a side-effect. */ static void CheckForExternalTrigger(void) { - char buf[32]; - int fd; - int len; + char buf[32]; + int fd; + int len; /* * Look for a trigger file, if that option has been selected @@ -397,10 +397,10 @@ CheckForExternalTrigger(void) /* * An empty trigger file performs smart failover. There's a little race - * condition here: if the writer of the trigger file has just created - * the file, but not yet written anything to it, we'll treat that as - * smart shutdown even if the other process was just about to write "fast" - * to it. But that's fine: we'll restore one more WAL file, and when we're + * condition here: if the writer of the trigger file has just created the + * file, but not yet written anything to it, we'll treat that as smart + * shutdown even if the other process was just about to write "fast" to + * it. But that's fine: we'll restore one more WAL file, and when we're * invoked next time, we'll see the word "fast" and fail over immediately. */ if (stat_buf.st_size == 0) @@ -418,7 +418,7 @@ CheckForExternalTrigger(void) fflush(stderr); return; } - + if ((len = read(fd, buf, sizeof(buf))) < 0) { fprintf(stderr, "WARNING: could not read \"%s\": %s\n", @@ -428,7 +428,7 @@ CheckForExternalTrigger(void) return; } buf[len] = '\0'; - + if (strncmp(buf, "smart", 5) == 0) { Failover = SmartFailover; @@ -437,7 +437,7 @@ CheckForExternalTrigger(void) close(fd); return; } - + if (strncmp(buf, "fast", 4) == 0) { Failover = FastFailover; @@ -446,8 +446,8 @@ CheckForExternalTrigger(void) fflush(stderr); /* - * Turn it into a "smart" trigger by truncating the file. Otherwise - * if the server asks us again to restore a segment that was restored + * Turn it into a "smart" trigger by truncating the file. Otherwise if + * the server asks us again to restore a segment that was restored * restored already, we would return "not found" and upset the server. */ if (ftruncate(fd, 0) < 0) @@ -461,7 +461,7 @@ CheckForExternalTrigger(void) return; } close(fd); - + fprintf(stderr, "WARNING: invalid content in \"%s\"\n", triggerPath); fflush(stderr); return; @@ -514,7 +514,7 @@ usage(void) printf("Usage:\n"); printf(" %s [OPTION]... ARCHIVELOCATION NEXTWALFILE XLOGFILEPATH [RESTARTWALFILE]\n", progname); printf("\n" - "with main intended use as a restore_command in the recovery.conf:\n" + "with main intended use as a restore_command in the recovery.conf:\n" " restore_command = 'pg_standby [OPTION]... ARCHIVELOCATION %%f %%p %%r'\n" "e.g.\n" " restore_command = 'pg_standby -l /mnt/server/archiverdir %%f %%p %%r'\n"); @@ -577,16 +577,16 @@ main(int argc, char **argv) * You can send SIGUSR1 to trigger failover. * * Postmaster uses SIGQUIT to request immediate shutdown. The default - * action is to core dump, but we don't want that, so trap it and - * commit suicide without core dump. + * action is to core dump, but we don't want that, so trap it and commit + * suicide without core dump. * - * We used to use SIGINT and SIGQUIT to trigger failover, but that - * turned out to be a bad idea because postmaster uses SIGQUIT to - * request immediate shutdown. We still trap SIGINT, but that may - * change in a future release. + * We used to use SIGINT and SIGQUIT to trigger failover, but that turned + * out to be a bad idea because postmaster uses SIGQUIT to request + * immediate shutdown. We still trap SIGINT, but that may change in a + * future release. */ (void) signal(SIGUSR1, sighandler); - (void) signal(SIGINT, sighandler); /* deprecated, use SIGUSR1 */ + (void) signal(SIGINT, sighandler); /* deprecated, use SIGUSR1 */ #ifndef WIN32 (void) signal(SIGQUIT, sigquit_handler); #endif @@ -777,9 +777,9 @@ main(int argc, char **argv) { /* * Once we have restored this file successfully we can remove some - * prior WAL files. If this restore fails we musn't remove any file - * because some of them will be requested again immediately after - * the failed restore, or when we restart recovery. + * prior WAL files. If this restore fails we musn't remove any + * file because some of them will be requested again immediately + * after the failed restore, or when we restart recovery. */ if (RestoreWALFileForRecovery()) { diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_stat_statements/pg_stat_statements.c index 34cbb9d0b8..5a818ba042 100644 --- a/contrib/pg_stat_statements/pg_stat_statements.c +++ b/contrib/pg_stat_statements/pg_stat_statements.c @@ -14,7 +14,7 @@ * Copyright (c) 2008-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/contrib/pg_stat_statements/pg_stat_statements.c,v 1.2 2009/01/05 13:35:38 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pg_stat_statements/pg_stat_statements.c,v 1.3 2009/06/11 14:48:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -87,7 +87,7 @@ typedef struct Counters */ typedef struct pgssEntry { - pgssHashKey key; /* hash key of entry - MUST BE FIRST */ + pgssHashKey key; /* hash key of entry - MUST BE FIRST */ Counters counters; /* the statistics for this query */ slock_t mutex; /* protects the counters only */ char query[1]; /* VARIABLE LENGTH ARRAY - MUST BE LAST */ @@ -106,15 +106,17 @@ typedef struct pgssSharedState /*---- Local variables ----*/ /* Current nesting depth of ExecutorRun calls */ -static int nested_level = 0; +static int nested_level = 0; + /* Saved hook values in case of unload */ -static shmem_startup_hook_type prev_shmem_startup_hook = NULL; -static ExecutorStart_hook_type prev_ExecutorStart = NULL; -static ExecutorRun_hook_type prev_ExecutorRun = NULL; -static ExecutorEnd_hook_type prev_ExecutorEnd = NULL; +static shmem_startup_hook_type prev_shmem_startup_hook = NULL; +static ExecutorStart_hook_type prev_ExecutorStart = NULL; +static ExecutorRun_hook_type prev_ExecutorRun = NULL; +static ExecutorEnd_hook_type prev_ExecutorEnd = NULL; + /* Links to shared memory state */ -static pgssSharedState *pgss = NULL; -static HTAB *pgss_hash = NULL; +static pgssSharedState *pgss = NULL; +static HTAB *pgss_hash = NULL; /*---- GUC variables ----*/ @@ -143,11 +145,11 @@ static bool pgss_save; /* whether to save stats across shutdown */ /*---- Function declarations ----*/ -void _PG_init(void); -void _PG_fini(void); +void _PG_init(void); +void _PG_fini(void); -Datum pg_stat_statements_reset(PG_FUNCTION_ARGS); -Datum pg_stat_statements(PG_FUNCTION_ARGS); +Datum pg_stat_statements_reset(PG_FUNCTION_ARGS); +Datum pg_stat_statements(PG_FUNCTION_ARGS); PG_FUNCTION_INFO_V1(pg_stat_statements_reset); PG_FUNCTION_INFO_V1(pg_stat_statements); @@ -156,14 +158,14 @@ static void pgss_shmem_startup(void); static void pgss_shmem_shutdown(int code, Datum arg); static void pgss_ExecutorStart(QueryDesc *queryDesc, int eflags); static void pgss_ExecutorRun(QueryDesc *queryDesc, - ScanDirection direction, - long count); + ScanDirection direction, + long count); static void pgss_ExecutorEnd(QueryDesc *queryDesc); static uint32 pgss_hash_fn(const void *key, Size keysize); -static int pgss_match_fn(const void *key1, const void *key2, Size keysize); +static int pgss_match_fn(const void *key1, const void *key2, Size keysize); static void pgss_store(const char *query, - const Instrumentation *instr, uint32 rows); -static Size pgss_memsize(void); + const Instrumentation *instr, uint32 rows); +static Size pgss_memsize(void); static pgssEntry *entry_alloc(pgssHashKey *key); static void entry_dealloc(void); static void entry_reset(void); @@ -177,11 +179,11 @@ _PG_init(void) { /* * In order to create our shared memory area, we have to be loaded via - * shared_preload_libraries. If not, fall out without hooking into - * any of the main system. (We don't throw error here because it seems - * useful to allow the pg_stat_statements functions to be created even - * when the module isn't active. The functions must protect themselves - * against being called then, however.) + * shared_preload_libraries. If not, fall out without hooking into any of + * the main system. (We don't throw error here because it seems useful to + * allow the pg_stat_statements functions to be created even when the + * module isn't active. The functions must protect themselves against + * being called then, however.) */ if (!process_shared_preload_libraries_in_progress) return; @@ -190,7 +192,7 @@ _PG_init(void) * Define (or redefine) custom GUC variables. */ DefineCustomIntVariable("pg_stat_statements.max", - "Sets the maximum number of statements tracked by pg_stat_statements.", + "Sets the maximum number of statements tracked by pg_stat_statements.", NULL, &pgss_max, 1000, @@ -202,7 +204,7 @@ _PG_init(void) NULL); DefineCustomEnumVariable("pg_stat_statements.track", - "Selects which statements are tracked by pg_stat_statements.", + "Selects which statements are tracked by pg_stat_statements.", NULL, &pgss_track, PGSS_TRACK_TOP, @@ -213,7 +215,7 @@ _PG_init(void) NULL); DefineCustomBoolVariable("pg_stat_statements.save", - "Save pg_stat_statements statistics across server shutdowns.", + "Save pg_stat_statements statistics across server shutdowns.", NULL, &pgss_save, true, @@ -265,7 +267,7 @@ _PG_fini(void) static void pgss_shmem_startup(void) { - bool found; + bool found; HASHCTL info; FILE *file; uint32 header; @@ -294,7 +296,7 @@ pgss_shmem_startup(void) elog(ERROR, "out of shared memory"); if (!found) - { + { /* First time through ... */ pgss->lock = LWLockAssign(); pgss->query_size = pgstat_track_activity_query_size; @@ -305,7 +307,7 @@ pgss_shmem_startup(void) memset(&info, 0, sizeof(info)); info.keysize = sizeof(pgssHashKey); - info.entrysize = offsetof(pgssEntry, query) + query_size; + info.entrysize = offsetof(pgssEntry, query) +query_size; info.hash = pgss_hash_fn; info.match = pgss_match_fn; pgss_hash = ShmemInitHash("pg_stat_statements hash", @@ -318,8 +320,8 @@ pgss_shmem_startup(void) LWLockRelease(AddinShmemInitLock); /* - * If we're in the postmaster (or a standalone backend...), set up a - * shmem exit hook to dump the statistics to disk. + * If we're in the postmaster (or a standalone backend...), set up a shmem + * exit hook to dump the statistics to disk. */ if (!IsUnderPostmaster) on_shmem_exit(pgss_shmem_shutdown, (Datum) 0); @@ -327,8 +329,8 @@ pgss_shmem_startup(void) /* * Attempt to load old statistics from the dump file. * - * Note: we don't bother with locks here, because there should be no - * other processes running when this is called. + * Note: we don't bother with locks here, because there should be no other + * processes running when this is called. */ if (!pgss_save) return; @@ -352,7 +354,7 @@ pgss_shmem_startup(void) for (i = 0; i < num; i++) { pgssEntry temp; - pgssEntry *entry; + pgssEntry *entry; if (fread(&temp, offsetof(pgssEntry, mutex), 1, file) != 1) goto error; @@ -413,10 +415,10 @@ error: static void pgss_shmem_shutdown(int code, Datum arg) { - FILE *file; - HASH_SEQ_STATUS hash_seq; - int32 num_entries; - pgssEntry *entry; + FILE *file; + HASH_SEQ_STATUS hash_seq; + int32 num_entries; + pgssEntry *entry; /* Don't try to dump during a crash. */ if (code) @@ -443,7 +445,7 @@ pgss_shmem_shutdown(int code, Datum arg) hash_seq_init(&hash_seq, pgss_hash); while ((entry = hash_seq_search(&hash_seq)) != NULL) { - int len = entry->key.query_len; + int len = entry->key.query_len; if (fwrite(entry, offsetof(pgssEntry, mutex), 1, file) != 1 || fwrite(entry->query, 1, len, file) != len) @@ -482,9 +484,9 @@ pgss_ExecutorStart(QueryDesc *queryDesc, int eflags) if (pgss_enabled()) { /* - * Set up to track total elapsed time in ExecutorRun. Make sure - * the space is allocated in the per-query context so it will go - * away at ExecutorEnd. + * Set up to track total elapsed time in ExecutorRun. Make sure the + * space is allocated in the per-query context so it will go away at + * ExecutorEnd. */ if (queryDesc->totaltime == NULL) { @@ -529,8 +531,8 @@ pgss_ExecutorEnd(QueryDesc *queryDesc) if (queryDesc->totaltime && pgss_enabled()) { /* - * Make sure stats accumulation is done. (Note: it's okay if - * several levels of hook all do this.) + * Make sure stats accumulation is done. (Note: it's okay if several + * levels of hook all do this.) */ InstrEndLoop(queryDesc->totaltime); @@ -585,9 +587,9 @@ pgss_match_fn(const void *key1, const void *key2, Size keysize) static void pgss_store(const char *query, const Instrumentation *instr, uint32 rows) { - pgssHashKey key; + pgssHashKey key; double usage; - pgssEntry *entry; + pgssEntry *entry; Assert(query != NULL); @@ -658,15 +660,15 @@ pg_stat_statements_reset(PG_FUNCTION_ARGS) Datum pg_stat_statements(PG_FUNCTION_ARGS) { - ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo; - TupleDesc tupdesc; - Tuplestorestate *tupstore; - MemoryContext per_query_ctx; - MemoryContext oldcontext; - Oid userid = GetUserId(); - bool is_superuser = superuser(); - HASH_SEQ_STATUS hash_seq; - pgssEntry *entry; + ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo; + TupleDesc tupdesc; + Tuplestorestate *tupstore; + MemoryContext per_query_ctx; + MemoryContext oldcontext; + Oid userid = GetUserId(); + bool is_superuser = superuser(); + HASH_SEQ_STATUS hash_seq; + pgssEntry *entry; if (!pgss || !pgss_hash) ereport(ERROR, @@ -727,7 +729,7 @@ pg_stat_statements(PG_FUNCTION_ARGS) if (is_superuser || entry->key.userid == userid) { - char *qstr; + char *qstr; qstr = (char *) pg_do_encoding_conversion((unsigned char *) entry->query, @@ -777,11 +779,11 @@ pg_stat_statements(PG_FUNCTION_ARGS) static Size pgss_memsize(void) { - Size size; - Size entrysize; + Size size; + Size entrysize; size = MAXALIGN(sizeof(pgssSharedState)); - entrysize = offsetof(pgssEntry, query) + pgstat_track_activity_query_size; + entrysize = offsetof(pgssEntry, query) +pgstat_track_activity_query_size; size = add_size(size, hash_estimate_size(pgss_max, entrysize)); return size; @@ -792,7 +794,7 @@ pgss_memsize(void) * caller must hold an exclusive lock on pgss->lock * * Note: despite needing exclusive lock, it's not an error for the target - * entry to already exist. This is because pgss_store releases and + * entry to already exist. This is because pgss_store releases and * reacquires lock after failing to find a match; so someone else could * have made the entry while we waited to get exclusive lock. */ @@ -800,7 +802,7 @@ static pgssEntry * entry_alloc(pgssHashKey *key) { pgssEntry *entry; - bool found; + bool found; /* Caller must have clipped query properly */ Assert(key->query_len < pgss->query_size); @@ -837,8 +839,8 @@ entry_alloc(pgssHashKey *key) static int entry_cmp(const void *lhs, const void *rhs) { - double l_usage = (*(const pgssEntry **)lhs)->counters.usage; - double r_usage = (*(const pgssEntry **)rhs)->counters.usage; + double l_usage = (*(const pgssEntry **) lhs)->counters.usage; + double r_usage = (*(const pgssEntry **) rhs)->counters.usage; if (l_usage < r_usage) return -1; @@ -855,11 +857,11 @@ entry_cmp(const void *lhs, const void *rhs) static void entry_dealloc(void) { - HASH_SEQ_STATUS hash_seq; - pgssEntry **entries; - pgssEntry *entry; - int nvictims; - int i; + HASH_SEQ_STATUS hash_seq; + pgssEntry **entries; + pgssEntry *entry; + int nvictims; + int i; /* Sort entries by usage and deallocate USAGE_DEALLOC_PERCENT of them. */ @@ -891,8 +893,8 @@ entry_dealloc(void) static void entry_reset(void) { - HASH_SEQ_STATUS hash_seq; - pgssEntry *entry; + HASH_SEQ_STATUS hash_seq; + pgssEntry *entry; LWLockAcquire(pgss->lock, LW_EXCLUSIVE); diff --git a/contrib/pg_trgm/trgm.h b/contrib/pg_trgm/trgm.h index 18d6751687..4a89760d71 100644 --- a/contrib/pg_trgm/trgm.h +++ b/contrib/pg_trgm/trgm.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/pg_trgm/trgm.h,v 1.10 2008/11/12 13:43:54 teodor Exp $ + * $PostgreSQL: pgsql/contrib/pg_trgm/trgm.h,v 1.11 2009/06/11 14:48:51 momjian Exp $ */ #ifndef __TRGM_H__ #define __TRGM_H__ @@ -31,7 +31,7 @@ typedef char trgm[3]; *(((char*)(a))+2) = *(((char*)(b))+2); \ } while(0); -uint32 trgm2int(trgm *ptr); +uint32 trgm2int(trgm *ptr); #ifdef KEEPONLYALNUM #define ISPRINTABLECHAR(a) ( isascii( *(unsigned char*)(a) ) && (isalnum( *(unsigned char*)(a) ) || *(unsigned char*)(a)==' ') ) @@ -45,7 +45,7 @@ typedef struct int32 vl_len_; /* varlena header (do not touch directly!) */ uint8 flag; char data[1]; -} TRGM; +} TRGM; #define TRGMHDRSIZE (VARHDRSZ + sizeof(uint8)) @@ -87,6 +87,6 @@ typedef char *BITVECP; extern float4 trgm_limit; TRGM *generate_trgm(char *str, int slen); -float4 cnt_sml(TRGM * trg1, TRGM * trg2); +float4 cnt_sml(TRGM *trg1, TRGM *trg2); #endif diff --git a/contrib/pg_trgm/trgm_gin.c b/contrib/pg_trgm/trgm_gin.c index 1a53d1d358..a150f8843e 100644 --- a/contrib/pg_trgm/trgm_gin.c +++ b/contrib/pg_trgm/trgm_gin.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/pg_trgm/trgm_gin.c,v 1.7 2009/03/25 22:19:01 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pg_trgm/trgm_gin.c,v 1.8 2009/06/11 14:48:51 momjian Exp $ */ #include "trgm.h" @@ -52,11 +52,11 @@ gin_extract_trgm(PG_FUNCTION_ARGS) /* * Function called from query extracting */ - Pointer **extra_data = (Pointer **) PG_GETARG_POINTER(4); + Pointer **extra_data = (Pointer **) PG_GETARG_POINTER(4); - *extra_data = (Pointer*) palloc0(sizeof(Pointer)*(*nentries)); + *extra_data = (Pointer *) palloc0(sizeof(Pointer) * (*nentries)); - *(int32*)(*extra_data) = trglen; + *(int32 *) (*extra_data) = trglen; } } @@ -67,8 +67,9 @@ Datum gin_trgm_consistent(PG_FUNCTION_ARGS) { bool *check = (bool *) PG_GETARG_POINTER(0); + /* StrategyNumber strategy = PG_GETARG_UINT16(1); */ - /* text *query = PG_GETARG_TEXT_P(2); */ + /* text *query = PG_GETARG_TEXT_P(2); */ /* int32 nkeys = PG_GETARG_INT32(3); */ Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); bool *recheck = (bool *) PG_GETARG_POINTER(5); @@ -80,7 +81,7 @@ gin_trgm_consistent(PG_FUNCTION_ARGS) /* All cases served by this function are inexact */ *recheck = true; - trglen = *(int32*)extra_data; + trglen = *(int32 *) extra_data; for (i = 0; i < trglen; i++) if (check[i]) diff --git a/contrib/pg_trgm/trgm_gist.c b/contrib/pg_trgm/trgm_gist.c index 2720d7fb70..7014394bb2 100644 --- a/contrib/pg_trgm/trgm_gist.c +++ b/contrib/pg_trgm/trgm_gist.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/pg_trgm/trgm_gist.c,v 1.15 2008/07/11 11:56:48 teodor Exp $ + * $PostgreSQL: pgsql/contrib/pg_trgm/trgm_gist.c,v 1.16 2009/06/11 14:48:51 momjian Exp $ */ #include "trgm.h" @@ -75,7 +75,7 @@ gtrgm_out(PG_FUNCTION_ARGS) } static void -makesign(BITVECP sign, TRGM * a) +makesign(BITVECP sign, TRGM *a) { int4 k, len = ARRNELEM(a); @@ -164,33 +164,34 @@ gtrgm_consistent(PG_FUNCTION_ARGS) { GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); text *query = PG_GETARG_TEXT_P(1); + /* StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); */ /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); TRGM *key = (TRGM *) DatumGetPointer(entry->key); TRGM *qtrg; bool res = false; - char *cache = (char*) fcinfo->flinfo->fn_extra; + char *cache = (char *) fcinfo->flinfo->fn_extra; /* All cases served by this function are exact */ *recheck = false; - if ( cache == NULL || VARSIZE(cache) != VARSIZE(query) || memcmp( cache, query, VARSIZE(query) ) !=0 ) + if (cache == NULL || VARSIZE(cache) != VARSIZE(query) || memcmp(cache, query, VARSIZE(query)) != 0) { - qtrg = generate_trgm(VARDATA(query), VARSIZE(query) - VARHDRSZ); + qtrg = generate_trgm(VARDATA(query), VARSIZE(query) - VARHDRSZ); if (cache) pfree(cache); fcinfo->flinfo->fn_extra = MemoryContextAlloc(fcinfo->flinfo->fn_mcxt, - MAXALIGN(VARSIZE(query)) + VARSIZE(qtrg) ); - cache = (char*) fcinfo->flinfo->fn_extra; + MAXALIGN(VARSIZE(query)) + VARSIZE(qtrg)); + cache = (char *) fcinfo->flinfo->fn_extra; - memcpy( cache, query, VARSIZE(query) ); - memcpy( cache + MAXALIGN(VARSIZE(query)), qtrg, VARSIZE(qtrg) ); + memcpy(cache, query, VARSIZE(query)); + memcpy(cache + MAXALIGN(VARSIZE(query)), qtrg, VARSIZE(qtrg)); } - qtrg = (TRGM*)( cache + MAXALIGN(VARSIZE(query)) ); + qtrg = (TRGM *) (cache + MAXALIGN(VARSIZE(query))); if (GIST_LEAF(entry)) { /* all leafs contains orig trgm */ @@ -228,7 +229,7 @@ gtrgm_consistent(PG_FUNCTION_ARGS) } static int4 -unionkey(BITVECP sbase, TRGM * add) +unionkey(BITVECP sbase, TRGM *add) { int4 i; @@ -375,7 +376,7 @@ hemdistsign(BITVECP a, BITVECP b) } static int -hemdist(TRGM * a, TRGM * b) +hemdist(TRGM *a, TRGM *b) { if (ISALLTRUE(a)) { @@ -425,7 +426,7 @@ typedef struct } CACHESIGN; static void -fillcache(CACHESIGN *item, TRGM * key) +fillcache(CACHESIGN *item, TRGM *key) { item->allistrue = false; if (ISARRKEY(key)) diff --git a/contrib/pg_trgm/trgm_op.c b/contrib/pg_trgm/trgm_op.c index 3d2df22111..19b6747d68 100644 --- a/contrib/pg_trgm/trgm_op.c +++ b/contrib/pg_trgm/trgm_op.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/pg_trgm/trgm_op.c,v 1.11 2008/11/12 13:43:54 teodor Exp $ + * $PostgreSQL: pgsql/contrib/pg_trgm/trgm_op.c,v 1.12 2009/06/11 14:48:51 momjian Exp $ */ #include "trgm.h" #include <ctype.h> @@ -39,7 +39,7 @@ comp_trgm(const void *a, const void *b) } static int -unique_array(trgm * a, int len) +unique_array(trgm *a, int len) { trgm *curend, *tmp; @@ -59,7 +59,7 @@ unique_array(trgm * a, int len) } #ifdef KEEPONLYALNUM -#define iswordchr(c) (t_isalpha(c) || t_isdigit(c)) +#define iswordchr(c) (t_isalpha(c) || t_isdigit(c)) #else #define iswordchr(c) (!t_isspace(c)) #endif @@ -68,12 +68,12 @@ unique_array(trgm * a, int len) * Finds first word in string, returns pointer to the word, * endword points to the character after word */ -static char* -find_word(char *str, int lenstr, char **endword, int *charlen) +static char * +find_word(char *str, int lenstr, char **endword, int *charlen) { - char *beginword = str; + char *beginword = str; - while( beginword - str < lenstr && !iswordchr(beginword) ) + while (beginword - str < lenstr && !iswordchr(beginword)) beginword += pg_mblen(beginword); if (beginword - str >= lenstr) @@ -81,7 +81,7 @@ find_word(char *str, int lenstr, char **endword, int *charlen) *endword = beginword; *charlen = 0; - while( *endword - str < lenstr && iswordchr(*endword) ) + while (*endword - str < lenstr && iswordchr(*endword)) { *endword += pg_mblen(*endword); (*charlen)++; @@ -92,11 +92,11 @@ find_word(char *str, int lenstr, char **endword, int *charlen) #ifdef USE_WIDE_UPPER_LOWER static void -cnt_trigram(trgm *tptr, char *str, int bytelen) +cnt_trigram(trgm *tptr, char *str, int bytelen) { - if ( bytelen == 3 ) + if (bytelen == 3) { - CPTRGM(tptr, str); + CPTRGM(tptr, str); } else { @@ -107,8 +107,7 @@ cnt_trigram(trgm *tptr, char *str, int bytelen) FIN_CRC32(crc); /* - * use only 3 upper bytes from crc, hope, it's - * good enough hashing + * use only 3 upper bytes from crc, hope, it's good enough hashing */ CPTRGM(tptr, &crc); } @@ -118,37 +117,37 @@ cnt_trigram(trgm *tptr, char *str, int bytelen) /* * Adds trigramm from words (already padded). */ -static trgm* -make_trigrams( trgm *tptr, char *str, int bytelen, int charlen ) +static trgm * +make_trigrams(trgm *tptr, char *str, int bytelen, int charlen) { - char *ptr = str; + char *ptr = str; - if ( charlen < 3 ) + if (charlen < 3) return tptr; #ifdef USE_WIDE_UPPER_LOWER if (pg_database_encoding_max_length() > 1) { - int lenfirst = pg_mblen(str), - lenmiddle = pg_mblen(str + lenfirst), - lenlast = pg_mblen(str + lenfirst + lenmiddle); + int lenfirst = pg_mblen(str), + lenmiddle = pg_mblen(str + lenfirst), + lenlast = pg_mblen(str + lenfirst + lenmiddle); - while( (ptr - str) + lenfirst + lenmiddle + lenlast <= bytelen ) + while ((ptr - str) + lenfirst + lenmiddle + lenlast <= bytelen) { cnt_trigram(tptr, ptr, lenfirst + lenmiddle + lenlast); ptr += lenfirst; tptr++; - lenfirst = lenmiddle; - lenmiddle = lenlast; - lenlast = pg_mblen(ptr + lenfirst + lenmiddle); + lenfirst = lenmiddle; + lenmiddle = lenlast; + lenlast = pg_mblen(ptr + lenfirst + lenmiddle); } } else #endif { - Assert( bytelen == charlen ); + Assert(bytelen == charlen); while (ptr - str < bytelen - 2 /* number of trigrams = strlen - 2 */ ) { @@ -157,7 +156,7 @@ make_trigrams( trgm *tptr, char *str, int bytelen, int charlen ) tptr++; } } - + return tptr; } @@ -170,9 +169,10 @@ generate_trgm(char *str, int slen) int len, charlen, bytelen; - char *bword, *eword; + char *bword, + *eword; - trg = (TRGM *) palloc(TRGMHDRSIZE + sizeof(trgm) * (slen / 2 + 1) * 3); + trg = (TRGM *) palloc(TRGMHDRSIZE + sizeof(trgm) * (slen / 2 + 1) *3); trg->flag = ARRKEY; SET_VARSIZE(trg, TRGMHDRSIZE); @@ -191,7 +191,7 @@ generate_trgm(char *str, int slen) } eword = str; - while( (bword=find_word(eword, slen - (eword-str), &eword, &charlen)) != NULL ) + while ((bword = find_word(eword, slen - (eword - str), &eword, &charlen)) != NULL) { #ifdef IGNORECASE bword = lowerstr_with_len(bword, eword - bword); @@ -205,14 +205,14 @@ generate_trgm(char *str, int slen) #ifdef IGNORECASE pfree(bword); #endif - buf[LPADDING+bytelen] = ' '; - buf[LPADDING+bytelen+1] = ' '; + buf[LPADDING + bytelen] = ' '; + buf[LPADDING + bytelen + 1] = ' '; /* * count trigrams */ - tptr = make_trigrams( tptr, buf, bytelen + LPADDING + RPADDING, - charlen + LPADDING + RPADDING ); + tptr = make_trigrams(tptr, buf, bytelen + LPADDING + RPADDING, + charlen + LPADDING + RPADDING); } pfree(buf); @@ -234,13 +234,13 @@ generate_trgm(char *str, int slen) uint32 trgm2int(trgm *ptr) { - uint32 val = 0; + uint32 val = 0; - val |= *( ((unsigned char*)ptr) ); + val |= *(((unsigned char *) ptr)); val <<= 8; - val |= *( ((unsigned char*)ptr) + 1 ); + val |= *(((unsigned char *) ptr) + 1); val <<= 8; - val |= *( ((unsigned char*)ptr) + 2 ); + val |= *(((unsigned char *) ptr) + 2); return val; } @@ -262,9 +262,9 @@ show_trgm(PG_FUNCTION_ARGS) for (i = 0, ptr = GETARR(trg); i < ARRNELEM(trg); i++, ptr++) { - text *item = (text *) palloc(VARHDRSZ + Max(12, pg_database_encoding_max_length()*3) ); + text *item = (text *) palloc(VARHDRSZ + Max(12, pg_database_encoding_max_length() * 3)); - if ( pg_database_encoding_max_length() > 1 && !ISPRINTABLETRGM(ptr) ) + if (pg_database_encoding_max_length() > 1 && !ISPRINTABLETRGM(ptr)) { snprintf(VARDATA(item), 12, "0x%06x", trgm2int(ptr)); SET_VARSIZE(item, VARHDRSZ + strlen(VARDATA(item))); @@ -297,7 +297,7 @@ show_trgm(PG_FUNCTION_ARGS) } float4 -cnt_sml(TRGM * trg1, TRGM * trg2) +cnt_sml(TRGM *trg1, TRGM *trg2) { trgm *ptr1, *ptr2; diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c index 6fd7509b0f..85b12b6eca 100644 --- a/contrib/pgbench/pgbench.c +++ b/contrib/pgbench/pgbench.c @@ -4,7 +4,7 @@ * A simple benchmark program for PostgreSQL * Originally written by Tatsuo Ishii and enhanced by many contributors. * - * $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.86 2009/05/07 22:01:18 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.87 2009/06/11 14:48:51 momjian Exp $ * Copyright (c) 2000-2009, PostgreSQL Global Development Group * ALL RIGHTS RESERVED; * @@ -110,14 +110,14 @@ char *pgtty = NULL; char *login = NULL; char *dbName; -volatile bool timer_exceeded = false; /* flag from signal handler */ +volatile bool timer_exceeded = false; /* flag from signal handler */ /* variable definitions */ typedef struct { char *name; /* variable name */ char *value; /* its value */ -} Variable; +} Variable; #define MAX_FILES 128 /* max number of SQL script files allowed */ @@ -141,7 +141,7 @@ typedef struct struct timeval txn_begin; /* used for measuring latencies */ int use_file; /* index in sql_files for this client */ bool prepared[MAX_FILES]; -} CState; +} CState; /* * queries read from files @@ -152,21 +152,21 @@ typedef struct typedef enum QueryMode { - QUERY_SIMPLE, /* simple query */ - QUERY_EXTENDED, /* extended query */ - QUERY_PREPARED, /* extended query with prepared statements */ + QUERY_SIMPLE, /* simple query */ + QUERY_EXTENDED, /* extended query */ + QUERY_PREPARED, /* extended query with prepared statements */ NUM_QUERYMODE } QueryMode; -static QueryMode querymode = QUERY_SIMPLE; -static const char *QUERYMODE[] = { "simple", "extended", "prepared" }; +static QueryMode querymode = QUERY_SIMPLE; +static const char *QUERYMODE[] = {"simple", "extended", "prepared"}; typedef struct { int type; /* command type (SQL_COMMAND or META_COMMAND) */ int argc; /* number of commands */ char *argv[MAX_ARGS]; /* command list */ -} Command; +} Command; Command **sql_files[MAX_FILES]; /* SQL script files */ int num_files; /* number of script files */ @@ -221,10 +221,11 @@ static void setalarm(int seconds); /* Calculate total time */ static void -addTime(struct timeval *t1, struct timeval *t2, struct timeval *result) +addTime(struct timeval * t1, struct timeval * t2, struct timeval * result) { - int sec = t1->tv_sec + t2->tv_sec; - int usec = t1->tv_usec + t2->tv_usec; + int sec = t1->tv_sec + t2->tv_sec; + int usec = t1->tv_usec + t2->tv_usec; + if (usec >= 1000000) { usec -= 1000000; @@ -236,10 +237,11 @@ addTime(struct timeval *t1, struct timeval *t2, struct timeval *result) /* Calculate time difference */ static void -diffTime(struct timeval *t1, struct timeval *t2, struct timeval *result) +diffTime(struct timeval * t1, struct timeval * t2, struct timeval * result) { - int sec = t1->tv_sec - t2->tv_sec; - int usec = t1->tv_usec - t2->tv_usec; + int sec = t1->tv_sec - t2->tv_sec; + int usec = t1->tv_usec - t2->tv_usec; + if (usec < 0) { usec += 1000000; @@ -260,7 +262,7 @@ usage(const char *progname) " -F NUM fill factor\n" " -s NUM scaling factor\n" "\nBenchmarking options:\n" - " -c NUM number of concurrent database clients (default: 1)\n" + " -c NUM number of concurrent database clients (default: 1)\n" " -C establish new connection for each transaction\n" " -D VARNAME=VALUE\n" " define variable for use by custom script\n" @@ -272,7 +274,7 @@ usage(const char *progname) " -N do not update tables \"pgbench_tellers\" and \"pgbench_branches\"\n" " -s NUM report this scale factor in output\n" " -S perform SELECT-only transactions\n" - " -t NUM number of transactions each client runs (default: 10)\n" + " -t NUM number of transactions each client runs (default: 10)\n" " -T NUM duration of benchmark test in seconds\n" " -v vacuum all four standard tables before tests\n" "\nCommon options:\n" @@ -362,7 +364,7 @@ doConnect(void) /* throw away response from backend */ static void -discard_response(CState * state) +discard_response(CState *state) { PGresult *res; @@ -376,7 +378,7 @@ discard_response(CState * state) /* check to see if the SQL result was good */ static int -check(CState * state, PGresult *res, int n) +check(CState *state, PGresult *res, int n) { CState *st = &state[n]; @@ -405,7 +407,7 @@ compareVariables(const void *v1, const void *v2) } static char * -getVariable(CState * st, char *name) +getVariable(CState *st, char *name) { Variable key, *var; @@ -427,7 +429,7 @@ getVariable(CState * st, char *name) } static int -putVariable(CState * st, char *name, char *value) +putVariable(CState *st, char *name, char *value) { Variable key, *var; @@ -493,8 +495,8 @@ putVariable(CState * st, char *name, char *value) static char * parseVariable(const char *sql, int *eaten) { - int i = 0; - char *name; + int i = 0; + char *name; do { @@ -516,12 +518,12 @@ parseVariable(const char *sql, int *eaten) static char * replaceVariable(char **sql, char *param, int len, char *value) { - int valueln = strlen(value); + int valueln = strlen(value); if (valueln > len) { - char *tmp; - size_t offset = param - *sql; + char *tmp; + size_t offset = param - *sql; tmp = realloc(*sql, strlen(*sql) - len + valueln + 1); if (tmp == NULL) @@ -541,7 +543,7 @@ replaceVariable(char **sql, char *param, int len, char *value) } static char * -assignVariables(CState * st, char *sql) +assignVariables(CState *st, char *sql) { char *p, *name, @@ -550,12 +552,15 @@ assignVariables(CState * st, char *sql) p = sql; while ((p = strchr(p, ':')) != NULL) { - int eaten; + int eaten; name = parseVariable(p, &eaten); if (name == NULL) { - while (*p == ':') { p++; } + while (*p == ':') + { + p++; + } continue; } @@ -577,10 +582,10 @@ assignVariables(CState * st, char *sql) static void getQueryParams(CState *st, const Command *command, const char **params) { - int i; + int i; for (i = 0; i < command->argc - 1; i++) - params[i] = getVariable(st, command->argv[i+1]); + params[i] = getVariable(st, command->argv[i + 1]); } #define MAX_PREPARE_NAME 32 @@ -591,7 +596,7 @@ preparedStatementName(char *buffer, int file, int state) } static void -doCustom(CState * state, int n, int debug) +doCustom(CState *state, int n, int debug) { PGresult *res; CState *st = &state[n]; @@ -694,7 +699,9 @@ top: if (st->con == NULL) { - struct timeval t1, t2, t3; + struct timeval t1, + t2, + t3; gettimeofday(&t1, NULL); if ((st->con = doConnect()) == NULL) @@ -716,8 +723,8 @@ top: if (commands[st->state]->type == SQL_COMMAND) { - const Command *command = commands[st->state]; - int r; + const Command *command = commands[st->state]; + int r; if (querymode == QUERY_SIMPLE) { @@ -738,15 +745,15 @@ top: } else if (querymode == QUERY_EXTENDED) { - const char *sql = command->argv[0]; - const char *params[MAX_ARGS]; + const char *sql = command->argv[0]; + const char *params[MAX_ARGS]; getQueryParams(st, command, params); if (debug) fprintf(stderr, "client %d sending %s\n", n, sql); r = PQsendQueryParams(st->con, sql, command->argc - 1, - NULL, params, NULL, NULL, 0); + NULL, params, NULL, NULL, 0); } else if (querymode == QUERY_PREPARED) { @@ -755,7 +762,7 @@ top: if (!st->prepared[st->use_file]) { - int j; + int j; for (j = 0; commands[j] != NULL; j++) { @@ -766,7 +773,7 @@ top: continue; preparedStatementName(name, st->use_file, j); res = PQprepare(st->con, name, - commands[j]->argv[0], commands[j]->argc - 1, NULL); + commands[j]->argv[0], commands[j]->argc - 1, NULL); if (PQresultStatus(res) != PGRES_COMMAND_OK) fprintf(stderr, "%s", PQerrorMessage(st->con)); PQclear(res); @@ -780,9 +787,9 @@ top: if (debug) fprintf(stderr, "client %d sending %s\n", n, name); r = PQsendQueryPrepared(st->con, name, command->argc - 1, - params, NULL, NULL, 0); + params, NULL, NULL, 0); } - else /* unknown sql mode */ + else /* unknown sql mode */ r = 0; if (r == 0) @@ -984,7 +991,7 @@ top: /* discard connections */ static void -disconnect_all(CState * state) +disconnect_all(CState *state) { int i; @@ -1002,12 +1009,11 @@ init(void) /* * Note: TPC-B requires at least 100 bytes per row, and the "filler" * fields in these table declarations were intended to comply with that. - * But because they default to NULLs, they don't actually take any - * space. We could fix that by giving them non-null default values. - * However, that would completely break comparability of pgbench - * results with prior versions. Since pgbench has never pretended - * to be fully TPC-B compliant anyway, we stick with the historical - * behavior. + * But because they default to NULLs, they don't actually take any space. + * We could fix that by giving them non-null default values. However, that + * would completely break comparability of pgbench results with prior + * versions. Since pgbench has never pretended to be fully TPC-B + * compliant anyway, we stick with the historical behavior. */ static char *DDLs[] = { "drop table if exists pgbench_branches", @@ -1146,14 +1152,17 @@ parseQuery(Command *cmd, const char *raw_sql) p = sql; while ((p = strchr(p, ':')) != NULL) { - char var[12]; - char *name; - int eaten; + char var[12]; + char *name; + int eaten; name = parseVariable(p, &eaten); if (name == NULL) { - while (*p == ':') { p++; } + while (*p == ':') + { + p++; + } continue; } @@ -1442,7 +1451,7 @@ process_builtin(char *tb) /* print out results */ static void printResults( - int ttype, CState * state, + int ttype, CState *state, struct timeval * start_time, struct timeval * end_time) { double t1, @@ -1506,8 +1515,8 @@ main(int argc, char **argv) CState *state; /* status of clients */ - struct timeval start_time; /* start up time */ - struct timeval end_time; /* end time */ + struct timeval start_time; /* start up time */ + struct timeval end_time; /* end time */ int i; @@ -1787,10 +1796,10 @@ main(int argc, char **argv) { if (duration <= 0) printf("pghost: %s pgport: %s nclients: %d nxacts: %d dbName: %s\n", - pghost, pgport, nclients, nxacts, dbName); + pghost, pgport, nclients, nxacts, dbName); else printf("pghost: %s pgport: %s nclients: %d duration: %d dbName: %s\n", - pghost, pgport, nclients, duration, dbName); + pghost, pgport, nclients, duration, dbName); } /* opening connection... */ @@ -1828,7 +1837,7 @@ main(int argc, char **argv) /* warn if we override user-given -s switch */ if (scale_given) fprintf(stderr, - "Scale option ignored, using pgbench_branches table count = %d\n", + "Scale option ignored, using pgbench_branches table count = %d\n", scale); } @@ -1879,7 +1888,8 @@ main(int argc, char **argv) if (is_connect == 0) { - struct timeval t, now; + struct timeval t, + now; /* make connections to the database */ for (i = 0; i < nclients; i++) @@ -1972,7 +1982,8 @@ main(int argc, char **argv) if (this_usec > 0 && (min_usec == 0 || this_usec < min_usec)) min_usec = this_usec; - FD_SET(sock, &input_mask); + FD_SET (sock, &input_mask); + if (maxsock < sock) maxsock = sock; } @@ -1985,7 +1996,8 @@ main(int argc, char **argv) disconnect_all(state); exit(1); } - FD_SET(sock, &input_mask); + FD_SET (sock, &input_mask); + if (maxsock < sock) maxsock = sock; } @@ -2069,8 +2081,7 @@ setalarm(int seconds) pqsignal(SIGALRM, handle_sig_alarm); alarm(seconds); } - -#else /* WIN32 */ +#else /* WIN32 */ static VOID CALLBACK win32_timer_callback(PVOID lpParameter, BOOLEAN TimerOrWaitFired) @@ -2081,12 +2092,12 @@ win32_timer_callback(PVOID lpParameter, BOOLEAN TimerOrWaitFired) static void setalarm(int seconds) { - HANDLE queue; - HANDLE timer; + HANDLE queue; + HANDLE timer; /* This function will be called at most once, so we can cheat a bit. */ queue = CreateTimerQueue(); - if (seconds > ((DWORD)-1) / 1000 || + if (seconds > ((DWORD) -1) / 1000 || !CreateTimerQueueTimer(&timer, queue, win32_timer_callback, NULL, seconds * 1000, 0, WT_EXECUTEINTIMERTHREAD | WT_EXECUTEONLYONCE)) @@ -2096,4 +2107,4 @@ setalarm(int seconds) } } -#endif /* WIN32 */ +#endif /* WIN32 */ diff --git a/contrib/pgcrypto/blf.c b/contrib/pgcrypto/blf.c index 7138ffa903..e03c542c0d 100644 --- a/contrib/pgcrypto/blf.c +++ b/contrib/pgcrypto/blf.c @@ -1,7 +1,7 @@ /* * Butchered version of sshblowf.c from putty-0.59. * - * $PostgreSQL: pgsql/contrib/pgcrypto/blf.c,v 1.9 2007/11/15 21:14:31 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/blf.c,v 1.10 2009/06/11 14:48:52 momjian Exp $ */ /* @@ -251,7 +251,7 @@ static const uint32 sbox3[] = { static void blowfish_encrypt(uint32 xL, uint32 xR, uint32 *output, - BlowfishContext * ctx) + BlowfishContext *ctx) { uint32 *S0 = ctx->S0; uint32 *S1 = ctx->S1; @@ -285,7 +285,7 @@ blowfish_encrypt(uint32 xL, uint32 xR, uint32 *output, static void blowfish_decrypt(uint32 xL, uint32 xR, uint32 *output, - BlowfishContext * ctx) + BlowfishContext *ctx) { uint32 *S0 = ctx->S0; uint32 *S1 = ctx->S1; @@ -318,7 +318,7 @@ blowfish_decrypt(uint32 xL, uint32 xR, uint32 *output, } void -blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext * ctx) +blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx) { uint32 xL, xR, @@ -351,7 +351,7 @@ blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext * ctx) } void -blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext * ctx) +blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx) { uint32 xL, xR, @@ -384,7 +384,7 @@ blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext * ctx) } void -blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext * ctx) +blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx) { uint32 xL, xR, @@ -405,7 +405,7 @@ blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext * ctx) } void -blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext * ctx) +blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx) { uint32 xL, xR, @@ -426,7 +426,7 @@ blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext * ctx) } void -blowfish_setkey(BlowfishContext * ctx, +blowfish_setkey(BlowfishContext *ctx, const uint8 *key, short keybytes) { uint32 *S0 = ctx->S0; @@ -492,7 +492,7 @@ blowfish_setkey(BlowfishContext * ctx, } void -blowfish_setiv(BlowfishContext * ctx, const uint8 *iv) +blowfish_setiv(BlowfishContext *ctx, const uint8 *iv) { ctx->iv0 = GET_32BIT_MSB_FIRST(iv); ctx->iv1 = GET_32BIT_MSB_FIRST(iv + 4); diff --git a/contrib/pgcrypto/blf.h b/contrib/pgcrypto/blf.h index 6e280d8754..507d7f9055 100644 --- a/contrib/pgcrypto/blf.h +++ b/contrib/pgcrypto/blf.h @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/contrib/pgcrypto/blf.h,v 1.7 2007/11/15 21:14:31 momjian Exp $ */ +/* $PostgreSQL: pgsql/contrib/pgcrypto/blf.h,v 1.8 2009/06/11 14:48:52 momjian Exp $ */ /* * PuTTY is copyright 1997-2007 Simon Tatham. * @@ -36,11 +36,11 @@ typedef struct P[18]; uint32 iv0, iv1; /* for CBC mode */ -} BlowfishContext; +} BlowfishContext; -void blowfish_setkey(BlowfishContext * ctx, const uint8 *key, short keybytes); -void blowfish_setiv(BlowfishContext * ctx, const uint8 *iv); -void blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext * ctx); -void blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext * ctx); -void blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext * ctx); -void blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext * ctx); +void blowfish_setkey(BlowfishContext *ctx, const uint8 *key, short keybytes); +void blowfish_setiv(BlowfishContext *ctx, const uint8 *iv); +void blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx); +void blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx); +void blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx); +void blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx); diff --git a/contrib/pgcrypto/crypt-blowfish.c b/contrib/pgcrypto/crypt-blowfish.c index 84b4d758af..9c1d2d4706 100644 --- a/contrib/pgcrypto/crypt-blowfish.c +++ b/contrib/pgcrypto/crypt-blowfish.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/pgcrypto/crypt-blowfish.c,v 1.13 2007/11/15 21:14:31 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/crypt-blowfish.c,v 1.14 2009/06/11 14:48:52 momjian Exp $ * * This code comes from John the Ripper password cracker, with reentrant * and crypt(3) interfaces added, but optimizations specific to password @@ -59,7 +59,7 @@ typedef struct { BF_word S[4][0x100]; BF_key P; -} BF_ctx; +} BF_ctx; /* * Magic IV for 64 Blowfish encryptions that we do at the end. @@ -367,7 +367,7 @@ do { \ } while (0) static int -BF_decode(BF_word * dst, const char *src, int size) +BF_decode(BF_word *dst, const char *src, int size) { unsigned char *dptr = (unsigned char *) dst; unsigned char *end = dptr + size; @@ -399,7 +399,7 @@ BF_decode(BF_word * dst, const char *src, int size) } static void -BF_encode(char *dst, const BF_word * src, int size) +BF_encode(char *dst, const BF_word *src, int size) { unsigned char *sptr = (unsigned char *) src; unsigned char *end = sptr + size; @@ -436,7 +436,7 @@ BF_encode(char *dst, const BF_word * src, int size) } static void -BF_swap(BF_word * x, int count) +BF_swap(BF_word *x, int count) { /* Swap on little-endian hardware, else do nothing */ #ifndef WORDS_BIGENDIAN @@ -518,7 +518,7 @@ BF_swap(BF_word * x, int count) #if BF_ASM -extern void _BF_body_r(BF_ctx * ctx); +extern void _BF_body_r(BF_ctx *ctx); #define BF_body() \ _BF_body_r(&data.ctx); diff --git a/contrib/pgcrypto/crypt-gensalt.c b/contrib/pgcrypto/crypt-gensalt.c index c3ec01b900..b2ec3da828 100644 --- a/contrib/pgcrypto/crypt-gensalt.c +++ b/contrib/pgcrypto/crypt-gensalt.c @@ -2,7 +2,7 @@ * Written by Solar Designer and placed in the public domain. * See crypt_blowfish.c for more information. * - * $PostgreSQL: pgsql/contrib/pgcrypto/crypt-gensalt.c,v 1.10 2006/10/04 00:29:46 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/crypt-gensalt.c,v 1.11 2009/06/11 14:48:52 momjian Exp $ * * This file contains salt generation functions for the traditional and * other common crypt(3) algorithms, except for bcrypt which is defined @@ -122,7 +122,7 @@ static unsigned char BF_itoa64[64 + 1] = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; static void -BF_encode(char *dst, const BF_word * src, int size) +BF_encode(char *dst, const BF_word *src, int size) { unsigned char *sptr = (unsigned char *) src; unsigned char *end = sptr + size; diff --git a/contrib/pgcrypto/fortuna.c b/contrib/pgcrypto/fortuna.c index 5a2596fe78..4e97946ab3 100644 --- a/contrib/pgcrypto/fortuna.c +++ b/contrib/pgcrypto/fortuna.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/fortuna.c,v 1.8 2006/10/04 00:29:46 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/fortuna.c,v 1.9 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -176,7 +176,7 @@ md_result(MD_CTX * ctx, uint8 *dst) * initialize state */ static void -init_state(FState * st) +init_state(FState *st) { int i; @@ -190,7 +190,7 @@ init_state(FState * st) * It just needs to change without repeating. */ static void -inc_counter(FState * st) +inc_counter(FState *st) { uint32 *val = (uint32 *) st->counter; @@ -207,7 +207,7 @@ inc_counter(FState * st) * This is called 'cipher in counter mode'. */ static void -encrypt_counter(FState * st, uint8 *dst) +encrypt_counter(FState *st, uint8 *dst) { ciph_encrypt(&st->ciph, st->counter, dst); inc_counter(st); @@ -219,7 +219,7 @@ encrypt_counter(FState * st, uint8 *dst) * microseconds. */ static int -enough_time_passed(FState * st) +enough_time_passed(FState *st) { int ok; struct timeval tv; @@ -252,7 +252,7 @@ enough_time_passed(FState * st) * generate new key from all the pools */ static void -reseed(FState * st) +reseed(FState *st) { unsigned k; unsigned n; @@ -298,7 +298,7 @@ reseed(FState * st) * Pick a random pool. This uses key bytes as random source. */ static unsigned -get_rand_pool(FState * st) +get_rand_pool(FState *st) { unsigned rnd; @@ -318,7 +318,7 @@ get_rand_pool(FState * st) * update pools */ static void -add_entropy(FState * st, const uint8 *data, unsigned len) +add_entropy(FState *st, const uint8 *data, unsigned len) { unsigned pos; uint8 hash[BLOCK]; @@ -349,7 +349,7 @@ add_entropy(FState * st, const uint8 *data, unsigned len) * Just take 2 next blocks as new key */ static void -rekey(FState * st) +rekey(FState *st) { encrypt_counter(st, st->key); encrypt_counter(st, st->key + CIPH_BLOCK); @@ -363,7 +363,7 @@ rekey(FState * st) * entropy over all of the components. */ static void -startup_tricks(FState * st) +startup_tricks(FState *st) { int i; uint8 buf[BLOCK]; @@ -388,7 +388,7 @@ startup_tricks(FState * st) } static void -extract_data(FState * st, unsigned count, uint8 *dst) +extract_data(FState *st, unsigned count, uint8 *dst) { unsigned n; unsigned block_nr = 0; diff --git a/contrib/pgcrypto/imath.c b/contrib/pgcrypto/imath.c index 63b294af24..35dc652d43 100644 --- a/contrib/pgcrypto/imath.c +++ b/contrib/pgcrypto/imath.c @@ -27,7 +27,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $PostgreSQL: pgsql/contrib/pgcrypto/imath.c,v 1.7 2007/07/15 22:43:40 tgl Exp $ */ +/* $PostgreSQL: pgsql/contrib/pgcrypto/imath.c,v 1.8 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" #include "px.h" @@ -195,7 +195,7 @@ static void s_clamp(mp_int z); static void s_fake(mp_int z, int value, mp_digit vbuf[]); /* Compare two runs of digits of given length, returns <0, 0, >0 */ -static int s_cdig(mp_digit * da, mp_digit * db, mp_size len); +static int s_cdig(mp_digit *da, mp_digit *db, mp_size len); /* Pack the unsigned digits of v into array t */ static int s_vpack(int v, mp_digit t[]); @@ -208,26 +208,26 @@ static int s_vcmp(mp_int a, int v); /* Unsigned magnitude addition; assumes dc is big enough. Carry out is returned (no memory allocated). */ -static mp_digit s_uadd(mp_digit * da, mp_digit * db, mp_digit * dc, +static mp_digit s_uadd(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a, mp_size size_b); /* Unsigned magnitude subtraction. Assumes dc is big enough. */ -static void s_usub(mp_digit * da, mp_digit * db, mp_digit * dc, +static void s_usub(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a, mp_size size_b); /* Unsigned recursive multiplication. Assumes dc is big enough. */ -static int s_kmul(mp_digit * da, mp_digit * db, mp_digit * dc, +static int s_kmul(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a, mp_size size_b); /* Unsigned magnitude multiplication. Assumes dc is big enough. */ -static void s_umul(mp_digit * da, mp_digit * db, mp_digit * dc, +static void s_umul(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a, mp_size size_b); /* Unsigned recursive squaring. Assumes dc is big enough. */ -static int s_ksqr(mp_digit * da, mp_digit * dc, mp_size size_a); +static int s_ksqr(mp_digit *da, mp_digit *dc, mp_size size_a); /* Unsigned magnitude squaring. Assumes dc is big enough. */ -static void s_usqr(mp_digit * da, mp_digit * dc, mp_size size_a); +static void s_usqr(mp_digit *da, mp_digit *dc, mp_size size_a); /* Single digit addition. Assumes a is big enough. */ static void s_dadd(mp_int a, mp_digit b); @@ -236,7 +236,7 @@ static void s_dadd(mp_int a, mp_digit b); static void s_dmul(mp_int a, mp_digit b); /* Single digit multiplication on buffers; assumes dc is big enough. */ -static void s_dbmul(mp_digit * da, mp_digit b, mp_digit * dc, +static void s_dbmul(mp_digit *da, mp_digit b, mp_digit *dc, mp_size size_a); /* Single digit division. Replaces a with the quotient, @@ -310,7 +310,7 @@ static mp_result s_tobin(mp_int z, unsigned char *buf, int *limpos, int pad); #if 0 /* Dump a representation of the mp_int to standard output */ void s_print(char *tag, mp_int z); -void s_print_buf(char *tag, mp_digit * buf, mp_size num); +void s_print_buf(char *tag, mp_digit *buf, mp_size num); #endif /* {{{ get_default_precision() */ @@ -2294,7 +2294,7 @@ s_alloc(mp_size num) /* {{{ s_realloc(old, num) */ static mp_digit * -s_realloc(mp_digit * old, mp_size num) +s_realloc(mp_digit *old, mp_size num) { mp_digit *new = px_realloc(old, num * sizeof(mp_digit)); @@ -2375,7 +2375,7 @@ s_fake(mp_int z, int value, mp_digit vbuf[]) /* {{{ s_cdig(da, db, len) */ static int -s_cdig(mp_digit * da, mp_digit * db, mp_size len) +s_cdig(mp_digit *da, mp_digit *db, mp_size len) { mp_digit *dat = da + len - 1, *dbt = db + len - 1; @@ -2460,7 +2460,7 @@ s_vcmp(mp_int a, int v) /* {{{ s_uadd(da, db, dc, size_a, size_b) */ static mp_digit -s_uadd(mp_digit * da, mp_digit * db, mp_digit * dc, +s_uadd(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a, mp_size size_b) { mp_size pos; @@ -2476,7 +2476,7 @@ s_uadd(mp_digit * da, mp_digit * db, mp_digit * dc, /* Add corresponding digits until the shorter number runs out */ for (pos = 0; pos < size_b; ++pos, ++da, ++db, ++dc) { - w = w + (mp_word) * da + (mp_word) * db; + w = w + (mp_word) *da + (mp_word) *db; *dc = LOWER_HALF(w); w = UPPER_HALF(w); } @@ -2499,7 +2499,7 @@ s_uadd(mp_digit * da, mp_digit * db, mp_digit * dc, /* {{{ s_usub(da, db, dc, size_a, size_b) */ static void -s_usub(mp_digit * da, mp_digit * db, mp_digit * dc, +s_usub(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a, mp_size size_b) { mp_size pos; @@ -2512,7 +2512,7 @@ s_usub(mp_digit * da, mp_digit * db, mp_digit * dc, for (pos = 0; pos < size_b; ++pos, ++da, ++db, ++dc) { w = ((mp_word) MP_DIGIT_MAX + 1 + /* MP_RADIX */ - (mp_word) * da) - w - (mp_word) * db; + (mp_word) *da) - w - (mp_word) *db; *dc = LOWER_HALF(w); w = (UPPER_HALF(w) == 0); @@ -2522,7 +2522,7 @@ s_usub(mp_digit * da, mp_digit * db, mp_digit * dc, for ( /* */ ; pos < size_a; ++pos, ++da, ++dc) { w = ((mp_word) MP_DIGIT_MAX + 1 + /* MP_RADIX */ - (mp_word) * da) - w; + (mp_word) *da) - w; *dc = LOWER_HALF(w); w = (UPPER_HALF(w) == 0); @@ -2537,7 +2537,7 @@ s_usub(mp_digit * da, mp_digit * db, mp_digit * dc, /* {{{ s_kmul(da, db, dc, size_a, size_b) */ static int -s_kmul(mp_digit * da, mp_digit * db, mp_digit * dc, +s_kmul(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a, mp_size size_b) { mp_size bot_size; @@ -2638,7 +2638,7 @@ s_kmul(mp_digit * da, mp_digit * db, mp_digit * dc, /* {{{ s_umul(da, db, dc, size_a, size_b) */ static void -s_umul(mp_digit * da, mp_digit * db, mp_digit * dc, +s_umul(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a, mp_size size_b) { mp_size a, @@ -2656,7 +2656,7 @@ s_umul(mp_digit * da, mp_digit * db, mp_digit * dc, w = 0; for (b = 0; b < size_b; ++b, ++dbt, ++dct) { - w = (mp_word) * da * (mp_word) * dbt + w + (mp_word) * dct; + w = (mp_word) *da * (mp_word) *dbt + w + (mp_word) *dct; *dct = LOWER_HALF(w); w = UPPER_HALF(w); @@ -2671,7 +2671,7 @@ s_umul(mp_digit * da, mp_digit * db, mp_digit * dc, /* {{{ s_ksqr(da, dc, size_a) */ static int -s_ksqr(mp_digit * da, mp_digit * dc, mp_size size_a) +s_ksqr(mp_digit *da, mp_digit *dc, mp_size size_a) { if (multiply_threshold && size_a > multiply_threshold) { @@ -2736,7 +2736,7 @@ s_ksqr(mp_digit * da, mp_digit * dc, mp_size size_a) /* {{{ s_usqr(da, dc, size_a) */ static void -s_usqr(mp_digit * da, mp_digit * dc, mp_size size_a) +s_usqr(mp_digit *da, mp_digit *dc, mp_size size_a) { mp_size i, j; @@ -2751,7 +2751,7 @@ s_usqr(mp_digit * da, mp_digit * dc, mp_size size_a) continue; /* Take care of the first digit, no rollover */ - w = (mp_word) * dat * (mp_word) * dat + (mp_word) * dct; + w = (mp_word) *dat * (mp_word) *dat + (mp_word) *dct; *dct = LOWER_HALF(w); w = UPPER_HALF(w); ++dat; @@ -2759,8 +2759,8 @@ s_usqr(mp_digit * da, mp_digit * dc, mp_size size_a) for (j = i + 1; j < size_a; ++j, ++dat, ++dct) { - mp_word t = (mp_word) * da * (mp_word) * dat; - mp_word u = w + (mp_word) * dct, + mp_word t = (mp_word) *da * (mp_word) *dat; + mp_word u = w + (mp_word) *dct, ov = 0; /* Check if doubling t will overflow a word */ @@ -2808,13 +2808,13 @@ s_dadd(mp_int a, mp_digit b) mp_digit *da = MP_DIGITS(a); mp_size ua = MP_USED(a); - w = (mp_word) * da + b; + w = (mp_word) *da + b; *da++ = LOWER_HALF(w); w = UPPER_HALF(w); for (ua -= 1; ua > 0; --ua, ++da) { - w = (mp_word) * da + w; + w = (mp_word) *da + w; *da = LOWER_HALF(w); w = UPPER_HALF(w); @@ -2840,7 +2840,7 @@ s_dmul(mp_int a, mp_digit b) while (ua > 0) { - w = (mp_word) * da * b + w; + w = (mp_word) *da * b + w; *da++ = LOWER_HALF(w); w = UPPER_HALF(w); --ua; @@ -2858,13 +2858,13 @@ s_dmul(mp_int a, mp_digit b) /* {{{ s_dbmul(da, b, dc, size_a) */ static void -s_dbmul(mp_digit * da, mp_digit b, mp_digit * dc, mp_size size_a) +s_dbmul(mp_digit *da, mp_digit b, mp_digit *dc, mp_size size_a) { mp_word w = 0; while (size_a > 0) { - w = (mp_word) * da++ * (mp_word) b + w; + w = (mp_word) *da++ * (mp_word) b + w; *dc++ = LOWER_HALF(w); w = UPPER_HALF(w); @@ -3085,13 +3085,13 @@ s_qsub(mp_int z, mp_size p2) for (pos = 0, zp = MP_DIGITS(z); pos < tdig; ++pos, ++zp) { - w = ((mp_word) MP_DIGIT_MAX + 1) - w - (mp_word) * zp; + w = ((mp_word) MP_DIGIT_MAX + 1) - w - (mp_word) *zp; *zp = LOWER_HALF(w); w = UPPER_HALF(w) ? 0 : 1; } - w = ((mp_word) MP_DIGIT_MAX + 1 + hi) - w - (mp_word) * zp; + w = ((mp_word) MP_DIGIT_MAX + 1 + hi) - w - (mp_word) *zp; *zp = LOWER_HALF(w); assert(UPPER_HALF(w) != 0); /* no borrow out should be possible */ @@ -3663,7 +3663,7 @@ s_print(char *tag, mp_int z) } void -s_print_buf(char *tag, mp_digit * buf, mp_size num) +s_print_buf(char *tag, mp_digit *buf, mp_size num) { int i; diff --git a/contrib/pgcrypto/imath.h b/contrib/pgcrypto/imath.h index 5bc335e582..09d0e3e818 100644 --- a/contrib/pgcrypto/imath.h +++ b/contrib/pgcrypto/imath.h @@ -26,7 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $PostgreSQL: pgsql/contrib/pgcrypto/imath.h,v 1.6 2007/11/15 21:14:31 momjian Exp $ */ +/* $PostgreSQL: pgsql/contrib/pgcrypto/imath.h,v 1.7 2009/06/11 14:48:52 momjian Exp $ */ #ifndef IMATH_H_ #define IMATH_H_ @@ -60,7 +60,8 @@ typedef struct mpz mp_size alloc; mp_size used; mp_sign sign; -} mpz_t, *mp_int; +} mpz_t , + *mp_int; #define MP_DIGITS(Z) ((Z)->digits) #define MP_ALLOC(Z) ((Z)->alloc) @@ -117,10 +118,10 @@ mp_result mp_int_mul_pow2(mp_int a, int p2, mp_int c); mp_result mp_int_sqr(mp_int a, mp_int c); /* c = a * a */ mp_result -mp_int_div(mp_int a, mp_int b, /* q = a / b */ +mp_int_div(mp_int a, mp_int b, /* q = a / b */ mp_int q, mp_int r); /* r = a % b */ mp_result -mp_int_div_value(mp_int a, int value, /* q = a / value */ +mp_int_div_value(mp_int a, int value, /* q = a / value */ mp_int q, int *r); /* r = a % value */ mp_result mp_int_div_pow2(mp_int a, int p2, /* q = a / 2^p2 */ @@ -210,7 +211,7 @@ const char *mp_error_string(mp_result res); #if 0 void s_print(char *tag, mp_int z); -void s_print_buf(char *tag, mp_digit * buf, mp_size num); +void s_print_buf(char *tag, mp_digit *buf, mp_size num); #endif #endif /* end IMATH_H_ */ diff --git a/contrib/pgcrypto/internal-sha2.c b/contrib/pgcrypto/internal-sha2.c index d5530c39ed..1e36a369e0 100644 --- a/contrib/pgcrypto/internal-sha2.c +++ b/contrib/pgcrypto/internal-sha2.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/internal-sha2.c,v 1.2 2006/10/04 00:29:46 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/internal-sha2.c,v 1.3 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -36,27 +36,27 @@ #include "px.h" #include "sha2.h" -void init_sha224(PX_MD * h); -void init_sha256(PX_MD * h); -void init_sha384(PX_MD * h); -void init_sha512(PX_MD * h); +void init_sha224(PX_MD *h); +void init_sha256(PX_MD *h); +void init_sha384(PX_MD *h); +void init_sha512(PX_MD *h); /* SHA224 */ static unsigned -int_sha224_len(PX_MD * h) +int_sha224_len(PX_MD *h) { return SHA224_DIGEST_LENGTH; } static unsigned -int_sha224_block_len(PX_MD * h) +int_sha224_block_len(PX_MD *h) { return SHA224_BLOCK_LENGTH; } static void -int_sha224_update(PX_MD * h, const uint8 *data, unsigned dlen) +int_sha224_update(PX_MD *h, const uint8 *data, unsigned dlen) { SHA224_CTX *ctx = (SHA224_CTX *) h->p.ptr; @@ -64,7 +64,7 @@ int_sha224_update(PX_MD * h, const uint8 *data, unsigned dlen) } static void -int_sha224_reset(PX_MD * h) +int_sha224_reset(PX_MD *h) { SHA224_CTX *ctx = (SHA224_CTX *) h->p.ptr; @@ -72,7 +72,7 @@ int_sha224_reset(PX_MD * h) } static void -int_sha224_finish(PX_MD * h, uint8 *dst) +int_sha224_finish(PX_MD *h, uint8 *dst) { SHA224_CTX *ctx = (SHA224_CTX *) h->p.ptr; @@ -80,7 +80,7 @@ int_sha224_finish(PX_MD * h, uint8 *dst) } static void -int_sha224_free(PX_MD * h) +int_sha224_free(PX_MD *h) { SHA224_CTX *ctx = (SHA224_CTX *) h->p.ptr; @@ -92,19 +92,19 @@ int_sha224_free(PX_MD * h) /* SHA256 */ static unsigned -int_sha256_len(PX_MD * h) +int_sha256_len(PX_MD *h) { return SHA256_DIGEST_LENGTH; } static unsigned -int_sha256_block_len(PX_MD * h) +int_sha256_block_len(PX_MD *h) { return SHA256_BLOCK_LENGTH; } static void -int_sha256_update(PX_MD * h, const uint8 *data, unsigned dlen) +int_sha256_update(PX_MD *h, const uint8 *data, unsigned dlen) { SHA256_CTX *ctx = (SHA256_CTX *) h->p.ptr; @@ -112,7 +112,7 @@ int_sha256_update(PX_MD * h, const uint8 *data, unsigned dlen) } static void -int_sha256_reset(PX_MD * h) +int_sha256_reset(PX_MD *h) { SHA256_CTX *ctx = (SHA256_CTX *) h->p.ptr; @@ -120,7 +120,7 @@ int_sha256_reset(PX_MD * h) } static void -int_sha256_finish(PX_MD * h, uint8 *dst) +int_sha256_finish(PX_MD *h, uint8 *dst) { SHA256_CTX *ctx = (SHA256_CTX *) h->p.ptr; @@ -128,7 +128,7 @@ int_sha256_finish(PX_MD * h, uint8 *dst) } static void -int_sha256_free(PX_MD * h) +int_sha256_free(PX_MD *h) { SHA256_CTX *ctx = (SHA256_CTX *) h->p.ptr; @@ -140,19 +140,19 @@ int_sha256_free(PX_MD * h) /* SHA384 */ static unsigned -int_sha384_len(PX_MD * h) +int_sha384_len(PX_MD *h) { return SHA384_DIGEST_LENGTH; } static unsigned -int_sha384_block_len(PX_MD * h) +int_sha384_block_len(PX_MD *h) { return SHA384_BLOCK_LENGTH; } static void -int_sha384_update(PX_MD * h, const uint8 *data, unsigned dlen) +int_sha384_update(PX_MD *h, const uint8 *data, unsigned dlen) { SHA384_CTX *ctx = (SHA384_CTX *) h->p.ptr; @@ -160,7 +160,7 @@ int_sha384_update(PX_MD * h, const uint8 *data, unsigned dlen) } static void -int_sha384_reset(PX_MD * h) +int_sha384_reset(PX_MD *h) { SHA384_CTX *ctx = (SHA384_CTX *) h->p.ptr; @@ -168,7 +168,7 @@ int_sha384_reset(PX_MD * h) } static void -int_sha384_finish(PX_MD * h, uint8 *dst) +int_sha384_finish(PX_MD *h, uint8 *dst) { SHA384_CTX *ctx = (SHA384_CTX *) h->p.ptr; @@ -176,7 +176,7 @@ int_sha384_finish(PX_MD * h, uint8 *dst) } static void -int_sha384_free(PX_MD * h) +int_sha384_free(PX_MD *h) { SHA384_CTX *ctx = (SHA384_CTX *) h->p.ptr; @@ -188,19 +188,19 @@ int_sha384_free(PX_MD * h) /* SHA512 */ static unsigned -int_sha512_len(PX_MD * h) +int_sha512_len(PX_MD *h) { return SHA512_DIGEST_LENGTH; } static unsigned -int_sha512_block_len(PX_MD * h) +int_sha512_block_len(PX_MD *h) { return SHA512_BLOCK_LENGTH; } static void -int_sha512_update(PX_MD * h, const uint8 *data, unsigned dlen) +int_sha512_update(PX_MD *h, const uint8 *data, unsigned dlen) { SHA512_CTX *ctx = (SHA512_CTX *) h->p.ptr; @@ -208,7 +208,7 @@ int_sha512_update(PX_MD * h, const uint8 *data, unsigned dlen) } static void -int_sha512_reset(PX_MD * h) +int_sha512_reset(PX_MD *h) { SHA512_CTX *ctx = (SHA512_CTX *) h->p.ptr; @@ -216,7 +216,7 @@ int_sha512_reset(PX_MD * h) } static void -int_sha512_finish(PX_MD * h, uint8 *dst) +int_sha512_finish(PX_MD *h, uint8 *dst) { SHA512_CTX *ctx = (SHA512_CTX *) h->p.ptr; @@ -224,7 +224,7 @@ int_sha512_finish(PX_MD * h, uint8 *dst) } static void -int_sha512_free(PX_MD * h) +int_sha512_free(PX_MD *h) { SHA512_CTX *ctx = (SHA512_CTX *) h->p.ptr; @@ -236,7 +236,7 @@ int_sha512_free(PX_MD * h) /* init functions */ void -init_sha224(PX_MD * md) +init_sha224(PX_MD *md) { SHA224_CTX *ctx; @@ -256,7 +256,7 @@ init_sha224(PX_MD * md) } void -init_sha256(PX_MD * md) +init_sha256(PX_MD *md) { SHA256_CTX *ctx; @@ -276,7 +276,7 @@ init_sha256(PX_MD * md) } void -init_sha384(PX_MD * md) +init_sha384(PX_MD *md) { SHA384_CTX *ctx; @@ -296,7 +296,7 @@ init_sha384(PX_MD * md) } void -init_sha512(PX_MD * md) +init_sha512(PX_MD *md) { SHA512_CTX *ctx; diff --git a/contrib/pgcrypto/internal.c b/contrib/pgcrypto/internal.c index 56634aa32a..84bda624a4 100644 --- a/contrib/pgcrypto/internal.c +++ b/contrib/pgcrypto/internal.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/internal.c,v 1.28 2008/02/17 02:09:26 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/internal.c,v 1.29 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -75,18 +75,18 @@ #define SHA1_BLOCK_SIZE 64 #define MD5_BLOCK_SIZE 64 -static void init_md5(PX_MD * h); -static void init_sha1(PX_MD * h); +static void init_md5(PX_MD *h); +static void init_sha1(PX_MD *h); -void init_sha224(PX_MD * h); -void init_sha256(PX_MD * h); -void init_sha384(PX_MD * h); -void init_sha512(PX_MD * h); +void init_sha224(PX_MD *h); +void init_sha256(PX_MD *h); +void init_sha384(PX_MD *h); +void init_sha512(PX_MD *h); struct int_digest { char *name; - void (*init) (PX_MD * h); + void (*init) (PX_MD *h); }; static const struct int_digest @@ -103,19 +103,19 @@ static const struct int_digest /* MD5 */ static unsigned -int_md5_len(PX_MD * h) +int_md5_len(PX_MD *h) { return MD5_DIGEST_LENGTH; } static unsigned -int_md5_block_len(PX_MD * h) +int_md5_block_len(PX_MD *h) { return MD5_BLOCK_SIZE; } static void -int_md5_update(PX_MD * h, const uint8 *data, unsigned dlen) +int_md5_update(PX_MD *h, const uint8 *data, unsigned dlen) { MD5_CTX *ctx = (MD5_CTX *) h->p.ptr; @@ -123,7 +123,7 @@ int_md5_update(PX_MD * h, const uint8 *data, unsigned dlen) } static void -int_md5_reset(PX_MD * h) +int_md5_reset(PX_MD *h) { MD5_CTX *ctx = (MD5_CTX *) h->p.ptr; @@ -131,7 +131,7 @@ int_md5_reset(PX_MD * h) } static void -int_md5_finish(PX_MD * h, uint8 *dst) +int_md5_finish(PX_MD *h, uint8 *dst) { MD5_CTX *ctx = (MD5_CTX *) h->p.ptr; @@ -139,7 +139,7 @@ int_md5_finish(PX_MD * h, uint8 *dst) } static void -int_md5_free(PX_MD * h) +int_md5_free(PX_MD *h) { MD5_CTX *ctx = (MD5_CTX *) h->p.ptr; @@ -151,19 +151,19 @@ int_md5_free(PX_MD * h) /* SHA1 */ static unsigned -int_sha1_len(PX_MD * h) +int_sha1_len(PX_MD *h) { return SHA1_DIGEST_LENGTH; } static unsigned -int_sha1_block_len(PX_MD * h) +int_sha1_block_len(PX_MD *h) { return SHA1_BLOCK_SIZE; } static void -int_sha1_update(PX_MD * h, const uint8 *data, unsigned dlen) +int_sha1_update(PX_MD *h, const uint8 *data, unsigned dlen) { SHA1_CTX *ctx = (SHA1_CTX *) h->p.ptr; @@ -171,7 +171,7 @@ int_sha1_update(PX_MD * h, const uint8 *data, unsigned dlen) } static void -int_sha1_reset(PX_MD * h) +int_sha1_reset(PX_MD *h) { SHA1_CTX *ctx = (SHA1_CTX *) h->p.ptr; @@ -179,7 +179,7 @@ int_sha1_reset(PX_MD * h) } static void -int_sha1_finish(PX_MD * h, uint8 *dst) +int_sha1_finish(PX_MD *h, uint8 *dst) { SHA1_CTX *ctx = (SHA1_CTX *) h->p.ptr; @@ -187,7 +187,7 @@ int_sha1_finish(PX_MD * h, uint8 *dst) } static void -int_sha1_free(PX_MD * h) +int_sha1_free(PX_MD *h) { SHA1_CTX *ctx = (SHA1_CTX *) h->p.ptr; @@ -199,7 +199,7 @@ int_sha1_free(PX_MD * h) /* init functions */ static void -init_md5(PX_MD * md) +init_md5(PX_MD *md) { MD5_CTX *ctx; @@ -219,7 +219,7 @@ init_md5(PX_MD * md) } static void -init_sha1(PX_MD * md) +init_sha1(PX_MD *md) { SHA1_CTX *ctx; @@ -260,7 +260,7 @@ struct int_ctx }; static void -intctx_free(PX_Cipher * c) +intctx_free(PX_Cipher *c) { struct int_ctx *cx = (struct int_ctx *) c->ptr; @@ -280,25 +280,25 @@ intctx_free(PX_Cipher * c) #define MODE_CBC 1 static unsigned -rj_block_size(PX_Cipher * c) +rj_block_size(PX_Cipher *c) { return 128 / 8; } static unsigned -rj_key_size(PX_Cipher * c) +rj_key_size(PX_Cipher *c) { return 256 / 8; } static unsigned -rj_iv_size(PX_Cipher * c) +rj_iv_size(PX_Cipher *c) { return 128 / 8; } static int -rj_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) +rj_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) { struct int_ctx *cx = (struct int_ctx *) c->ptr; @@ -327,7 +327,7 @@ rj_real_init(struct int_ctx * cx, int dir) } static int -rj_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +rj_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { struct int_ctx *cx = (struct int_ctx *) c->ptr; @@ -357,7 +357,7 @@ rj_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) } static int -rj_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +rj_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { struct int_ctx *cx = (struct int_ctx *) c->ptr; @@ -418,25 +418,25 @@ rj_load(int mode) */ static unsigned -bf_block_size(PX_Cipher * c) +bf_block_size(PX_Cipher *c) { return 8; } static unsigned -bf_key_size(PX_Cipher * c) +bf_key_size(PX_Cipher *c) { return 448 / 8; } static unsigned -bf_iv_size(PX_Cipher * c) +bf_iv_size(PX_Cipher *c) { return 8; } static int -bf_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) +bf_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) { struct int_ctx *cx = (struct int_ctx *) c->ptr; @@ -448,7 +448,7 @@ bf_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) } static int -bf_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +bf_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { struct int_ctx *cx = (struct int_ctx *) c->ptr; BlowfishContext *bfctx = &cx->ctx.bf; @@ -473,7 +473,7 @@ bf_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) } static int -bf_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +bf_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { struct int_ctx *cx = (struct int_ctx *) c->ptr; BlowfishContext *bfctx = &cx->ctx.bf; @@ -577,7 +577,7 @@ static const PX_Alias int_aliases[] = { /* PUBLIC FUNCTIONS */ int -px_find_digest(const char *name, PX_MD ** res) +px_find_digest(const char *name, PX_MD **res) { const struct int_digest *p; PX_MD *h; @@ -596,7 +596,7 @@ px_find_digest(const char *name, PX_MD ** res) } int -px_find_cipher(const char *name, PX_Cipher ** res) +px_find_cipher(const char *name, PX_Cipher **res) { int i; PX_Cipher *c = NULL; diff --git a/contrib/pgcrypto/mbuf.c b/contrib/pgcrypto/mbuf.c index 920e10f6ca..d3eee2ee4f 100644 --- a/contrib/pgcrypto/mbuf.c +++ b/contrib/pgcrypto/mbuf.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/mbuf.c,v 1.4 2007/07/15 23:57:13 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/mbuf.c,v 1.5 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -47,25 +47,25 @@ struct MBuf }; int -mbuf_avail(MBuf * mbuf) +mbuf_avail(MBuf *mbuf) { return mbuf->data_end - mbuf->read_pos; } int -mbuf_size(MBuf * mbuf) +mbuf_size(MBuf *mbuf) { return mbuf->data_end - mbuf->data; } int -mbuf_tell(MBuf * mbuf) +mbuf_tell(MBuf *mbuf) { return mbuf->read_pos - mbuf->data; } int -mbuf_free(MBuf * mbuf) +mbuf_free(MBuf *mbuf) { if (mbuf->own_data) { @@ -77,7 +77,7 @@ mbuf_free(MBuf * mbuf) } static void -prepare_room(MBuf * mbuf, int block_len) +prepare_room(MBuf *mbuf, int block_len) { uint8 *newbuf; unsigned newlen; @@ -99,7 +99,7 @@ prepare_room(MBuf * mbuf, int block_len) } int -mbuf_append(MBuf * dst, const uint8 *buf, int len) +mbuf_append(MBuf *dst, const uint8 *buf, int len) { if (dst->no_write) { @@ -154,7 +154,7 @@ mbuf_create_from_data(const uint8 *data, int len) int -mbuf_grab(MBuf * mbuf, int len, uint8 **data_p) +mbuf_grab(MBuf *mbuf, int len, uint8 **data_p) { if (len > mbuf_avail(mbuf)) len = mbuf_avail(mbuf); @@ -167,14 +167,14 @@ mbuf_grab(MBuf * mbuf, int len, uint8 **data_p) } int -mbuf_rewind(MBuf * mbuf) +mbuf_rewind(MBuf *mbuf) { mbuf->read_pos = mbuf->data; return 0; } int -mbuf_steal_data(MBuf * mbuf, uint8 **data_p) +mbuf_steal_data(MBuf *mbuf, uint8 **data_p) { int len = mbuf_size(mbuf); @@ -203,7 +203,7 @@ struct PullFilter }; int -pullf_create(PullFilter ** pf_p, const PullFilterOps * op, void *init_arg, PullFilter * src) +pullf_create(PullFilter **pf_p, const PullFilterOps *op, void *init_arg, PullFilter *src) { PullFilter *pf; void *priv; @@ -242,7 +242,7 @@ pullf_create(PullFilter ** pf_p, const PullFilterOps * op, void *init_arg, PullF } void -pullf_free(PullFilter * pf) +pullf_free(PullFilter *pf) { if (pf->op->free) pf->op->free(pf->priv); @@ -259,7 +259,7 @@ pullf_free(PullFilter * pf) /* may return less data than asked, 0 means eof */ int -pullf_read(PullFilter * pf, int len, uint8 **data_p) +pullf_read(PullFilter *pf, int len, uint8 **data_p) { int res; @@ -276,7 +276,7 @@ pullf_read(PullFilter * pf, int len, uint8 **data_p) } int -pullf_read_max(PullFilter * pf, int len, uint8 **data_p, uint8 *tmpbuf) +pullf_read_max(PullFilter *pf, int len, uint8 **data_p, uint8 *tmpbuf) { int res, total; @@ -313,7 +313,7 @@ pullf_read_max(PullFilter * pf, int len, uint8 **data_p, uint8 *tmpbuf) * caller wants exatly len bytes and dont bother with references */ int -pullf_read_fixed(PullFilter * src, int len, uint8 *dst) +pullf_read_fixed(PullFilter *src, int len, uint8 *dst) { int res; uint8 *p; @@ -335,7 +335,7 @@ pullf_read_fixed(PullFilter * src, int len, uint8 *dst) * read from MBuf */ static int -pull_from_mbuf(void *arg, PullFilter * src, int len, +pull_from_mbuf(void *arg, PullFilter *src, int len, uint8 **data_p, uint8 *buf, int buflen) { MBuf *mbuf = arg; @@ -348,7 +348,7 @@ static const struct PullFilterOps mbuf_reader = { }; int -pullf_create_mbuf_reader(PullFilter ** mp_p, MBuf * src) +pullf_create_mbuf_reader(PullFilter **mp_p, MBuf *src) { return pullf_create(mp_p, &mbuf_reader, src, NULL); } @@ -369,7 +369,7 @@ struct PushFilter }; int -pushf_create(PushFilter ** mp_p, const PushFilterOps * op, void *init_arg, PushFilter * next) +pushf_create(PushFilter **mp_p, const PushFilterOps *op, void *init_arg, PushFilter *next) { PushFilter *mp; void *priv; @@ -408,7 +408,7 @@ pushf_create(PushFilter ** mp_p, const PushFilterOps * op, void *init_arg, PushF } void -pushf_free(PushFilter * mp) +pushf_free(PushFilter *mp) { if (mp->op->free) mp->op->free(mp->priv); @@ -424,7 +424,7 @@ pushf_free(PushFilter * mp) } void -pushf_free_all(PushFilter * mp) +pushf_free_all(PushFilter *mp) { PushFilter *tmp; @@ -437,7 +437,7 @@ pushf_free_all(PushFilter * mp) } static int -wrap_process(PushFilter * mp, const uint8 *data, int len) +wrap_process(PushFilter *mp, const uint8 *data, int len) { int res; @@ -452,7 +452,7 @@ wrap_process(PushFilter * mp, const uint8 *data, int len) /* consumes all data, returns len on success */ int -pushf_write(PushFilter * mp, const uint8 *data, int len) +pushf_write(PushFilter *mp, const uint8 *data, int len) { int need, res; @@ -512,7 +512,7 @@ pushf_write(PushFilter * mp, const uint8 *data, int len) } int -pushf_flush(PushFilter * mp) +pushf_flush(PushFilter *mp) { int res; @@ -542,7 +542,7 @@ pushf_flush(PushFilter * mp) * write to MBuf */ static int -push_into_mbuf(PushFilter * next, void *arg, const uint8 *data, int len) +push_into_mbuf(PushFilter *next, void *arg, const uint8 *data, int len) { int res = 0; MBuf *mbuf = arg; @@ -557,7 +557,7 @@ static const struct PushFilterOps mbuf_filter = { }; int -pushf_create_mbuf_writer(PushFilter ** res, MBuf * dst) +pushf_create_mbuf_writer(PushFilter **res, MBuf *dst) { return pushf_create(res, &mbuf_filter, dst, NULL); } diff --git a/contrib/pgcrypto/mbuf.h b/contrib/pgcrypto/mbuf.h index 91ef821ed4..aa2b5596ee 100644 --- a/contrib/pgcrypto/mbuf.h +++ b/contrib/pgcrypto/mbuf.h @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/mbuf.h,v 1.2 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/mbuf.h,v 1.3 2009/06/11 14:48:52 momjian Exp $ */ #ifndef __PX_MBUF_H @@ -44,15 +44,15 @@ struct PushFilterOps * should return needed buffer size, 0- no buffering, <0 on error if NULL, * no buffering, and priv=init_arg */ - int (*init) (PushFilter * next, void *init_arg, void **priv_p); + int (*init) (PushFilter *next, void *init_arg, void **priv_p); /* * send data to next. should consume all? if null, it will be simply * copied (in-place) returns 0 on error */ - int (*push) (PushFilter * next, void *priv, + int (*push) (PushFilter *next, void *priv, const uint8 *src, int len); - int (*flush) (PushFilter * next, void *priv); + int (*flush) (PushFilter *next, void *priv); void (*free) (void *priv); }; @@ -62,13 +62,13 @@ struct PullFilterOps * should return needed buffer size, 0- no buffering, <0 on error if NULL, * no buffering, and priv=init_arg */ - int (*init) (void **priv_p, void *init_arg, PullFilter * src); + int (*init) (void **priv_p, void *init_arg, PullFilter *src); /* * request data from src, put result ptr to data_p can use ptr from src or * use buf as work area if NULL in-place copy */ - int (*pull) (void *priv, PullFilter * src, int len, + int (*pull) (void *priv, PullFilter *src, int len, uint8 **data_p, uint8 *buf, int buflen); void (*free) (void *priv); }; @@ -78,39 +78,39 @@ struct PullFilterOps */ MBuf *mbuf_create(int len); MBuf *mbuf_create_from_data(const uint8 *data, int len); -int mbuf_tell(MBuf * mbuf); -int mbuf_avail(MBuf * mbuf); -int mbuf_size(MBuf * mbuf); -int mbuf_grab(MBuf * mbuf, int len, uint8 **data_p); -int mbuf_steal_data(MBuf * mbuf, uint8 **data_p); -int mbuf_append(MBuf * dst, const uint8 *buf, int cnt); -int mbuf_rewind(MBuf * mbuf); -int mbuf_free(MBuf * mbuf); +int mbuf_tell(MBuf *mbuf); +int mbuf_avail(MBuf *mbuf); +int mbuf_size(MBuf *mbuf); +int mbuf_grab(MBuf *mbuf, int len, uint8 **data_p); +int mbuf_steal_data(MBuf *mbuf, uint8 **data_p); +int mbuf_append(MBuf *dst, const uint8 *buf, int cnt); +int mbuf_rewind(MBuf *mbuf); +int mbuf_free(MBuf *mbuf); /* * Push filter */ -int pushf_create(PushFilter ** res, const PushFilterOps * ops, void *init_arg, - PushFilter * next); -int pushf_write(PushFilter * mp, const uint8 *data, int len); -void pushf_free_all(PushFilter * mp); -void pushf_free(PushFilter * mp); -int pushf_flush(PushFilter * mp); +int pushf_create(PushFilter **res, const PushFilterOps *ops, void *init_arg, + PushFilter *next); +int pushf_write(PushFilter *mp, const uint8 *data, int len); +void pushf_free_all(PushFilter *mp); +void pushf_free(PushFilter *mp); +int pushf_flush(PushFilter *mp); -int pushf_create_mbuf_writer(PushFilter ** mp_p, MBuf * mbuf); +int pushf_create_mbuf_writer(PushFilter **mp_p, MBuf *mbuf); /* * Pull filter */ -int pullf_create(PullFilter ** res, const PullFilterOps * ops, - void *init_arg, PullFilter * src); -int pullf_read(PullFilter * mp, int len, uint8 **data_p); -int pullf_read_max(PullFilter * mp, int len, +int pullf_create(PullFilter **res, const PullFilterOps *ops, + void *init_arg, PullFilter *src); +int pullf_read(PullFilter *mp, int len, uint8 **data_p); +int pullf_read_max(PullFilter *mp, int len, uint8 **data_p, uint8 *tmpbuf); -void pullf_free(PullFilter * mp); -int pullf_read_fixed(PullFilter * src, int len, uint8 *dst); +void pullf_free(PullFilter *mp); +int pullf_read_fixed(PullFilter *src, int len, uint8 *dst); -int pullf_create_mbuf_reader(PullFilter ** pf_p, MBuf * mbuf); +int pullf_create_mbuf_reader(PullFilter **pf_p, MBuf *mbuf); #define GETBYTE(pf, dst) \ do { \ diff --git a/contrib/pgcrypto/md5.c b/contrib/pgcrypto/md5.c index 851c5c888b..8083d1f280 100644 --- a/contrib/pgcrypto/md5.c +++ b/contrib/pgcrypto/md5.c @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/md5.c,v 1.14 2007/04/06 05:36:50 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/md5.c,v 1.15 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -136,7 +136,7 @@ static const uint8 md5_paddat[MD5_BUFLEN] = { static void md5_calc(uint8 *, md5_ctxt *); void -md5_init(md5_ctxt * ctxt) +md5_init(md5_ctxt *ctxt) { ctxt->md5_n = 0; ctxt->md5_i = 0; @@ -148,7 +148,7 @@ md5_init(md5_ctxt * ctxt) } void -md5_loop(md5_ctxt * ctxt, const uint8 *input, unsigned len) +md5_loop(md5_ctxt *ctxt, const uint8 *input, unsigned len) { unsigned int gap, i; @@ -175,7 +175,7 @@ md5_loop(md5_ctxt * ctxt, const uint8 *input, unsigned len) } void -md5_pad(md5_ctxt * ctxt) +md5_pad(md5_ctxt *ctxt) { unsigned int gap; @@ -213,7 +213,7 @@ md5_pad(md5_ctxt * ctxt) } void -md5_result(uint8 *digest, md5_ctxt * ctxt) +md5_result(uint8 *digest, md5_ctxt *ctxt) { /* 4 byte words */ #ifndef WORDS_BIGENDIAN @@ -243,7 +243,7 @@ static uint32 X[16]; #endif static void -md5_calc(uint8 *b64, md5_ctxt * ctxt) +md5_calc(uint8 *b64, md5_ctxt *ctxt) { uint32 A = ctxt->md5_sta; uint32 B = ctxt->md5_stb; diff --git a/contrib/pgcrypto/md5.h b/contrib/pgcrypto/md5.h index 933dcaa9b9..eb7c620b48 100644 --- a/contrib/pgcrypto/md5.h +++ b/contrib/pgcrypto/md5.h @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/contrib/pgcrypto/md5.h,v 1.9 2005/10/15 02:49:06 momjian Exp $ */ +/* $PostgreSQL: pgsql/contrib/pgcrypto/md5.h,v 1.10 2009/06/11 14:48:52 momjian Exp $ */ /* $KAME: md5.h,v 1.3 2000/02/22 14:01:18 itojun Exp $ */ /* @@ -59,7 +59,7 @@ typedef struct unsigned int md5_i; uint8 md5_buf[MD5_BUFLEN]; -} md5_ctxt; +} md5_ctxt; extern void md5_init(md5_ctxt *); extern void md5_loop(md5_ctxt *, const uint8 *, unsigned int); diff --git a/contrib/pgcrypto/openssl.c b/contrib/pgcrypto/openssl.c index 0f46580005..bb0b4eefd3 100644 --- a/contrib/pgcrypto/openssl.c +++ b/contrib/pgcrypto/openssl.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/openssl.c,v 1.32 2007/11/15 21:14:31 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/openssl.c,v 1.33 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -169,10 +169,10 @@ EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *res, unsigned int *len) #include "sha2.c" #include "internal-sha2.c" -typedef void (*init_f) (PX_MD * md); +typedef void (*init_f) (PX_MD *md); static int -compat_find_digest(const char *name, PX_MD ** res) +compat_find_digest(const char *name, PX_MD **res) { init_f init = NULL; @@ -203,10 +203,10 @@ typedef struct OSSLDigest { const EVP_MD *algo; EVP_MD_CTX ctx; -} OSSLDigest; +} OSSLDigest; static unsigned -digest_result_size(PX_MD * h) +digest_result_size(PX_MD *h) { OSSLDigest *digest = (OSSLDigest *) h->p.ptr; @@ -214,7 +214,7 @@ digest_result_size(PX_MD * h) } static unsigned -digest_block_size(PX_MD * h) +digest_block_size(PX_MD *h) { OSSLDigest *digest = (OSSLDigest *) h->p.ptr; @@ -222,7 +222,7 @@ digest_block_size(PX_MD * h) } static void -digest_reset(PX_MD * h) +digest_reset(PX_MD *h) { OSSLDigest *digest = (OSSLDigest *) h->p.ptr; @@ -230,7 +230,7 @@ digest_reset(PX_MD * h) } static void -digest_update(PX_MD * h, const uint8 *data, unsigned dlen) +digest_update(PX_MD *h, const uint8 *data, unsigned dlen) { OSSLDigest *digest = (OSSLDigest *) h->p.ptr; @@ -238,7 +238,7 @@ digest_update(PX_MD * h, const uint8 *data, unsigned dlen) } static void -digest_finish(PX_MD * h, uint8 *dst) +digest_finish(PX_MD *h, uint8 *dst) { OSSLDigest *digest = (OSSLDigest *) h->p.ptr; @@ -246,7 +246,7 @@ digest_finish(PX_MD * h, uint8 *dst) } static void -digest_free(PX_MD * h) +digest_free(PX_MD *h) { OSSLDigest *digest = (OSSLDigest *) h->p.ptr; @@ -261,7 +261,7 @@ static int px_openssl_initialized = 0; /* PUBLIC functions */ int -px_find_digest(const char *name, PX_MD ** res) +px_find_digest(const char *name, PX_MD **res) { const EVP_MD *md; PX_MD *h; @@ -310,9 +310,9 @@ px_find_digest(const char *name, PX_MD ** res) struct ossl_cipher { - int (*init) (PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv); - int (*encrypt) (PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res); - int (*decrypt) (PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res); + int (*init) (PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv); + int (*encrypt) (PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res); + int (*decrypt) (PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res); int block_size; int max_key_size; @@ -346,12 +346,12 @@ typedef struct unsigned klen; unsigned init; const struct ossl_cipher *ciph; -} ossldata; +} ossldata; /* generic */ static unsigned -gen_ossl_block_size(PX_Cipher * c) +gen_ossl_block_size(PX_Cipher *c) { ossldata *od = (ossldata *) c->ptr; @@ -359,7 +359,7 @@ gen_ossl_block_size(PX_Cipher * c) } static unsigned -gen_ossl_key_size(PX_Cipher * c) +gen_ossl_key_size(PX_Cipher *c) { ossldata *od = (ossldata *) c->ptr; @@ -367,7 +367,7 @@ gen_ossl_key_size(PX_Cipher * c) } static unsigned -gen_ossl_iv_size(PX_Cipher * c) +gen_ossl_iv_size(PX_Cipher *c) { unsigned ivlen; ossldata *od = (ossldata *) c->ptr; @@ -377,7 +377,7 @@ gen_ossl_iv_size(PX_Cipher * c) } static void -gen_ossl_free(PX_Cipher * c) +gen_ossl_free(PX_Cipher *c) { ossldata *od = (ossldata *) c->ptr; @@ -422,7 +422,7 @@ bf_check_supported_key_len(void) } static int -bf_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) +bf_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) { ossldata *od = c->ptr; static int bf_is_strong = -1; @@ -450,7 +450,7 @@ bf_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) } static int -bf_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +bf_ecb_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c); unsigned i; @@ -462,7 +462,7 @@ bf_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) } static int -bf_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +bf_ecb_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c), i; @@ -474,7 +474,7 @@ bf_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) } static int -bf_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +bf_cbc_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -483,7 +483,7 @@ bf_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) } static int -bf_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +bf_cbc_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -492,7 +492,7 @@ bf_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) } static int -bf_cfb64_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +bf_cfb64_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -502,7 +502,7 @@ bf_cfb64_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) } static int -bf_cfb64_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +bf_cfb64_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -514,7 +514,7 @@ bf_cfb64_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) /* DES */ static int -ossl_des_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) +ossl_des_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) { ossldata *od = c->ptr; DES_cblock xkey; @@ -532,7 +532,7 @@ ossl_des_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) } static int -ossl_des_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_des_ecb_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c); @@ -547,7 +547,7 @@ ossl_des_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, } static int -ossl_des_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_des_ecb_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c); @@ -562,7 +562,7 @@ ossl_des_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, } static int -ossl_des_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_des_cbc_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -573,7 +573,7 @@ ossl_des_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, } static int -ossl_des_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_des_cbc_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -586,7 +586,7 @@ ossl_des_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, /* DES3 */ static int -ossl_des3_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) +ossl_des3_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) { ossldata *od = c->ptr; DES_cblock xkey1, @@ -617,7 +617,7 @@ ossl_des3_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) } static int -ossl_des3_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_des3_ecb_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c); @@ -631,7 +631,7 @@ ossl_des3_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, } static int -ossl_des3_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_des3_ecb_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c); @@ -645,7 +645,7 @@ ossl_des3_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, } static int -ossl_des3_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_des3_cbc_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -657,7 +657,7 @@ ossl_des3_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, } static int -ossl_des3_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_des3_cbc_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -671,7 +671,7 @@ ossl_des3_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, /* CAST5 */ static int -ossl_cast_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) +ossl_cast_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) { ossldata *od = c->ptr; unsigned bs = gen_ossl_block_size(c); @@ -685,7 +685,7 @@ ossl_cast_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) } static int -ossl_cast_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +ossl_cast_ecb_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c); ossldata *od = c->ptr; @@ -697,7 +697,7 @@ ossl_cast_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *re } static int -ossl_cast_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +ossl_cast_ecb_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c); ossldata *od = c->ptr; @@ -709,7 +709,7 @@ ossl_cast_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *re } static int -ossl_cast_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +ossl_cast_cbc_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -718,7 +718,7 @@ ossl_cast_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *re } static int -ossl_cast_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +ossl_cast_cbc_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -729,7 +729,7 @@ ossl_cast_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *re /* AES */ static int -ossl_aes_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) +ossl_aes_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) { ossldata *od = c->ptr; unsigned bs = gen_ossl_block_size(c); @@ -753,7 +753,7 @@ ossl_aes_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) } static int -ossl_aes_key_init(ossldata * od, int type) +ossl_aes_key_init(ossldata *od, int type) { int err; @@ -776,7 +776,7 @@ ossl_aes_key_init(ossldata * od, int type) } static int -ossl_aes_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_aes_ecb_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c); @@ -794,7 +794,7 @@ ossl_aes_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, } static int -ossl_aes_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_aes_ecb_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c); @@ -812,7 +812,7 @@ ossl_aes_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, } static int -ossl_aes_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_aes_cbc_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -827,7 +827,7 @@ ossl_aes_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, } static int -ossl_aes_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_aes_cbc_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -945,7 +945,7 @@ static const struct ossl_cipher_lookup ossl_cipher_types[] = { /* PUBLIC functions */ int -px_find_cipher(const char *name, PX_Cipher ** res) +px_find_cipher(const char *name, PX_Cipher **res) { const struct ossl_cipher_lookup *i; PX_Cipher *c = NULL; diff --git a/contrib/pgcrypto/pgp-cfb.c b/contrib/pgcrypto/pgp-cfb.c index 811bb7c2c3..bd05ccc94e 100644 --- a/contrib/pgcrypto/pgp-cfb.c +++ b/contrib/pgcrypto/pgp-cfb.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-cfb.c,v 1.3 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-cfb.c,v 1.4 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -35,7 +35,7 @@ #include "px.h" #include "pgp.h" -typedef int (*mix_data_t) (PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst); +typedef int (*mix_data_t) (PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst); struct PGP_CFB { @@ -50,7 +50,7 @@ struct PGP_CFB }; int -pgp_cfb_create(PGP_CFB ** ctx_p, int algo, const uint8 *key, int key_len, +pgp_cfb_create(PGP_CFB **ctx_p, int algo, const uint8 *key, int key_len, int resync, uint8 *iv) { int res; @@ -82,7 +82,7 @@ pgp_cfb_create(PGP_CFB ** ctx_p, int algo, const uint8 *key, int key_len, } void -pgp_cfb_free(PGP_CFB * ctx) +pgp_cfb_free(PGP_CFB *ctx) { px_cipher_free(ctx->ciph); memset(ctx, 0, sizeof(*ctx)); @@ -93,7 +93,7 @@ pgp_cfb_free(PGP_CFB * ctx) * Data processing for normal CFB. (PGP_PKT_SYMENCRYPTED_DATA_MDC) */ static int -mix_encrypt_normal(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) +mix_encrypt_normal(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst) { int i; @@ -104,7 +104,7 @@ mix_encrypt_normal(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) } static int -mix_decrypt_normal(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) +mix_decrypt_normal(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst) { int i; @@ -124,7 +124,7 @@ mix_decrypt_normal(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) * thus its all concentrated here. */ static int -mix_encrypt_resync(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) +mix_encrypt_resync(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst) { int i, n; @@ -156,7 +156,7 @@ mix_encrypt_resync(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) } static int -mix_decrypt_resync(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) +mix_decrypt_resync(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst) { int i, n; @@ -196,7 +196,7 @@ mix_decrypt_resync(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) * common code for both encrypt and decrypt. */ static int -cfb_process(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst, +cfb_process(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst, mix_data_t mix_data) { int n; @@ -249,7 +249,7 @@ cfb_process(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst, */ int -pgp_cfb_encrypt(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) +pgp_cfb_encrypt(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst) { mix_data_t mix = ctx->resync ? mix_encrypt_resync : mix_encrypt_normal; @@ -257,7 +257,7 @@ pgp_cfb_encrypt(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) } int -pgp_cfb_decrypt(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) +pgp_cfb_decrypt(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst) { mix_data_t mix = ctx->resync ? mix_decrypt_resync : mix_decrypt_normal; diff --git a/contrib/pgcrypto/pgp-compress.c b/contrib/pgcrypto/pgp-compress.c index 9d2f61ed8e..41f5855247 100644 --- a/contrib/pgcrypto/pgp-compress.c +++ b/contrib/pgcrypto/pgp-compress.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-compress.c,v 1.7 2007/11/15 21:14:31 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-compress.c,v 1.8 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -69,7 +69,7 @@ z_free(void *priv, void *addr) } static int -compress_init(PushFilter * next, void *init_arg, void **priv_p) +compress_init(PushFilter *next, void *init_arg, void **priv_p) { int res; struct ZipStat *st; @@ -107,7 +107,7 @@ compress_init(PushFilter * next, void *init_arg, void **priv_p) /* cant handle zero-len incoming data, but shouldnt */ static int -compress_process(PushFilter * next, void *priv, const uint8 *data, int len) +compress_process(PushFilter *next, void *priv, const uint8 *data, int len) { int res, n_out; @@ -140,7 +140,7 @@ compress_process(PushFilter * next, void *priv, const uint8 *data, int len) } static int -compress_flush(PushFilter * next, void *priv) +compress_flush(PushFilter *next, void *priv) { int res, zres, @@ -185,7 +185,7 @@ static const PushFilterOps }; int -pgp_compress_filter(PushFilter ** res, PGP_Context * ctx, PushFilter * dst) +pgp_compress_filter(PushFilter **res, PGP_Context *ctx, PushFilter *dst) { return pushf_create(res, &compress_filter, ctx, dst); } @@ -204,7 +204,7 @@ struct DecomprData }; static int -decompress_init(void **priv_p, void *arg, PullFilter * src) +decompress_init(void **priv_p, void *arg, PullFilter *src) { PGP_Context *ctx = arg; struct DecomprData *dec; @@ -237,7 +237,7 @@ decompress_init(void **priv_p, void *arg, PullFilter * src) } static int -decompress_read(void *priv, PullFilter * src, int len, +decompress_read(void *priv, PullFilter *src, int len, uint8 **data_p, uint8 *buf, int buflen) { int res; @@ -308,20 +308,20 @@ static const PullFilterOps }; int -pgp_decompress_filter(PullFilter ** res, PGP_Context * ctx, PullFilter * src) +pgp_decompress_filter(PullFilter **res, PGP_Context *ctx, PullFilter *src) { return pullf_create(res, &decompress_filter, ctx, src); } #else /* !HAVE_ZLIB */ int -pgp_compress_filter(PushFilter ** res, PGP_Context * ctx, PushFilter * dst) +pgp_compress_filter(PushFilter **res, PGP_Context *ctx, PushFilter *dst) { return PXE_PGP_UNSUPPORTED_COMPR; } int -pgp_decompress_filter(PullFilter ** res, PGP_Context * ctx, PullFilter * src) +pgp_decompress_filter(PullFilter **res, PGP_Context *ctx, PullFilter *src) { return PXE_PGP_UNSUPPORTED_COMPR; } diff --git a/contrib/pgcrypto/pgp-decrypt.c b/contrib/pgcrypto/pgp-decrypt.c index 77973a5c31..9df5c717f2 100644 --- a/contrib/pgcrypto/pgp-decrypt.c +++ b/contrib/pgcrypto/pgp-decrypt.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-decrypt.c,v 1.7 2005/11/22 18:17:04 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-decrypt.c,v 1.8 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -49,7 +49,7 @@ #define MAX_CHUNK (16*1024*1024) static int -parse_new_len(PullFilter * src, int *len_p) +parse_new_len(PullFilter *src, int *len_p) { uint8 b; int len; @@ -92,7 +92,7 @@ parse_new_len(PullFilter * src, int *len_p) } static int -parse_old_len(PullFilter * src, int *len_p, int lentype) +parse_old_len(PullFilter *src, int *len_p, int lentype) { uint8 b; int len; @@ -126,7 +126,7 @@ parse_old_len(PullFilter * src, int *len_p, int lentype) /* returns pkttype or 0 on eof */ int -pgp_parse_pkt_hdr(PullFilter * src, uint8 *tag, int *len_p, int allow_ctx) +pgp_parse_pkt_hdr(PullFilter *src, uint8 *tag, int *len_p, int allow_ctx) { int lentype; int res; @@ -172,7 +172,7 @@ struct PktData }; static int -pktreader_pull(void *priv, PullFilter * src, int len, +pktreader_pull(void *priv, PullFilter *src, int len, uint8 **data_p, uint8 *buf, int buflen) { int res; @@ -220,8 +220,8 @@ static struct PullFilterOps pktreader_filter = { /* needs helper function to pass several parameters */ int -pgp_create_pkt_reader(PullFilter ** pf_p, PullFilter * src, int len, - int pkttype, PGP_Context * ctx) +pgp_create_pkt_reader(PullFilter **pf_p, PullFilter *src, int len, + int pkttype, PGP_Context *ctx) { int res; struct PktData *pkt = px_alloc(sizeof(*pkt)); @@ -239,7 +239,7 @@ pgp_create_pkt_reader(PullFilter ** pf_p, PullFilter * src, int len, */ static int -prefix_init(void **priv_p, void *arg, PullFilter * src) +prefix_init(void **priv_p, void *arg, PullFilter *src) { PGP_Context *ctx = arg; int len; @@ -294,7 +294,7 @@ static struct PullFilterOps prefix_filter = { */ static int -decrypt_init(void **priv_p, void *arg, PullFilter * src) +decrypt_init(void **priv_p, void *arg, PullFilter *src) { PGP_CFB *cfb = arg; @@ -305,7 +305,7 @@ decrypt_init(void **priv_p, void *arg, PullFilter * src) } static int -decrypt_read(void *priv, PullFilter * src, int len, +decrypt_read(void *priv, PullFilter *src, int len, uint8 **data_p, uint8 *buf, int buflen) { PGP_CFB *cfb = priv; @@ -331,7 +331,7 @@ struct PullFilterOps pgp_decrypt_filter = { */ static int -mdc_init(void **priv_p, void *arg, PullFilter * src) +mdc_init(void **priv_p, void *arg, PullFilter *src) { PGP_Context *ctx = arg; @@ -351,7 +351,7 @@ mdc_free(void *priv) } static int -mdc_finish(PGP_Context * ctx, PullFilter * src, +mdc_finish(PGP_Context *ctx, PullFilter *src, int len, uint8 **data_p) { int res; @@ -407,7 +407,7 @@ mdc_finish(PGP_Context * ctx, PullFilter * src, } static int -mdc_read(void *priv, PullFilter * src, int len, +mdc_read(void *priv, PullFilter *src, int len, uint8 **data_p, uint8 *buf, int buflen) { int res; @@ -460,7 +460,7 @@ struct MDCBufData }; static int -mdcbuf_init(void **priv_p, void *arg, PullFilter * src) +mdcbuf_init(void **priv_p, void *arg, PullFilter *src) { PGP_Context *ctx = arg; struct MDCBufData *st; @@ -520,7 +520,7 @@ mdcbuf_load_mdc(struct MDCBufData * st, uint8 *src, int len) } static int -mdcbuf_refill(struct MDCBufData * st, PullFilter * src) +mdcbuf_refill(struct MDCBufData * st, PullFilter *src) { uint8 *data; int res; @@ -564,7 +564,7 @@ mdcbuf_refill(struct MDCBufData * st, PullFilter * src) } static int -mdcbuf_read(void *priv, PullFilter * src, int len, +mdcbuf_read(void *priv, PullFilter *src, int len, uint8 **data_p, uint8 *buf, int buflen) { struct MDCBufData *st = priv; @@ -606,7 +606,7 @@ static struct PullFilterOps mdcbuf_filter = { * Decrypt separate session key */ static int -decrypt_key(PGP_Context * ctx, const uint8 *src, int len) +decrypt_key(PGP_Context *ctx, const uint8 *src, int len) { int res; uint8 algo; @@ -639,7 +639,7 @@ decrypt_key(PGP_Context * ctx, const uint8 *src, int len) * Handle key packet */ static int -parse_symenc_sesskey(PGP_Context * ctx, PullFilter * src) +parse_symenc_sesskey(PGP_Context *ctx, PullFilter *src) { uint8 *p; int res; @@ -708,7 +708,7 @@ parse_symenc_sesskey(PGP_Context * ctx, PullFilter * src) } static int -copy_crlf(MBuf * dst, uint8 *data, int len, int *got_cr) +copy_crlf(MBuf *dst, uint8 *data, int len, int *got_cr) { uint8 *data_end = data + len; uint8 tmpbuf[1024]; @@ -757,7 +757,7 @@ copy_crlf(MBuf * dst, uint8 *data, int len, int *got_cr) } static int -parse_literal_data(PGP_Context * ctx, MBuf * dst, PullFilter * pkt) +parse_literal_data(PGP_Context *ctx, MBuf *dst, PullFilter *pkt) { int type; int name_len; @@ -824,11 +824,11 @@ parse_literal_data(PGP_Context * ctx, MBuf * dst, PullFilter * pkt) } /* process_data_packets and parse_compressed_data call each other */ -static int process_data_packets(PGP_Context * ctx, MBuf * dst, - PullFilter * src, int allow_compr, int need_mdc); +static int process_data_packets(PGP_Context *ctx, MBuf *dst, + PullFilter *src, int allow_compr, int need_mdc); static int -parse_compressed_data(PGP_Context * ctx, MBuf * dst, PullFilter * pkt) +parse_compressed_data(PGP_Context *ctx, MBuf *dst, PullFilter *pkt) { int res; uint8 type; @@ -868,7 +868,7 @@ parse_compressed_data(PGP_Context * ctx, MBuf * dst, PullFilter * pkt) } static int -process_data_packets(PGP_Context * ctx, MBuf * dst, PullFilter * src, +process_data_packets(PGP_Context *ctx, MBuf *dst, PullFilter *src, int allow_compr, int need_mdc) { uint8 tag; @@ -975,7 +975,7 @@ process_data_packets(PGP_Context * ctx, MBuf * dst, PullFilter * src, } static int -parse_symenc_data(PGP_Context * ctx, PullFilter * pkt, MBuf * dst) +parse_symenc_data(PGP_Context *ctx, PullFilter *pkt, MBuf *dst) { int res; PGP_CFB *cfb = NULL; @@ -1009,7 +1009,7 @@ out: } static int -parse_symenc_mdc_data(PGP_Context * ctx, PullFilter * pkt, MBuf * dst) +parse_symenc_mdc_data(PGP_Context *ctx, PullFilter *pkt, MBuf *dst) { int res; PGP_CFB *cfb = NULL; @@ -1061,7 +1061,7 @@ out: * skip over packet contents */ int -pgp_skip_packet(PullFilter * pkt) +pgp_skip_packet(PullFilter *pkt) { int res = 1; uint8 *tmp; @@ -1075,7 +1075,7 @@ pgp_skip_packet(PullFilter * pkt) * expect to be at packet end, any data is error */ int -pgp_expect_packet_end(PullFilter * pkt) +pgp_expect_packet_end(PullFilter *pkt) { int res = 1; uint8 *tmp; @@ -1093,7 +1093,7 @@ pgp_expect_packet_end(PullFilter * pkt) } int -pgp_decrypt(PGP_Context * ctx, MBuf * msrc, MBuf * mdst) +pgp_decrypt(PGP_Context *ctx, MBuf *msrc, MBuf *mdst) { int res; PullFilter *src = NULL; diff --git a/contrib/pgcrypto/pgp-encrypt.c b/contrib/pgcrypto/pgp-encrypt.c index e2c928154b..48f2f01f62 100644 --- a/contrib/pgcrypto/pgp-encrypt.c +++ b/contrib/pgcrypto/pgp-encrypt.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-encrypt.c,v 1.3 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-encrypt.c,v 1.4 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -66,7 +66,7 @@ render_newlen(uint8 *h, int len) } static int -write_tag_only(PushFilter * dst, int tag) +write_tag_only(PushFilter *dst, int tag) { uint8 hdr = 0xC0 | tag; @@ -74,7 +74,7 @@ write_tag_only(PushFilter * dst, int tag) } static int -write_normal_header(PushFilter * dst, int tag, int len) +write_normal_header(PushFilter *dst, int tag, int len) { uint8 hdr[8]; uint8 *h = hdr; @@ -90,7 +90,7 @@ write_normal_header(PushFilter * dst, int tag, int len) */ static int -mdc_init(PushFilter * dst, void *init_arg, void **priv_p) +mdc_init(PushFilter *dst, void *init_arg, void **priv_p) { int res; PX_MD *md; @@ -104,7 +104,7 @@ mdc_init(PushFilter * dst, void *init_arg, void **priv_p) } static int -mdc_write(PushFilter * dst, void *priv, const uint8 *data, int len) +mdc_write(PushFilter *dst, void *priv, const uint8 *data, int len) { PX_MD *md = priv; @@ -113,7 +113,7 @@ mdc_write(PushFilter * dst, void *priv, const uint8 *data, int len) } static int -mdc_flush(PushFilter * dst, void *priv) +mdc_flush(PushFilter *dst, void *priv) { int res; uint8 pkt[2 + MDC_DIGEST_LEN]; @@ -156,7 +156,7 @@ struct EncStat }; static int -encrypt_init(PushFilter * next, void *init_arg, void **priv_p) +encrypt_init(PushFilter *next, void *init_arg, void **priv_p) { struct EncStat *st; PGP_Context *ctx = init_arg; @@ -188,7 +188,7 @@ encrypt_init(PushFilter * next, void *init_arg, void **priv_p) } static int -encrypt_process(PushFilter * next, void *priv, const uint8 *data, int len) +encrypt_process(PushFilter *next, void *priv, const uint8 *data, int len) { int res; struct EncStat *st = priv; @@ -236,7 +236,7 @@ struct PktStreamStat }; static int -pkt_stream_init(PushFilter * next, void *init_arg, void **priv_p) +pkt_stream_init(PushFilter *next, void *init_arg, void **priv_p) { struct PktStreamStat *st; @@ -249,7 +249,7 @@ pkt_stream_init(PushFilter * next, void *init_arg, void **priv_p) } static int -pkt_stream_process(PushFilter * next, void *priv, const uint8 *data, int len) +pkt_stream_process(PushFilter *next, void *priv, const uint8 *data, int len) { int res; uint8 hdr[8]; @@ -275,7 +275,7 @@ pkt_stream_process(PushFilter * next, void *priv, const uint8 *data, int len) } static int -pkt_stream_flush(PushFilter * next, void *priv) +pkt_stream_flush(PushFilter *next, void *priv) { int res; uint8 hdr[8]; @@ -308,7 +308,7 @@ static const PushFilterOps pkt_stream_filter = { }; int -pgp_create_pkt_writer(PushFilter * dst, int tag, PushFilter ** res_p) +pgp_create_pkt_writer(PushFilter *dst, int tag, PushFilter **res_p) { int res; @@ -324,7 +324,7 @@ pgp_create_pkt_writer(PushFilter * dst, int tag, PushFilter ** res_p) */ static int -crlf_process(PushFilter * dst, void *priv, const uint8 *data, int len) +crlf_process(PushFilter *dst, void *priv, const uint8 *data, int len) { const uint8 *data_end = data + len; const uint8 *p2, @@ -371,7 +371,7 @@ static const PushFilterOps crlf_filter = { * Initialize literal data packet */ static int -init_litdata_packet(PushFilter ** pf_res, PGP_Context * ctx, PushFilter * dst) +init_litdata_packet(PushFilter **pf_res, PGP_Context *ctx, PushFilter *dst) { int res; int hdrlen; @@ -426,7 +426,7 @@ init_litdata_packet(PushFilter ** pf_res, PGP_Context * ctx, PushFilter * dst) * Initialize compression filter */ static int -init_compress(PushFilter ** pf_res, PGP_Context * ctx, PushFilter * dst) +init_compress(PushFilter **pf_res, PGP_Context *ctx, PushFilter *dst) { int res; uint8 type = ctx->compress_algo; @@ -454,7 +454,7 @@ init_compress(PushFilter ** pf_res, PGP_Context * ctx, PushFilter * dst) * Initialize encdata packet */ static int -init_encdata_packet(PushFilter ** pf_res, PGP_Context * ctx, PushFilter * dst) +init_encdata_packet(PushFilter **pf_res, PGP_Context *ctx, PushFilter *dst) { int res; int tag; @@ -475,7 +475,7 @@ init_encdata_packet(PushFilter ** pf_res, PGP_Context * ctx, PushFilter * dst) * write prefix */ static int -write_prefix(PGP_Context * ctx, PushFilter * dst) +write_prefix(PGP_Context *ctx, PushFilter *dst) { uint8 prefix[PGP_MAX_BLOCK + 2]; int res, @@ -499,7 +499,7 @@ write_prefix(PGP_Context * ctx, PushFilter * dst) */ static int -symencrypt_sesskey(PGP_Context * ctx, uint8 *dst) +symencrypt_sesskey(PGP_Context *ctx, uint8 *dst) { int res; PGP_CFB *cfb; @@ -519,7 +519,7 @@ symencrypt_sesskey(PGP_Context * ctx, uint8 *dst) /* 5.3: Symmetric-Key Encrypted Session-Key */ static int -write_symenc_sesskey(PGP_Context * ctx, PushFilter * dst) +write_symenc_sesskey(PGP_Context *ctx, PushFilter *dst) { uint8 pkt[256]; int pktlen; @@ -560,7 +560,7 @@ write_symenc_sesskey(PGP_Context * ctx, PushFilter * dst) * key setup */ static int -init_s2k_key(PGP_Context * ctx) +init_s2k_key(PGP_Context *ctx) { int res; @@ -576,7 +576,7 @@ init_s2k_key(PGP_Context * ctx) } static int -init_sess_key(PGP_Context * ctx) +init_sess_key(PGP_Context *ctx) { int res; @@ -600,7 +600,7 @@ init_sess_key(PGP_Context * ctx) * combine */ int -pgp_encrypt(PGP_Context * ctx, MBuf * src, MBuf * dst) +pgp_encrypt(PGP_Context *ctx, MBuf *src, MBuf *dst) { int res; int len; diff --git a/contrib/pgcrypto/pgp-info.c b/contrib/pgcrypto/pgp-info.c index 9f887ec6d9..a51a553236 100644 --- a/contrib/pgcrypto/pgp-info.c +++ b/contrib/pgcrypto/pgp-info.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-info.c,v 1.4 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-info.c,v 1.5 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -35,7 +35,7 @@ #include "pgp.h" static int -read_pubkey_keyid(PullFilter * pkt, uint8 *keyid_buf) +read_pubkey_keyid(PullFilter *pkt, uint8 *keyid_buf) { int res; PGP_PubKey *pk = NULL; @@ -68,7 +68,7 @@ err: } static int -read_pubenc_keyid(PullFilter * pkt, uint8 *keyid_buf) +read_pubenc_keyid(PullFilter *pkt, uint8 *keyid_buf) { uint8 ver; int res; @@ -109,7 +109,7 @@ static const uint8 any_key[] = * dst should have room for 17 bytes */ int -pgp_get_keyid(MBuf * pgp_data, char *dst) +pgp_get_keyid(MBuf *pgp_data, char *dst) { int res; PullFilter *src; diff --git a/contrib/pgcrypto/pgp-mpi-internal.c b/contrib/pgcrypto/pgp-mpi-internal.c index d2b5d0c8de..283946b17d 100644 --- a/contrib/pgcrypto/pgp-mpi-internal.c +++ b/contrib/pgcrypto/pgp-mpi-internal.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-mpi-internal.c,v 1.7 2006/10/04 00:29:46 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-mpi-internal.c,v 1.8 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -46,7 +46,7 @@ mp_new() } static void -mp_clear_free(mpz_t * a) +mp_clear_free(mpz_t *a) { if (!a) return; @@ -56,7 +56,7 @@ mp_clear_free(mpz_t * a) static int -mp_px_rand(uint32 bits, mpz_t * res) +mp_px_rand(uint32 bits, mpz_t *res) { int err; unsigned bytes = (bits + 7) / 8; @@ -88,7 +88,7 @@ mp_px_rand(uint32 bits, mpz_t * res) } static void -mp_modmul(mpz_t * a, mpz_t * b, mpz_t * p, mpz_t * res) +mp_modmul(mpz_t *a, mpz_t *b, mpz_t *p, mpz_t *res) { mpz_t *tmp = mp_new(); @@ -98,7 +98,7 @@ mp_modmul(mpz_t * a, mpz_t * b, mpz_t * p, mpz_t * res) } static mpz_t * -mpi_to_bn(PGP_MPI * n) +mpi_to_bn(PGP_MPI *n) { mpz_t *bn = mp_new(); @@ -117,7 +117,7 @@ mpi_to_bn(PGP_MPI * n) } static PGP_MPI * -bn_to_mpi(mpz_t * bn) +bn_to_mpi(mpz_t *bn) { int res; PGP_MPI *n; @@ -164,8 +164,8 @@ decide_k_bits(int p_bits) } int -pgp_elgamal_encrypt(PGP_PubKey * pk, PGP_MPI * _m, - PGP_MPI ** c1_p, PGP_MPI ** c2_p) +pgp_elgamal_encrypt(PGP_PubKey *pk, PGP_MPI *_m, + PGP_MPI **c1_p, PGP_MPI **c2_p) { int res = PXE_PGP_MATH_FAILED; int k_bits; @@ -214,8 +214,8 @@ err: } int -pgp_elgamal_decrypt(PGP_PubKey * pk, PGP_MPI * _c1, PGP_MPI * _c2, - PGP_MPI ** msg_p) +pgp_elgamal_decrypt(PGP_PubKey *pk, PGP_MPI *_c1, PGP_MPI *_c2, + PGP_MPI **msg_p) { int res = PXE_PGP_MATH_FAILED; mpz_t *c1 = mpi_to_bn(_c1); @@ -252,7 +252,7 @@ err: } int -pgp_rsa_encrypt(PGP_PubKey * pk, PGP_MPI * _m, PGP_MPI ** c_p) +pgp_rsa_encrypt(PGP_PubKey *pk, PGP_MPI *_m, PGP_MPI **c_p) { int res = PXE_PGP_MATH_FAILED; mpz_t *m = mpi_to_bn(_m); @@ -280,7 +280,7 @@ err: } int -pgp_rsa_decrypt(PGP_PubKey * pk, PGP_MPI * _c, PGP_MPI ** m_p) +pgp_rsa_decrypt(PGP_PubKey *pk, PGP_MPI *_c, PGP_MPI **m_p) { int res = PXE_PGP_MATH_FAILED; mpz_t *c = mpi_to_bn(_c); diff --git a/contrib/pgcrypto/pgp-mpi-openssl.c b/contrib/pgcrypto/pgp-mpi-openssl.c index 0e692e35d2..f2b25de090 100644 --- a/contrib/pgcrypto/pgp-mpi-openssl.c +++ b/contrib/pgcrypto/pgp-mpi-openssl.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-mpi-openssl.c,v 1.4 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-mpi-openssl.c,v 1.5 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -37,7 +37,7 @@ #include "pgp.h" static BIGNUM * -mpi_to_bn(PGP_MPI * n) +mpi_to_bn(PGP_MPI *n) { BIGNUM *bn = BN_bin2bn(n->data, n->bytes, NULL); @@ -99,8 +99,8 @@ decide_k_bits(int p_bits) } int -pgp_elgamal_encrypt(PGP_PubKey * pk, PGP_MPI * _m, - PGP_MPI ** c1_p, PGP_MPI ** c2_p) +pgp_elgamal_encrypt(PGP_PubKey *pk, PGP_MPI *_m, + PGP_MPI **c1_p, PGP_MPI **c2_p) { int res = PXE_PGP_MATH_FAILED; int k_bits; @@ -162,8 +162,8 @@ err: } int -pgp_elgamal_decrypt(PGP_PubKey * pk, PGP_MPI * _c1, PGP_MPI * _c2, - PGP_MPI ** msg_p) +pgp_elgamal_decrypt(PGP_PubKey *pk, PGP_MPI *_c1, PGP_MPI *_c2, + PGP_MPI **msg_p) { int res = PXE_PGP_MATH_FAILED; BIGNUM *c1 = mpi_to_bn(_c1); @@ -213,7 +213,7 @@ err: } int -pgp_rsa_encrypt(PGP_PubKey * pk, PGP_MPI * _m, PGP_MPI ** c_p) +pgp_rsa_encrypt(PGP_PubKey *pk, PGP_MPI *_m, PGP_MPI **c_p) { int res = PXE_PGP_MATH_FAILED; BIGNUM *m = mpi_to_bn(_m); @@ -249,7 +249,7 @@ err: } int -pgp_rsa_decrypt(PGP_PubKey * pk, PGP_MPI * _c, PGP_MPI ** m_p) +pgp_rsa_decrypt(PGP_PubKey *pk, PGP_MPI *_c, PGP_MPI **m_p) { int res = PXE_PGP_MATH_FAILED; BIGNUM *c = mpi_to_bn(_c); diff --git a/contrib/pgcrypto/pgp-mpi.c b/contrib/pgcrypto/pgp-mpi.c index da0edb1361..3f2ec0f5c7 100644 --- a/contrib/pgcrypto/pgp-mpi.c +++ b/contrib/pgcrypto/pgp-mpi.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-mpi.c,v 1.4 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-mpi.c,v 1.5 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -35,7 +35,7 @@ #include "pgp.h" int -pgp_mpi_alloc(int bits, PGP_MPI ** mpi) +pgp_mpi_alloc(int bits, PGP_MPI **mpi) { PGP_MPI *n; int len = (bits + 7) / 8; @@ -54,7 +54,7 @@ pgp_mpi_alloc(int bits, PGP_MPI ** mpi) } int -pgp_mpi_create(uint8 *data, int bits, PGP_MPI ** mpi) +pgp_mpi_create(uint8 *data, int bits, PGP_MPI **mpi) { int res; PGP_MPI *n; @@ -68,7 +68,7 @@ pgp_mpi_create(uint8 *data, int bits, PGP_MPI ** mpi) } int -pgp_mpi_free(PGP_MPI * mpi) +pgp_mpi_free(PGP_MPI *mpi) { if (mpi == NULL) return 0; @@ -78,7 +78,7 @@ pgp_mpi_free(PGP_MPI * mpi) } int -pgp_mpi_read(PullFilter * src, PGP_MPI ** mpi) +pgp_mpi_read(PullFilter *src, PGP_MPI **mpi) { int res; uint8 hdr[2]; @@ -103,7 +103,7 @@ pgp_mpi_read(PullFilter * src, PGP_MPI ** mpi) } int -pgp_mpi_write(PushFilter * dst, PGP_MPI * n) +pgp_mpi_write(PushFilter *dst, PGP_MPI *n) { int res; uint8 buf[2]; @@ -117,7 +117,7 @@ pgp_mpi_write(PushFilter * dst, PGP_MPI * n) } int -pgp_mpi_hash(PX_MD * md, PGP_MPI * n) +pgp_mpi_hash(PX_MD *md, PGP_MPI *n) { uint8 buf[2]; @@ -130,7 +130,7 @@ pgp_mpi_hash(PX_MD * md, PGP_MPI * n) } unsigned -pgp_mpi_cksum(unsigned cksum, PGP_MPI * n) +pgp_mpi_cksum(unsigned cksum, PGP_MPI *n) { int i; diff --git a/contrib/pgcrypto/pgp-pgsql.c b/contrib/pgcrypto/pgp-pgsql.c index 5ffa5ad0a9..530a3d38d8 100644 --- a/contrib/pgcrypto/pgp-pgsql.c +++ b/contrib/pgcrypto/pgp-pgsql.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pgsql.c,v 1.10 2008/05/04 16:42:41 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pgsql.c,v 1.11 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -79,7 +79,7 @@ PG_FUNCTION_INFO_V1(pg_dearmor); * Mix a block of data into RNG. */ static void -add_block_entropy(PX_MD * md, text *data) +add_block_entropy(PX_MD *md, text *data) { uint8 sha1[20]; @@ -215,7 +215,7 @@ fill_expect(struct debug_expect * ex, int text_mode) } while (0) static void -check_expect(PGP_Context * ctx, struct debug_expect * ex) +check_expect(PGP_Context *ctx, struct debug_expect * ex) { EX_CHECK(cipher_algo); EX_CHECK(s2k_mode); @@ -235,7 +235,7 @@ show_debug(const char *msg) } static int -set_arg(PGP_Context * ctx, char *key, char *val, +set_arg(PGP_Context *ctx, char *key, char *val, struct debug_expect * ex) { int res = 0; @@ -362,7 +362,7 @@ downcase_convert(const uint8 *s, int len) } static int -parse_args(PGP_Context * ctx, uint8 *args, int arg_len, +parse_args(PGP_Context *ctx, uint8 *args, int arg_len, struct debug_expect * ex) { char *str = downcase_convert(args, arg_len); @@ -407,7 +407,7 @@ create_mbuf_from_vardata(text *data) } static void -init_work(PGP_Context ** ctx_p, int is_text, +init_work(PGP_Context **ctx_p, int is_text, text *args, struct debug_expect * ex) { int err = pgp_init(ctx_p); diff --git a/contrib/pgcrypto/pgp-pubdec.c b/contrib/pgcrypto/pgp-pubdec.c index 600a1e2531..cb32708fee 100644 --- a/contrib/pgcrypto/pgp-pubdec.c +++ b/contrib/pgcrypto/pgp-pubdec.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pubdec.c,v 1.5 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pubdec.c,v 1.6 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -95,7 +95,7 @@ control_cksum(uint8 *msg, int msglen) } static int -decrypt_elgamal(PGP_PubKey * pk, PullFilter * pkt, PGP_MPI ** m_p) +decrypt_elgamal(PGP_PubKey *pk, PullFilter *pkt, PGP_MPI **m_p) { int res; PGP_MPI *c1 = NULL; @@ -122,7 +122,7 @@ out: } static int -decrypt_rsa(PGP_PubKey * pk, PullFilter * pkt, PGP_MPI ** m_p) +decrypt_rsa(PGP_PubKey *pk, PullFilter *pkt, PGP_MPI **m_p) { int res; PGP_MPI *c; @@ -148,7 +148,7 @@ static const uint8 any_key[] = {0, 0, 0, 0, 0, 0, 0, 0}; int -pgp_parse_pubenc_sesskey(PGP_Context * ctx, PullFilter * pkt) +pgp_parse_pubenc_sesskey(PGP_Context *ctx, PullFilter *pkt) { int ver; int algo; diff --git a/contrib/pgcrypto/pgp-pubenc.c b/contrib/pgcrypto/pgp-pubenc.c index de729476f5..0e9ebb4285 100644 --- a/contrib/pgcrypto/pgp-pubenc.c +++ b/contrib/pgcrypto/pgp-pubenc.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pubenc.c,v 1.4 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pubenc.c,v 1.5 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -86,7 +86,7 @@ pad_eme_pkcs1_v15(uint8 *data, int data_len, int res_len, uint8 **res_p) } static int -create_secmsg(PGP_Context * ctx, PGP_MPI ** msg_p, int full_bytes) +create_secmsg(PGP_Context *ctx, PGP_MPI **msg_p, int full_bytes) { uint8 *secmsg; int res, @@ -136,7 +136,7 @@ create_secmsg(PGP_Context * ctx, PGP_MPI ** msg_p, int full_bytes) } static int -encrypt_and_write_elgamal(PGP_Context * ctx, PGP_PubKey * pk, PushFilter * pkt) +encrypt_and_write_elgamal(PGP_Context *ctx, PGP_PubKey *pk, PushFilter *pkt) { int res; PGP_MPI *m = NULL, @@ -167,7 +167,7 @@ err: } static int -encrypt_and_write_rsa(PGP_Context * ctx, PGP_PubKey * pk, PushFilter * pkt) +encrypt_and_write_rsa(PGP_Context *ctx, PGP_PubKey *pk, PushFilter *pkt) { int res; PGP_MPI *m = NULL, @@ -193,7 +193,7 @@ err: } int -pgp_write_pubenc_sesskey(PGP_Context * ctx, PushFilter * dst) +pgp_write_pubenc_sesskey(PGP_Context *ctx, PushFilter *dst) { int res; PGP_PubKey *pk = ctx->pub_key; diff --git a/contrib/pgcrypto/pgp-pubkey.c b/contrib/pgcrypto/pgp-pubkey.c index 3904561806..62b6e1ab0e 100644 --- a/contrib/pgcrypto/pgp-pubkey.c +++ b/contrib/pgcrypto/pgp-pubkey.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pubkey.c,v 1.4 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pubkey.c,v 1.5 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -35,7 +35,7 @@ #include "pgp.h" int -pgp_key_alloc(PGP_PubKey ** pk_p) +pgp_key_alloc(PGP_PubKey **pk_p) { PGP_PubKey *pk; @@ -46,7 +46,7 @@ pgp_key_alloc(PGP_PubKey ** pk_p) } void -pgp_key_free(PGP_PubKey * pk) +pgp_key_free(PGP_PubKey *pk) { if (pk == NULL) return; @@ -82,7 +82,7 @@ pgp_key_free(PGP_PubKey * pk) } static int -calc_key_id(PGP_PubKey * pk) +calc_key_id(PGP_PubKey *pk) { int res; PX_MD *md; @@ -156,7 +156,7 @@ calc_key_id(PGP_PubKey * pk) } int -_pgp_read_public_key(PullFilter * pkt, PGP_PubKey ** pk_p) +_pgp_read_public_key(PullFilter *pkt, PGP_PubKey **pk_p) { int res; PGP_PubKey *pk; @@ -251,7 +251,7 @@ out: #define HIDE_SHA1 254 static int -check_key_sha1(PullFilter * src, PGP_PubKey * pk) +check_key_sha1(PullFilter *src, PGP_PubKey *pk) { int res; uint8 got_sha1[20]; @@ -297,7 +297,7 @@ err: } static int -check_key_cksum(PullFilter * src, PGP_PubKey * pk) +check_key_cksum(PullFilter *src, PGP_PubKey *pk) { int res; unsigned got_cksum, @@ -335,7 +335,7 @@ check_key_cksum(PullFilter * src, PGP_PubKey * pk) } static int -process_secret_key(PullFilter * pkt, PGP_PubKey ** pk_p, +process_secret_key(PullFilter *pkt, PGP_PubKey **pk_p, const uint8 *key, int key_len) { int res; @@ -456,7 +456,7 @@ process_secret_key(PullFilter * pkt, PGP_PubKey ** pk_p, } static int -internal_read_key(PullFilter * src, PGP_PubKey ** pk_p, +internal_read_key(PullFilter *src, PGP_PubKey **pk_p, const uint8 *psw, int psw_len, int pubtype) { PullFilter *pkt = NULL; @@ -563,7 +563,7 @@ internal_read_key(PullFilter * src, PGP_PubKey ** pk_p, } int -pgp_set_pubkey(PGP_Context * ctx, MBuf * keypkt, +pgp_set_pubkey(PGP_Context *ctx, MBuf *keypkt, const uint8 *key, int key_len, int pubtype) { int res; diff --git a/contrib/pgcrypto/pgp-s2k.c b/contrib/pgcrypto/pgp-s2k.c index 84def87db6..326b1bbf31 100644 --- a/contrib/pgcrypto/pgp-s2k.c +++ b/contrib/pgcrypto/pgp-s2k.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-s2k.c,v 1.4 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-s2k.c,v 1.5 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -36,7 +36,7 @@ #include "pgp.h" static int -calc_s2k_simple(PGP_S2K * s2k, PX_MD * md, const uint8 *key, +calc_s2k_simple(PGP_S2K *s2k, PX_MD *md, const uint8 *key, unsigned key_len) { unsigned md_bs, @@ -81,7 +81,7 @@ calc_s2k_simple(PGP_S2K * s2k, PX_MD * md, const uint8 *key, } static int -calc_s2k_salted(PGP_S2K * s2k, PX_MD * md, const uint8 *key, unsigned key_len) +calc_s2k_salted(PGP_S2K *s2k, PX_MD *md, const uint8 *key, unsigned key_len) { unsigned md_bs, md_rlen; @@ -126,7 +126,7 @@ calc_s2k_salted(PGP_S2K * s2k, PX_MD * md, const uint8 *key, unsigned key_len) } static int -calc_s2k_iter_salted(PGP_S2K * s2k, PX_MD * md, const uint8 *key, +calc_s2k_iter_salted(PGP_S2K *s2k, PX_MD *md, const uint8 *key, unsigned key_len) { unsigned md_bs, @@ -213,7 +213,7 @@ decide_count(unsigned rand_byte) } int -pgp_s2k_fill(PGP_S2K * s2k, int mode, int digest_algo) +pgp_s2k_fill(PGP_S2K *s2k, int mode, int digest_algo) { int res = 0; uint8 tmp; @@ -244,7 +244,7 @@ pgp_s2k_fill(PGP_S2K * s2k, int mode, int digest_algo) } int -pgp_s2k_read(PullFilter * src, PGP_S2K * s2k) +pgp_s2k_read(PullFilter *src, PGP_S2K *s2k) { int res = 0; @@ -270,7 +270,7 @@ pgp_s2k_read(PullFilter * src, PGP_S2K * s2k) } int -pgp_s2k_process(PGP_S2K * s2k, int cipher, const uint8 *key, int key_len) +pgp_s2k_process(PGP_S2K *s2k, int cipher, const uint8 *key, int key_len) { int res; PX_MD *md; diff --git a/contrib/pgcrypto/pgp.c b/contrib/pgcrypto/pgp.c index e9e732e4be..ce6f199a9e 100644 --- a/contrib/pgcrypto/pgp.c +++ b/contrib/pgcrypto/pgp.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/pgp.c,v 1.3 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp.c,v 1.4 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -165,7 +165,7 @@ pgp_get_cipher_block_size(int code) } int -pgp_load_cipher(int code, PX_Cipher ** res) +pgp_load_cipher(int code, PX_Cipher **res) { int err; const struct cipher_info *i = get_cipher_info(code); @@ -181,7 +181,7 @@ pgp_load_cipher(int code, PX_Cipher ** res) } int -pgp_load_digest(int code, PX_MD ** res) +pgp_load_digest(int code, PX_MD **res) { int err; const char *name = pgp_get_digest_name(code); @@ -197,7 +197,7 @@ pgp_load_digest(int code, PX_MD ** res) } int -pgp_init(PGP_Context ** ctx_p) +pgp_init(PGP_Context **ctx_p) { PGP_Context *ctx; @@ -221,7 +221,7 @@ pgp_init(PGP_Context ** ctx_p) } int -pgp_free(PGP_Context * ctx) +pgp_free(PGP_Context *ctx) { if (ctx->pub_key) pgp_key_free(ctx->pub_key); @@ -231,28 +231,28 @@ pgp_free(PGP_Context * ctx) } int -pgp_disable_mdc(PGP_Context * ctx, int disable) +pgp_disable_mdc(PGP_Context *ctx, int disable) { ctx->disable_mdc = disable ? 1 : 0; return 0; } int -pgp_set_sess_key(PGP_Context * ctx, int use) +pgp_set_sess_key(PGP_Context *ctx, int use) { ctx->use_sess_key = use ? 1 : 0; return 0; } int -pgp_set_convert_crlf(PGP_Context * ctx, int doit) +pgp_set_convert_crlf(PGP_Context *ctx, int doit) { ctx->convert_crlf = doit ? 1 : 0; return 0; } int -pgp_set_s2k_mode(PGP_Context * ctx, int mode) +pgp_set_s2k_mode(PGP_Context *ctx, int mode) { int err = PXE_OK; @@ -271,7 +271,7 @@ pgp_set_s2k_mode(PGP_Context * ctx, int mode) } int -pgp_set_compress_algo(PGP_Context * ctx, int algo) +pgp_set_compress_algo(PGP_Context *ctx, int algo) { switch (algo) { @@ -286,7 +286,7 @@ pgp_set_compress_algo(PGP_Context * ctx, int algo) } int -pgp_set_compress_level(PGP_Context * ctx, int level) +pgp_set_compress_level(PGP_Context *ctx, int level) { if (level >= 0 && level <= 9) { @@ -297,14 +297,14 @@ pgp_set_compress_level(PGP_Context * ctx, int level) } int -pgp_set_text_mode(PGP_Context * ctx, int mode) +pgp_set_text_mode(PGP_Context *ctx, int mode) { ctx->text_mode = mode; return 0; } int -pgp_set_cipher_algo(PGP_Context * ctx, const char *name) +pgp_set_cipher_algo(PGP_Context *ctx, const char *name) { int code = pgp_get_cipher_code(name); @@ -315,7 +315,7 @@ pgp_set_cipher_algo(PGP_Context * ctx, const char *name) } int -pgp_set_s2k_cipher_algo(PGP_Context * ctx, const char *name) +pgp_set_s2k_cipher_algo(PGP_Context *ctx, const char *name) { int code = pgp_get_cipher_code(name); @@ -326,7 +326,7 @@ pgp_set_s2k_cipher_algo(PGP_Context * ctx, const char *name) } int -pgp_set_s2k_digest_algo(PGP_Context * ctx, const char *name) +pgp_set_s2k_digest_algo(PGP_Context *ctx, const char *name) { int code = pgp_get_digest_code(name); @@ -337,20 +337,20 @@ pgp_set_s2k_digest_algo(PGP_Context * ctx, const char *name) } int -pgp_get_unicode_mode(PGP_Context * ctx) +pgp_get_unicode_mode(PGP_Context *ctx) { return ctx->unicode_mode; } int -pgp_set_unicode_mode(PGP_Context * ctx, int mode) +pgp_set_unicode_mode(PGP_Context *ctx, int mode) { ctx->unicode_mode = mode ? 1 : 0; return 0; } int -pgp_set_symkey(PGP_Context * ctx, const uint8 *key, int len) +pgp_set_symkey(PGP_Context *ctx, const uint8 *key, int len) { if (key == NULL || len < 1) return PXE_ARGUMENT_ERROR; diff --git a/contrib/pgcrypto/pgp.h b/contrib/pgcrypto/pgp.h index 223a8a073f..7860d830c4 100644 --- a/contrib/pgcrypto/pgp.h +++ b/contrib/pgcrypto/pgp.h @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/pgp.h,v 1.5 2009/03/25 15:03:13 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp.h,v 1.6 2009/06/11 14:48:52 momjian Exp $ */ enum PGP_S2K_TYPE @@ -224,91 +224,91 @@ struct PGP_PubKey int can_encrypt; }; -int pgp_init(PGP_Context ** ctx); -int pgp_encrypt(PGP_Context * ctx, MBuf * src, MBuf * dst); -int pgp_decrypt(PGP_Context * ctx, MBuf * src, MBuf * dst); -int pgp_free(PGP_Context * ctx); +int pgp_init(PGP_Context **ctx); +int pgp_encrypt(PGP_Context *ctx, MBuf *src, MBuf *dst); +int pgp_decrypt(PGP_Context *ctx, MBuf *src, MBuf *dst); +int pgp_free(PGP_Context *ctx); int pgp_get_digest_code(const char *name); int pgp_get_cipher_code(const char *name); const char *pgp_get_digest_name(int code); const char *pgp_get_cipher_name(int code); -int pgp_set_cipher_algo(PGP_Context * ctx, const char *name); -int pgp_set_s2k_mode(PGP_Context * ctx, int type); -int pgp_set_s2k_cipher_algo(PGP_Context * ctx, const char *name); -int pgp_set_s2k_digest_algo(PGP_Context * ctx, const char *name); -int pgp_set_convert_crlf(PGP_Context * ctx, int doit); -int pgp_disable_mdc(PGP_Context * ctx, int disable); -int pgp_set_sess_key(PGP_Context * ctx, int use); -int pgp_set_compress_algo(PGP_Context * ctx, int algo); -int pgp_set_compress_level(PGP_Context * ctx, int level); -int pgp_set_text_mode(PGP_Context * ctx, int mode); -int pgp_set_unicode_mode(PGP_Context * ctx, int mode); -int pgp_get_unicode_mode(PGP_Context * ctx); - -int pgp_set_symkey(PGP_Context * ctx, const uint8 *key, int klen); -int pgp_set_pubkey(PGP_Context * ctx, MBuf * keypkt, +int pgp_set_cipher_algo(PGP_Context *ctx, const char *name); +int pgp_set_s2k_mode(PGP_Context *ctx, int type); +int pgp_set_s2k_cipher_algo(PGP_Context *ctx, const char *name); +int pgp_set_s2k_digest_algo(PGP_Context *ctx, const char *name); +int pgp_set_convert_crlf(PGP_Context *ctx, int doit); +int pgp_disable_mdc(PGP_Context *ctx, int disable); +int pgp_set_sess_key(PGP_Context *ctx, int use); +int pgp_set_compress_algo(PGP_Context *ctx, int algo); +int pgp_set_compress_level(PGP_Context *ctx, int level); +int pgp_set_text_mode(PGP_Context *ctx, int mode); +int pgp_set_unicode_mode(PGP_Context *ctx, int mode); +int pgp_get_unicode_mode(PGP_Context *ctx); + +int pgp_set_symkey(PGP_Context *ctx, const uint8 *key, int klen); +int pgp_set_pubkey(PGP_Context *ctx, MBuf *keypkt, const uint8 *key, int klen, int pubtype); -int pgp_get_keyid(MBuf * pgp_data, char *dst); +int pgp_get_keyid(MBuf *pgp_data, char *dst); /* internal functions */ -int pgp_load_digest(int c, PX_MD ** res); -int pgp_load_cipher(int c, PX_Cipher ** res); +int pgp_load_digest(int c, PX_MD **res); +int pgp_load_cipher(int c, PX_Cipher **res); int pgp_get_cipher_key_size(int c); int pgp_get_cipher_block_size(int c); -int pgp_s2k_fill(PGP_S2K * s2k, int mode, int digest_algo); -int pgp_s2k_read(PullFilter * src, PGP_S2K * s2k); -int pgp_s2k_process(PGP_S2K * s2k, int cipher, const uint8 *key, int klen); +int pgp_s2k_fill(PGP_S2K *s2k, int mode, int digest_algo); +int pgp_s2k_read(PullFilter *src, PGP_S2K *s2k); +int pgp_s2k_process(PGP_S2K *s2k, int cipher, const uint8 *key, int klen); typedef struct PGP_CFB PGP_CFB; int -pgp_cfb_create(PGP_CFB ** ctx_p, int algo, +pgp_cfb_create(PGP_CFB **ctx_p, int algo, const uint8 *key, int key_len, int recync, uint8 *iv); -void pgp_cfb_free(PGP_CFB * ctx); -int pgp_cfb_encrypt(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst); -int pgp_cfb_decrypt(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst); +void pgp_cfb_free(PGP_CFB *ctx); +int pgp_cfb_encrypt(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst); +int pgp_cfb_decrypt(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst); int pgp_armor_encode(const uint8 *src, unsigned len, uint8 *dst); int pgp_armor_decode(const uint8 *src, unsigned len, uint8 *dst); unsigned pgp_armor_enc_len(unsigned len); unsigned pgp_armor_dec_len(unsigned len); -int pgp_compress_filter(PushFilter ** res, PGP_Context * ctx, PushFilter * dst); -int pgp_decompress_filter(PullFilter ** res, PGP_Context * ctx, PullFilter * src); +int pgp_compress_filter(PushFilter **res, PGP_Context *ctx, PushFilter *dst); +int pgp_decompress_filter(PullFilter **res, PGP_Context *ctx, PullFilter *src); -int pgp_key_alloc(PGP_PubKey ** pk_p); -void pgp_key_free(PGP_PubKey * pk); -int _pgp_read_public_key(PullFilter * pkt, PGP_PubKey ** pk_p); +int pgp_key_alloc(PGP_PubKey **pk_p); +void pgp_key_free(PGP_PubKey *pk); +int _pgp_read_public_key(PullFilter *pkt, PGP_PubKey **pk_p); -int pgp_parse_pubenc_sesskey(PGP_Context * ctx, PullFilter * pkt); -int pgp_create_pkt_reader(PullFilter ** pf_p, PullFilter * src, int len, - int pkttype, PGP_Context * ctx); -int pgp_parse_pkt_hdr(PullFilter * src, uint8 *tag, int *len_p, +int pgp_parse_pubenc_sesskey(PGP_Context *ctx, PullFilter *pkt); +int pgp_create_pkt_reader(PullFilter **pf_p, PullFilter *src, int len, + int pkttype, PGP_Context *ctx); +int pgp_parse_pkt_hdr(PullFilter *src, uint8 *tag, int *len_p, int allow_ctx); -int pgp_skip_packet(PullFilter * pkt); -int pgp_expect_packet_end(PullFilter * pkt); - -int pgp_write_pubenc_sesskey(PGP_Context * ctx, PushFilter * dst); -int pgp_create_pkt_writer(PushFilter * dst, int tag, PushFilter ** res_p); - -int pgp_mpi_alloc(int bits, PGP_MPI ** mpi); -int pgp_mpi_create(uint8 *data, int bits, PGP_MPI ** mpi); -int pgp_mpi_free(PGP_MPI * mpi); -int pgp_mpi_read(PullFilter * src, PGP_MPI ** mpi); -int pgp_mpi_write(PushFilter * dst, PGP_MPI * n); -int pgp_mpi_hash(PX_MD * md, PGP_MPI * n); -unsigned pgp_mpi_cksum(unsigned cksum, PGP_MPI * n); - -int pgp_elgamal_encrypt(PGP_PubKey * pk, PGP_MPI * m, - PGP_MPI ** c1, PGP_MPI ** c2); -int pgp_elgamal_decrypt(PGP_PubKey * pk, PGP_MPI * c1, PGP_MPI * c2, - PGP_MPI ** m); -int pgp_rsa_encrypt(PGP_PubKey * pk, PGP_MPI * m, PGP_MPI ** c); -int pgp_rsa_decrypt(PGP_PubKey * pk, PGP_MPI * c, PGP_MPI ** m); +int pgp_skip_packet(PullFilter *pkt); +int pgp_expect_packet_end(PullFilter *pkt); + +int pgp_write_pubenc_sesskey(PGP_Context *ctx, PushFilter *dst); +int pgp_create_pkt_writer(PushFilter *dst, int tag, PushFilter **res_p); + +int pgp_mpi_alloc(int bits, PGP_MPI **mpi); +int pgp_mpi_create(uint8 *data, int bits, PGP_MPI **mpi); +int pgp_mpi_free(PGP_MPI *mpi); +int pgp_mpi_read(PullFilter *src, PGP_MPI **mpi); +int pgp_mpi_write(PushFilter *dst, PGP_MPI *n); +int pgp_mpi_hash(PX_MD *md, PGP_MPI *n); +unsigned pgp_mpi_cksum(unsigned cksum, PGP_MPI *n); + +int pgp_elgamal_encrypt(PGP_PubKey *pk, PGP_MPI *m, + PGP_MPI **c1, PGP_MPI **c2); +int pgp_elgamal_decrypt(PGP_PubKey *pk, PGP_MPI *c1, PGP_MPI *c2, + PGP_MPI **m); +int pgp_rsa_encrypt(PGP_PubKey *pk, PGP_MPI *m, PGP_MPI **c); +int pgp_rsa_decrypt(PGP_PubKey *pk, PGP_MPI *c, PGP_MPI **m); extern struct PullFilterOps pgp_decrypt_filter; diff --git a/contrib/pgcrypto/px-hmac.c b/contrib/pgcrypto/px-hmac.c index fa4233903c..3b2016190e 100644 --- a/contrib/pgcrypto/px-hmac.c +++ b/contrib/pgcrypto/px-hmac.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/px-hmac.c,v 1.7 2005/07/11 15:07:59 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/px-hmac.c,v 1.8 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -37,19 +37,19 @@ #define HMAC_OPAD 0x5C static unsigned -hmac_result_size(PX_HMAC * h) +hmac_result_size(PX_HMAC *h) { return px_md_result_size(h->md); } static unsigned -hmac_block_size(PX_HMAC * h) +hmac_block_size(PX_HMAC *h) { return px_md_block_size(h->md); } static void -hmac_init(PX_HMAC * h, const uint8 *key, unsigned klen) +hmac_init(PX_HMAC *h, const uint8 *key, unsigned klen) { unsigned bs, hlen, @@ -84,7 +84,7 @@ hmac_init(PX_HMAC * h, const uint8 *key, unsigned klen) } static void -hmac_reset(PX_HMAC * h) +hmac_reset(PX_HMAC *h) { PX_MD *md = h->md; unsigned bs = px_md_block_size(md); @@ -94,13 +94,13 @@ hmac_reset(PX_HMAC * h) } static void -hmac_update(PX_HMAC * h, const uint8 *data, unsigned dlen) +hmac_update(PX_HMAC *h, const uint8 *data, unsigned dlen) { px_md_update(h->md, data, dlen); } static void -hmac_finish(PX_HMAC * h, uint8 *dst) +hmac_finish(PX_HMAC *h, uint8 *dst) { PX_MD *md = h->md; unsigned bs, @@ -124,7 +124,7 @@ hmac_finish(PX_HMAC * h, uint8 *dst) } static void -hmac_free(PX_HMAC * h) +hmac_free(PX_HMAC *h) { unsigned bs; @@ -142,7 +142,7 @@ hmac_free(PX_HMAC * h) /* PUBLIC FUNCTIONS */ int -px_find_hmac(const char *name, PX_HMAC ** res) +px_find_hmac(const char *name, PX_HMAC **res) { int err; PX_MD *md; diff --git a/contrib/pgcrypto/px.c b/contrib/pgcrypto/px.c index d1b22d7ec7..f2db06a898 100644 --- a/contrib/pgcrypto/px.c +++ b/contrib/pgcrypto/px.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/px.c,v 1.17 2007/11/15 21:14:31 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/px.c,v 1.18 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -106,7 +106,7 @@ px_strerror(int err) const char * -px_resolve_alias(const PX_Alias * list, const char *name) +px_resolve_alias(const PX_Alias *list, const char *name) { while (list->name) { @@ -146,19 +146,19 @@ px_debug(const char *fmt,...) */ static unsigned -combo_encrypt_len(PX_Combo * cx, unsigned dlen) +combo_encrypt_len(PX_Combo *cx, unsigned dlen) { return dlen + 512; } static unsigned -combo_decrypt_len(PX_Combo * cx, unsigned dlen) +combo_decrypt_len(PX_Combo *cx, unsigned dlen) { return dlen; } static int -combo_init(PX_Combo * cx, const uint8 *key, unsigned klen, +combo_init(PX_Combo *cx, const uint8 *key, unsigned klen, const uint8 *iv, unsigned ivlen) { int err; @@ -199,7 +199,7 @@ combo_init(PX_Combo * cx, const uint8 *key, unsigned klen, } static int -combo_encrypt(PX_Combo * cx, const uint8 *data, unsigned dlen, +combo_encrypt(PX_Combo *cx, const uint8 *data, unsigned dlen, uint8 *res, unsigned *rlen) { int err = 0; @@ -270,7 +270,7 @@ out: } static int -combo_decrypt(PX_Combo * cx, const uint8 *data, unsigned dlen, +combo_decrypt(PX_Combo *cx, const uint8 *data, unsigned dlen, uint8 *res, unsigned *rlen) { unsigned bs, @@ -327,7 +327,7 @@ block_error: } static void -combo_free(PX_Combo * cx) +combo_free(PX_Combo *cx) { if (cx->cipher) px_cipher_free(cx->cipher); @@ -380,7 +380,7 @@ parse_cipher_name(char *full, char **cipher, char **pad) /* provider */ int -px_find_combo(const char *name, PX_Combo ** res) +px_find_combo(const char *name, PX_Combo **res) { int err; char *buf, diff --git a/contrib/pgcrypto/px.h b/contrib/pgcrypto/px.h index 257d6015bc..c916e9361c 100644 --- a/contrib/pgcrypto/px.h +++ b/contrib/pgcrypto/px.h @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/px.h,v 1.18 2007/08/23 16:15:51 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/px.h,v 1.19 2009/06/11 14:48:52 momjian Exp $ */ #ifndef __PX_H @@ -116,12 +116,12 @@ typedef struct px_combo PX_Combo; struct px_digest { - unsigned (*result_size) (PX_MD * h); - unsigned (*block_size) (PX_MD * h); - void (*reset) (PX_MD * h); - void (*update) (PX_MD * h, const uint8 *data, unsigned dlen); - void (*finish) (PX_MD * h, uint8 *dst); - void (*free) (PX_MD * h); + unsigned (*result_size) (PX_MD *h); + unsigned (*block_size) (PX_MD *h); + void (*reset) (PX_MD *h); + void (*update) (PX_MD *h, const uint8 *data, unsigned dlen); + void (*finish) (PX_MD *h, uint8 *dst); + void (*free) (PX_MD *h); /* private */ union { @@ -138,13 +138,13 @@ struct px_alias struct px_hmac { - unsigned (*result_size) (PX_HMAC * h); - unsigned (*block_size) (PX_HMAC * h); - void (*reset) (PX_HMAC * h); - void (*update) (PX_HMAC * h, const uint8 *data, unsigned dlen); - void (*finish) (PX_HMAC * h, uint8 *dst); - void (*free) (PX_HMAC * h); - void (*init) (PX_HMAC * h, const uint8 *key, unsigned klen); + unsigned (*result_size) (PX_HMAC *h); + unsigned (*block_size) (PX_HMAC *h); + void (*reset) (PX_HMAC *h); + void (*update) (PX_HMAC *h, const uint8 *data, unsigned dlen); + void (*finish) (PX_HMAC *h, uint8 *dst); + void (*free) (PX_HMAC *h); + void (*init) (PX_HMAC *h, const uint8 *key, unsigned klen); PX_MD *md; /* private */ @@ -157,14 +157,14 @@ struct px_hmac struct px_cipher { - unsigned (*block_size) (PX_Cipher * c); - unsigned (*key_size) (PX_Cipher * c); /* max key len */ - unsigned (*iv_size) (PX_Cipher * c); - - int (*init) (PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv); - int (*encrypt) (PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res); - int (*decrypt) (PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res); - void (*free) (PX_Cipher * c); + unsigned (*block_size) (PX_Cipher *c); + unsigned (*key_size) (PX_Cipher *c); /* max key len */ + unsigned (*iv_size) (PX_Cipher *c); + + int (*init) (PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv); + int (*encrypt) (PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res); + int (*decrypt) (PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res); + void (*free) (PX_Cipher *c); /* private */ void *ptr; int pstat; /* mcrypt uses it */ @@ -172,24 +172,24 @@ struct px_cipher struct px_combo { - int (*init) (PX_Combo * cx, const uint8 *key, unsigned klen, + int (*init) (PX_Combo *cx, const uint8 *key, unsigned klen, const uint8 *iv, unsigned ivlen); - int (*encrypt) (PX_Combo * cx, const uint8 *data, unsigned dlen, + int (*encrypt) (PX_Combo *cx, const uint8 *data, unsigned dlen, uint8 *res, unsigned *rlen); - int (*decrypt) (PX_Combo * cx, const uint8 *data, unsigned dlen, + int (*decrypt) (PX_Combo *cx, const uint8 *data, unsigned dlen, uint8 *res, unsigned *rlen); - unsigned (*encrypt_len) (PX_Combo * cx, unsigned dlen); - unsigned (*decrypt_len) (PX_Combo * cx, unsigned dlen); - void (*free) (PX_Combo * cx); + unsigned (*encrypt_len) (PX_Combo *cx, unsigned dlen); + unsigned (*decrypt_len) (PX_Combo *cx, unsigned dlen); + void (*free) (PX_Combo *cx); PX_Cipher *cipher; unsigned padding; }; -int px_find_digest(const char *name, PX_MD ** res); -int px_find_hmac(const char *name, PX_HMAC ** res); -int px_find_cipher(const char *name, PX_Cipher ** res); -int px_find_combo(const char *name, PX_Combo ** res); +int px_find_digest(const char *name, PX_MD **res); +int px_find_hmac(const char *name, PX_HMAC **res); +int px_find_cipher(const char *name, PX_Cipher **res); +int px_find_combo(const char *name, PX_Combo **res); int px_get_random_bytes(uint8 *dst, unsigned count); int px_get_pseudo_random_bytes(uint8 *dst, unsigned count); @@ -199,7 +199,7 @@ unsigned px_acquire_system_randomness(uint8 *dst); const char *px_strerror(int err); -const char *px_resolve_alias(const PX_Alias * aliases, const char *name); +const char *px_resolve_alias(const PX_Alias *aliases, const char *name); void px_set_debug_handler(void (*handler) (const char *)); diff --git a/contrib/pgcrypto/rijndael.c b/contrib/pgcrypto/rijndael.c index 97f97bd543..cf9eca91dc 100644 --- a/contrib/pgcrypto/rijndael.c +++ b/contrib/pgcrypto/rijndael.c @@ -1,6 +1,6 @@ /* $OpenBSD: rijndael.c,v 1.6 2000/12/09 18:51:34 markus Exp $ */ -/* $PostgreSQL: pgsql/contrib/pgcrypto/rijndael.c,v 1.13 2007/04/06 05:36:50 tgl Exp $ */ +/* $PostgreSQL: pgsql/contrib/pgcrypto/rijndael.c,v 1.14 2009/06/11 14:48:52 momjian Exp $ */ /* This is an independent implementation of the encryption algorithm: */ /* */ @@ -302,7 +302,7 @@ do { t = ls_box(rotr(t, 8)) ^ rco_tab[i]; \ } while (0) rijndael_ctx * -rijndael_set_key(rijndael_ctx * ctx, const u4byte * in_key, const u4byte key_len, +rijndael_set_key(rijndael_ctx *ctx, const u4byte *in_key, const u4byte key_len, int encrypt) { u4byte i, @@ -384,7 +384,7 @@ do { \ } while (0) void -rijndael_encrypt(rijndael_ctx * ctx, const u4byte * in_blk, u4byte * out_blk) +rijndael_encrypt(rijndael_ctx *ctx, const u4byte *in_blk, u4byte *out_blk) { u4byte k_len = ctx->k_len; u4byte *e_key = ctx->e_key; @@ -448,7 +448,7 @@ do { \ } while (0) void -rijndael_decrypt(rijndael_ctx * ctx, const u4byte * in_blk, u4byte * out_blk) +rijndael_decrypt(rijndael_ctx *ctx, const u4byte *in_blk, u4byte *out_blk) { u4byte b0[4], b1[4], @@ -501,7 +501,7 @@ rijndael_decrypt(rijndael_ctx * ctx, const u4byte * in_blk, u4byte * out_blk) */ void -aes_set_key(rijndael_ctx * ctx, const uint8 *key, unsigned keybits, int enc) +aes_set_key(rijndael_ctx *ctx, const uint8 *key, unsigned keybits, int enc) { uint32 *k; @@ -510,7 +510,7 @@ aes_set_key(rijndael_ctx * ctx, const uint8 *key, unsigned keybits, int enc) } void -aes_ecb_encrypt(rijndael_ctx * ctx, uint8 *data, unsigned len) +aes_ecb_encrypt(rijndael_ctx *ctx, uint8 *data, unsigned len) { unsigned bs = 16; uint32 *d; @@ -526,7 +526,7 @@ aes_ecb_encrypt(rijndael_ctx * ctx, uint8 *data, unsigned len) } void -aes_ecb_decrypt(rijndael_ctx * ctx, uint8 *data, unsigned len) +aes_ecb_decrypt(rijndael_ctx *ctx, uint8 *data, unsigned len) { unsigned bs = 16; uint32 *d; @@ -542,7 +542,7 @@ aes_ecb_decrypt(rijndael_ctx * ctx, uint8 *data, unsigned len) } void -aes_cbc_encrypt(rijndael_ctx * ctx, uint8 *iva, uint8 *data, unsigned len) +aes_cbc_encrypt(rijndael_ctx *ctx, uint8 *iva, uint8 *data, unsigned len) { uint32 *iv = (uint32 *) iva; uint32 *d = (uint32 *) data; @@ -564,7 +564,7 @@ aes_cbc_encrypt(rijndael_ctx * ctx, uint8 *iva, uint8 *data, unsigned len) } void -aes_cbc_decrypt(rijndael_ctx * ctx, uint8 *iva, uint8 *data, unsigned len) +aes_cbc_decrypt(rijndael_ctx *ctx, uint8 *iva, uint8 *data, unsigned len) { uint32 *d = (uint32 *) data; unsigned bs = 16; diff --git a/contrib/pgcrypto/rijndael.h b/contrib/pgcrypto/rijndael.h index e5e862323f..e4c4229170 100644 --- a/contrib/pgcrypto/rijndael.h +++ b/contrib/pgcrypto/rijndael.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/pgcrypto/rijndael.h,v 1.6 2008/05/17 01:28:21 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/rijndael.h,v 1.7 2009/06/11 14:48:52 momjian Exp $ * * $OpenBSD: rijndael.h,v 1.3 2001/05/09 23:01:32 markus Exp $ */ @@ -36,7 +36,7 @@ typedef struct _rijndael_ctx int decrypt; u4byte e_key[64]; u4byte d_key[64]; -} rijndael_ctx; +} rijndael_ctx; /* 2. Standard interface for AES cryptographic routines */ @@ -51,10 +51,10 @@ void rijndael_decrypt(rijndael_ctx *, const u4byte *, u4byte *); /* conventional interface */ -void aes_set_key(rijndael_ctx * ctx, const uint8 *key, unsigned keybits, int enc); -void aes_ecb_encrypt(rijndael_ctx * ctx, uint8 *data, unsigned len); -void aes_ecb_decrypt(rijndael_ctx * ctx, uint8 *data, unsigned len); -void aes_cbc_encrypt(rijndael_ctx * ctx, uint8 *iva, uint8 *data, unsigned len); -void aes_cbc_decrypt(rijndael_ctx * ctx, uint8 *iva, uint8 *data, unsigned len); +void aes_set_key(rijndael_ctx *ctx, const uint8 *key, unsigned keybits, int enc); +void aes_ecb_encrypt(rijndael_ctx *ctx, uint8 *data, unsigned len); +void aes_ecb_decrypt(rijndael_ctx *ctx, uint8 *data, unsigned len); +void aes_cbc_encrypt(rijndael_ctx *ctx, uint8 *iva, uint8 *data, unsigned len); +void aes_cbc_decrypt(rijndael_ctx *ctx, uint8 *iva, uint8 *data, unsigned len); #endif /* _RIJNDAEL_H_ */ diff --git a/contrib/pgcrypto/sha2.c b/contrib/pgcrypto/sha2.c index c2e9da965b..9cd58a08ab 100644 --- a/contrib/pgcrypto/sha2.c +++ b/contrib/pgcrypto/sha2.c @@ -33,7 +33,7 @@ * * $From: sha2.c,v 1.1 2001/11/08 00:01:51 adg Exp adg $ * - * $PostgreSQL: pgsql/contrib/pgcrypto/sha2.c,v 1.10 2007/11/15 21:14:31 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/sha2.c,v 1.11 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -250,7 +250,7 @@ static const uint64 sha512_initial_hash_value[8] = { /*** SHA-256: *********************************************************/ void -SHA256_Init(SHA256_CTX * context) +SHA256_Init(SHA256_CTX *context) { if (context == NULL) return; @@ -286,7 +286,7 @@ SHA256_Init(SHA256_CTX * context) } while(0) static void -SHA256_Transform(SHA256_CTX * context, const uint8 *data) +SHA256_Transform(SHA256_CTX *context, const uint8 *data) { uint32 a, b, @@ -357,7 +357,7 @@ SHA256_Transform(SHA256_CTX * context, const uint8 *data) #else /* SHA2_UNROLL_TRANSFORM */ static void -SHA256_Transform(SHA256_CTX * context, const uint8 *data) +SHA256_Transform(SHA256_CTX *context, const uint8 *data) { uint32 a, b, @@ -447,7 +447,7 @@ SHA256_Transform(SHA256_CTX * context, const uint8 *data) #endif /* SHA2_UNROLL_TRANSFORM */ void -SHA256_Update(SHA256_CTX * context, const uint8 *data, size_t len) +SHA256_Update(SHA256_CTX *context, const uint8 *data, size_t len) { size_t freespace, usedspace; @@ -500,7 +500,7 @@ SHA256_Update(SHA256_CTX * context, const uint8 *data, size_t len) } static void -SHA256_Last(SHA256_CTX * context) +SHA256_Last(SHA256_CTX *context) { unsigned int usedspace; @@ -548,7 +548,7 @@ SHA256_Last(SHA256_CTX * context) } void -SHA256_Final(uint8 digest[], SHA256_CTX * context) +SHA256_Final(uint8 digest[], SHA256_CTX *context) { /* If no digest buffer is passed, we don't bother doing this: */ if (digest != NULL) @@ -576,7 +576,7 @@ SHA256_Final(uint8 digest[], SHA256_CTX * context) /*** SHA-512: *********************************************************/ void -SHA512_Init(SHA512_CTX * context) +SHA512_Init(SHA512_CTX *context) { if (context == NULL) return; @@ -615,7 +615,7 @@ SHA512_Init(SHA512_CTX * context) } while(0) static void -SHA512_Transform(SHA512_CTX * context, const uint8 *data) +SHA512_Transform(SHA512_CTX *context, const uint8 *data) { uint64 a, b, @@ -683,7 +683,7 @@ SHA512_Transform(SHA512_CTX * context, const uint8 *data) #else /* SHA2_UNROLL_TRANSFORM */ static void -SHA512_Transform(SHA512_CTX * context, const uint8 *data) +SHA512_Transform(SHA512_CTX *context, const uint8 *data) { uint64 a, b, @@ -773,7 +773,7 @@ SHA512_Transform(SHA512_CTX * context, const uint8 *data) #endif /* SHA2_UNROLL_TRANSFORM */ void -SHA512_Update(SHA512_CTX * context, const uint8 *data, size_t len) +SHA512_Update(SHA512_CTX *context, const uint8 *data, size_t len) { size_t freespace, usedspace; @@ -826,7 +826,7 @@ SHA512_Update(SHA512_CTX * context, const uint8 *data, size_t len) } static void -SHA512_Last(SHA512_CTX * context) +SHA512_Last(SHA512_CTX *context) { unsigned int usedspace; @@ -876,7 +876,7 @@ SHA512_Last(SHA512_CTX * context) } void -SHA512_Final(uint8 digest[], SHA512_CTX * context) +SHA512_Final(uint8 digest[], SHA512_CTX *context) { /* If no digest buffer is passed, we don't bother doing this: */ if (digest != NULL) @@ -905,7 +905,7 @@ SHA512_Final(uint8 digest[], SHA512_CTX * context) /*** SHA-384: *********************************************************/ void -SHA384_Init(SHA384_CTX * context) +SHA384_Init(SHA384_CTX *context) { if (context == NULL) return; @@ -915,13 +915,13 @@ SHA384_Init(SHA384_CTX * context) } void -SHA384_Update(SHA384_CTX * context, const uint8 *data, size_t len) +SHA384_Update(SHA384_CTX *context, const uint8 *data, size_t len) { SHA512_Update((SHA512_CTX *) context, data, len); } void -SHA384_Final(uint8 digest[], SHA384_CTX * context) +SHA384_Final(uint8 digest[], SHA384_CTX *context) { /* If no digest buffer is passed, we don't bother doing this: */ if (digest != NULL) @@ -949,7 +949,7 @@ SHA384_Final(uint8 digest[], SHA384_CTX * context) /*** SHA-224: *********************************************************/ void -SHA224_Init(SHA224_CTX * context) +SHA224_Init(SHA224_CTX *context) { if (context == NULL) return; @@ -959,13 +959,13 @@ SHA224_Init(SHA224_CTX * context) } void -SHA224_Update(SHA224_CTX * context, const uint8 *data, size_t len) +SHA224_Update(SHA224_CTX *context, const uint8 *data, size_t len) { SHA256_Update((SHA256_CTX *) context, data, len); } void -SHA224_Final(uint8 digest[], SHA224_CTX * context) +SHA224_Final(uint8 digest[], SHA224_CTX *context) { /* If no digest buffer is passed, we don't bother doing this: */ if (digest != NULL) diff --git a/contrib/pgcrypto/sha2.h b/contrib/pgcrypto/sha2.h index f6fde39c5b..8d593c60e5 100644 --- a/contrib/pgcrypto/sha2.h +++ b/contrib/pgcrypto/sha2.h @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/contrib/pgcrypto/sha2.h,v 1.4 2006/07/13 04:15:25 neilc Exp $ */ +/* $PostgreSQL: pgsql/contrib/pgcrypto/sha2.h,v 1.5 2009/06/11 14:48:52 momjian Exp $ */ /* $OpenBSD: sha2.h,v 1.2 2004/04/28 23:11:57 millert Exp $ */ /* @@ -70,13 +70,13 @@ typedef struct _SHA256_CTX uint32 state[8]; uint64 bitcount; uint8 buffer[SHA256_BLOCK_LENGTH]; -} SHA256_CTX; +} SHA256_CTX; typedef struct _SHA512_CTX { uint64 state[8]; uint64 bitcount[2]; uint8 buffer[SHA512_BLOCK_LENGTH]; -} SHA512_CTX; +} SHA512_CTX; typedef SHA256_CTX SHA224_CTX; typedef SHA512_CTX SHA384_CTX; diff --git a/contrib/pgrowlocks/pgrowlocks.c b/contrib/pgrowlocks/pgrowlocks.c index e41c59e798..e0d21a8926 100644 --- a/contrib/pgrowlocks/pgrowlocks.c +++ b/contrib/pgrowlocks/pgrowlocks.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/pgrowlocks/pgrowlocks.c,v 1.11 2008/06/19 00:46:03 alvherre Exp $ + * $PostgreSQL: pgsql/contrib/pgrowlocks/pgrowlocks.c,v 1.12 2009/06/11 14:48:52 momjian Exp $ * * Copyright (c) 2005-2006 Tatsuo Ishii * @@ -57,7 +57,7 @@ typedef struct Relation rel; HeapScanDesc scan; int ncolumns; -} MyData; +} MyData; Datum pgrowlocks(PG_FUNCTION_ARGS) diff --git a/contrib/pgstattuple/pgstatindex.c b/contrib/pgstattuple/pgstatindex.c index b00ae5b766..83b50bb432 100644 --- a/contrib/pgstattuple/pgstatindex.c +++ b/contrib/pgstattuple/pgstatindex.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/pgstattuple/pgstatindex.c,v 1.12 2009/03/31 22:54:31 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pgstattuple/pgstatindex.c,v 1.13 2009/06/11 14:48:52 momjian Exp $ * * * pgstatindex @@ -76,7 +76,7 @@ typedef struct BTIndexStat uint64 free_space; uint64 fragments; -} BTIndexStat; +} BTIndexStat; /* ------------------------------------------------------ * pgstatindex() @@ -91,8 +91,8 @@ pgstatindex(PG_FUNCTION_ARGS) Relation rel; RangeVar *relrv; Datum result; - BlockNumber nblocks; - BlockNumber blkno; + BlockNumber nblocks; + BlockNumber blkno; BTIndexStat indexStat; if (!superuser()) @@ -108,9 +108,9 @@ pgstatindex(PG_FUNCTION_ARGS) RelationGetRelationName(rel)); /* - * Reject attempts to read non-local temporary relations; we would - * be likely to get wrong data since we have no visibility into the - * owning session's local buffers. + * Reject attempts to read non-local temporary relations; we would be + * likely to get wrong data since we have no visibility into the owning + * session's local buffers. */ if (RELATION_IS_OTHER_TEMP(rel)) ereport(ERROR, diff --git a/contrib/pgstattuple/pgstattuple.c b/contrib/pgstattuple/pgstattuple.c index c2c5d11e5a..5d6168f77d 100644 --- a/contrib/pgstattuple/pgstattuple.c +++ b/contrib/pgstattuple/pgstattuple.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.37 2009/03/31 22:54:31 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.38 2009/06/11 14:48:52 momjian Exp $ * * Copyright (c) 2001,2002 Tatsuo Ishii * @@ -59,30 +59,30 @@ typedef struct pgstattuple_type uint64 dead_tuple_count; uint64 dead_tuple_len; uint64 free_space; /* free/reusable space in bytes */ -} pgstattuple_type; +} pgstattuple_type; typedef void (*pgstat_page) (pgstattuple_type *, Relation, BlockNumber); -static Datum build_pgstattuple_type(pgstattuple_type * stat, +static Datum build_pgstattuple_type(pgstattuple_type *stat, FunctionCallInfo fcinfo); static Datum pgstat_relation(Relation rel, FunctionCallInfo fcinfo); static Datum pgstat_heap(Relation rel, FunctionCallInfo fcinfo); -static void pgstat_btree_page(pgstattuple_type * stat, +static void pgstat_btree_page(pgstattuple_type *stat, Relation rel, BlockNumber blkno); -static void pgstat_hash_page(pgstattuple_type * stat, +static void pgstat_hash_page(pgstattuple_type *stat, Relation rel, BlockNumber blkno); -static void pgstat_gist_page(pgstattuple_type * stat, +static void pgstat_gist_page(pgstattuple_type *stat, Relation rel, BlockNumber blkno); static Datum pgstat_index(Relation rel, BlockNumber start, pgstat_page pagefn, FunctionCallInfo fcinfo); -static void pgstat_index_page(pgstattuple_type * stat, Page page, +static void pgstat_index_page(pgstattuple_type *stat, Page page, OffsetNumber minoff, OffsetNumber maxoff); /* * build_pgstattuple_type -- build a pgstattuple_type tuple */ static Datum -build_pgstattuple_type(pgstattuple_type * stat, FunctionCallInfo fcinfo) +build_pgstattuple_type(pgstattuple_type *stat, FunctionCallInfo fcinfo) { #define NCOLUMNS 9 #define NCHARS 32 @@ -200,9 +200,9 @@ pgstat_relation(Relation rel, FunctionCallInfo fcinfo) const char *err; /* - * Reject attempts to read non-local temporary relations; we would - * be likely to get wrong data since we have no visibility into the - * owning session's local buffers. + * Reject attempts to read non-local temporary relations; we would be + * likely to get wrong data since we have no visibility into the owning + * session's local buffers. */ if (RELATION_IS_OTHER_TEMP(rel)) ereport(ERROR, @@ -331,7 +331,7 @@ pgstat_heap(Relation rel, FunctionCallInfo fcinfo) * pgstat_btree_page -- check tuples in a btree page */ static void -pgstat_btree_page(pgstattuple_type * stat, Relation rel, BlockNumber blkno) +pgstat_btree_page(pgstattuple_type *stat, Relation rel, BlockNumber blkno) { Buffer buf; Page page; @@ -374,7 +374,7 @@ pgstat_btree_page(pgstattuple_type * stat, Relation rel, BlockNumber blkno) * pgstat_hash_page -- check tuples in a hash page */ static void -pgstat_hash_page(pgstattuple_type * stat, Relation rel, BlockNumber blkno) +pgstat_hash_page(pgstattuple_type *stat, Relation rel, BlockNumber blkno) { Buffer buf; Page page; @@ -417,7 +417,7 @@ pgstat_hash_page(pgstattuple_type * stat, Relation rel, BlockNumber blkno) * pgstat_gist_page -- check tuples in a gist page */ static void -pgstat_gist_page(pgstattuple_type * stat, Relation rel, BlockNumber blkno) +pgstat_gist_page(pgstattuple_type *stat, Relation rel, BlockNumber blkno) { Buffer buf; Page page; @@ -480,7 +480,7 @@ pgstat_index(Relation rel, BlockNumber start, pgstat_page pagefn, * pgstat_index_page -- for generic index page */ static void -pgstat_index_page(pgstattuple_type * stat, Page page, +pgstat_index_page(pgstattuple_type *stat, Page page, OffsetNumber minoff, OffsetNumber maxoff) { OffsetNumber i; diff --git a/contrib/seg/seg.c b/contrib/seg/seg.c index 8a95a1d5cc..930a35b009 100644 --- a/contrib/seg/seg.c +++ b/contrib/seg/seg.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/seg/seg.c,v 1.24 2008/05/17 01:28:22 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/seg/seg.c,v 1.25 2009/06/11 14:48:52 momjian Exp $ * ****************************************************************************** This file contains routines that can be bound to a Postgres backend and @@ -53,49 +53,49 @@ Datum seg_center(PG_FUNCTION_ARGS); /* ** GiST support methods */ -bool gseg_consistent(GISTENTRY *entry, - SEG * query, - StrategyNumber strategy, - Oid subtype, - bool *recheck); +bool gseg_consistent(GISTENTRY *entry, + SEG *query, + StrategyNumber strategy, + Oid subtype, + bool *recheck); GISTENTRY *gseg_compress(GISTENTRY *entry); GISTENTRY *gseg_decompress(GISTENTRY *entry); float *gseg_penalty(GISTENTRY *origentry, GISTENTRY *newentry, float *result); GIST_SPLITVEC *gseg_picksplit(GistEntryVector *entryvec, GIST_SPLITVEC *v); -bool gseg_leaf_consistent(SEG * key, SEG * query, StrategyNumber strategy); -bool gseg_internal_consistent(SEG * key, SEG * query, StrategyNumber strategy); +bool gseg_leaf_consistent(SEG *key, SEG *query, StrategyNumber strategy); +bool gseg_internal_consistent(SEG *key, SEG *query, StrategyNumber strategy); SEG *gseg_union(GistEntryVector *entryvec, int *sizep); -SEG *gseg_binary_union(SEG * r1, SEG * r2, int *sizep); -bool *gseg_same(SEG * b1, SEG * b2, bool *result); +SEG *gseg_binary_union(SEG *r1, SEG *r2, int *sizep); +bool *gseg_same(SEG *b1, SEG *b2, bool *result); /* ** R-tree support functions */ -bool seg_same(SEG * a, SEG * b); -bool seg_contains_int(SEG * a, int *b); -bool seg_contains_float4(SEG * a, float4 *b); -bool seg_contains_float8(SEG * a, float8 *b); -bool seg_contains(SEG * a, SEG * b); -bool seg_contained(SEG * a, SEG * b); -bool seg_overlap(SEG * a, SEG * b); -bool seg_left(SEG * a, SEG * b); -bool seg_over_left(SEG * a, SEG * b); -bool seg_right(SEG * a, SEG * b); -bool seg_over_right(SEG * a, SEG * b); -SEG *seg_union(SEG * a, SEG * b); -SEG *seg_inter(SEG * a, SEG * b); -void rt_seg_size(SEG * a, float *sz); +bool seg_same(SEG *a, SEG *b); +bool seg_contains_int(SEG *a, int *b); +bool seg_contains_float4(SEG *a, float4 *b); +bool seg_contains_float8(SEG *a, float8 *b); +bool seg_contains(SEG *a, SEG *b); +bool seg_contained(SEG *a, SEG *b); +bool seg_overlap(SEG *a, SEG *b); +bool seg_left(SEG *a, SEG *b); +bool seg_over_left(SEG *a, SEG *b); +bool seg_right(SEG *a, SEG *b); +bool seg_over_right(SEG *a, SEG *b); +SEG *seg_union(SEG *a, SEG *b); +SEG *seg_inter(SEG *a, SEG *b); +void rt_seg_size(SEG *a, float *sz); /* ** Various operators */ -int32 seg_cmp(SEG * a, SEG * b); -bool seg_lt(SEG * a, SEG * b); -bool seg_le(SEG * a, SEG * b); -bool seg_gt(SEG * a, SEG * b); -bool seg_ge(SEG * a, SEG * b); -bool seg_different(SEG * a, SEG * b); +int32 seg_cmp(SEG *a, SEG *b); +bool seg_lt(SEG *a, SEG *b); +bool seg_le(SEG *a, SEG *b); +bool seg_gt(SEG *a, SEG *b); +bool seg_ge(SEG *a, SEG *b); +bool seg_different(SEG *a, SEG *b); /* ** Auxiliary funxtions @@ -168,7 +168,7 @@ seg_out(PG_FUNCTION_ARGS) Datum seg_center(PG_FUNCTION_ARGS) { - SEG *seg = (SEG *) PG_GETARG_POINTER(0); + SEG *seg = (SEG *) PG_GETARG_POINTER(0); PG_RETURN_FLOAT4(((float) seg->lower + (float) seg->upper) / 2.0); } @@ -176,7 +176,7 @@ seg_center(PG_FUNCTION_ARGS) Datum seg_lower(PG_FUNCTION_ARGS) { - SEG *seg = (SEG *) PG_GETARG_POINTER(0); + SEG *seg = (SEG *) PG_GETARG_POINTER(0); PG_RETURN_FLOAT4(seg->lower); } @@ -184,7 +184,7 @@ seg_lower(PG_FUNCTION_ARGS) Datum seg_upper(PG_FUNCTION_ARGS) { - SEG *seg = (SEG *) PG_GETARG_POINTER(0); + SEG *seg = (SEG *) PG_GETARG_POINTER(0); PG_RETURN_FLOAT4(seg->upper); } @@ -202,7 +202,7 @@ seg_upper(PG_FUNCTION_ARGS) */ bool gseg_consistent(GISTENTRY *entry, - SEG * query, + SEG *query, StrategyNumber strategy, Oid subtype, bool *recheck) @@ -449,7 +449,7 @@ gseg_picksplit(GistEntryVector *entryvec, ** Equality methods */ bool * -gseg_same(SEG * b1, SEG * b2, bool *result) +gseg_same(SEG *b1, SEG *b2, bool *result) { if (seg_same(b1, b2)) *result = TRUE; @@ -467,8 +467,8 @@ gseg_same(SEG * b1, SEG * b2, bool *result) ** SUPPORT ROUTINES */ bool -gseg_leaf_consistent(SEG * key, - SEG * query, +gseg_leaf_consistent(SEG *key, + SEG *query, StrategyNumber strategy) { bool retval; @@ -512,8 +512,8 @@ gseg_leaf_consistent(SEG * key, } bool -gseg_internal_consistent(SEG * key, - SEG * query, +gseg_internal_consistent(SEG *key, + SEG *query, StrategyNumber strategy) { bool retval; @@ -555,7 +555,7 @@ gseg_internal_consistent(SEG * key, } SEG * -gseg_binary_union(SEG * r1, SEG * r2, int *sizep) +gseg_binary_union(SEG *r1, SEG *r2, int *sizep) { SEG *retval; @@ -567,13 +567,13 @@ gseg_binary_union(SEG * r1, SEG * r2, int *sizep) bool -seg_contains(SEG * a, SEG * b) +seg_contains(SEG *a, SEG *b) { return ((a->lower <= b->lower) && (a->upper >= b->upper)); } bool -seg_contained(SEG * a, SEG * b) +seg_contained(SEG *a, SEG *b) { return (seg_contains(b, a)); } @@ -583,7 +583,7 @@ seg_contained(SEG * a, SEG * b) *****************************************************************************/ bool -seg_same(SEG * a, SEG * b) +seg_same(SEG *a, SEG *b) { return seg_cmp(a, b) == 0; } @@ -591,7 +591,7 @@ seg_same(SEG * a, SEG * b) /* seg_overlap -- does a overlap b? */ bool -seg_overlap(SEG * a, SEG * b) +seg_overlap(SEG *a, SEG *b) { return ( ((a->upper >= b->upper) && (a->lower <= b->upper)) @@ -603,7 +603,7 @@ seg_overlap(SEG * a, SEG * b) /* seg_overleft -- is the right edge of (a) located at or left of the right edge of (b)? */ bool -seg_over_left(SEG * a, SEG * b) +seg_over_left(SEG *a, SEG *b) { return (a->upper <= b->upper); } @@ -611,7 +611,7 @@ seg_over_left(SEG * a, SEG * b) /* seg_left -- is (a) entirely on the left of (b)? */ bool -seg_left(SEG * a, SEG * b) +seg_left(SEG *a, SEG *b) { return (a->upper < b->lower); } @@ -619,7 +619,7 @@ seg_left(SEG * a, SEG * b) /* seg_right -- is (a) entirely on the right of (b)? */ bool -seg_right(SEG * a, SEG * b) +seg_right(SEG *a, SEG *b) { return (a->lower > b->upper); } @@ -627,14 +627,14 @@ seg_right(SEG * a, SEG * b) /* seg_overright -- is the left edge of (a) located at or right of the left edge of (b)? */ bool -seg_over_right(SEG * a, SEG * b) +seg_over_right(SEG *a, SEG *b) { return (a->lower >= b->lower); } SEG * -seg_union(SEG * a, SEG * b) +seg_union(SEG *a, SEG *b) { SEG *n; @@ -673,7 +673,7 @@ seg_union(SEG * a, SEG * b) SEG * -seg_inter(SEG * a, SEG * b) +seg_inter(SEG *a, SEG *b) { SEG *n; @@ -711,7 +711,7 @@ seg_inter(SEG * a, SEG * b) } void -rt_seg_size(SEG * a, float *size) +rt_seg_size(SEG *a, float *size) { if (a == (SEG *) NULL || a->upper <= a->lower) *size = 0.0; @@ -724,7 +724,7 @@ rt_seg_size(SEG * a, float *size) Datum seg_size(PG_FUNCTION_ARGS) { - SEG *seg = (SEG *) PG_GETARG_POINTER(0); + SEG *seg = (SEG *) PG_GETARG_POINTER(0); PG_RETURN_FLOAT4((float) Abs(seg->upper - seg->lower)); } @@ -734,7 +734,7 @@ seg_size(PG_FUNCTION_ARGS) * Miscellaneous operators *****************************************************************************/ int32 -seg_cmp(SEG * a, SEG * b) +seg_cmp(SEG *a, SEG *b) { /* * First compare on lower boundary position @@ -853,31 +853,31 @@ seg_cmp(SEG * a, SEG * b) } bool -seg_lt(SEG * a, SEG * b) +seg_lt(SEG *a, SEG *b) { return seg_cmp(a, b) < 0; } bool -seg_le(SEG * a, SEG * b) +seg_le(SEG *a, SEG *b) { return seg_cmp(a, b) <= 0; } bool -seg_gt(SEG * a, SEG * b) +seg_gt(SEG *a, SEG *b) { return seg_cmp(a, b) > 0; } bool -seg_ge(SEG * a, SEG * b) +seg_ge(SEG *a, SEG *b) { return seg_cmp(a, b) >= 0; } bool -seg_different(SEG * a, SEG * b) +seg_different(SEG *a, SEG *b) { return seg_cmp(a, b) != 0; } @@ -1042,19 +1042,19 @@ restore(char *result, float val, int n) */ bool -seg_contains_int(SEG * a, int *b) +seg_contains_int(SEG *a, int *b) { return ((a->lower <= *b) && (a->upper >= *b)); } bool -seg_contains_float4(SEG * a, float4 *b) +seg_contains_float4(SEG *a, float4 *b) { return ((a->lower <= *b) && (a->upper >= *b)); } bool -seg_contains_float8(SEG * a, float8 *b) +seg_contains_float8(SEG *a, float8 *b) { return ((a->lower <= *b) && (a->upper >= *b)); } diff --git a/contrib/seg/segdata.h b/contrib/seg/segdata.h index ce177fb80b..c92854da83 100644 --- a/contrib/seg/segdata.h +++ b/contrib/seg/segdata.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/seg/segdata.h,v 1.5 2008/05/17 01:28:22 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/seg/segdata.h,v 1.6 2009/06/11 14:48:52 momjian Exp $ */ typedef struct SEG { @@ -9,4 +9,4 @@ typedef struct SEG char u_sigd; char l_ext; char u_ext; -} SEG; +} SEG; diff --git a/contrib/spi/autoinc.c b/contrib/spi/autoinc.c index f555414664..f79317a1b1 100644 --- a/contrib/spi/autoinc.c +++ b/contrib/spi/autoinc.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/spi/autoinc.c,v 1.16 2009/01/07 13:44:36 tgl Exp $ + * $PostgreSQL: pgsql/contrib/spi/autoinc.c,v 1.17 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index aaef7b4977..5a446c3709 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/spi/refint.c,v 1.34 2009/01/07 13:44:36 tgl Exp $ + * $PostgreSQL: pgsql/contrib/spi/refint.c,v 1.35 2009/06/11 14:48:52 momjian Exp $ * * * refint.c -- set of functions to define referential integrity @@ -24,14 +24,14 @@ typedef struct char *ident; int nplans; SPIPlanPtr *splan; -} EPlan; +} EPlan; static EPlan *FPlans = NULL; static int nFPlans = 0; static EPlan *PPlans = NULL; static int nPPlans = 0; -static EPlan *find_plan(char *ident, EPlan ** eplan, int *nplans); +static EPlan *find_plan(char *ident, EPlan **eplan, int *nplans); /* * check_primary_key () -- check that key in tuple being inserted/updated @@ -613,7 +613,7 @@ check_foreign_key(PG_FUNCTION_ARGS) } static EPlan * -find_plan(char *ident, EPlan ** eplan, int *nplans) +find_plan(char *ident, EPlan **eplan, int *nplans) { EPlan *newp; int i; diff --git a/contrib/spi/timetravel.c b/contrib/spi/timetravel.c index a949d2d817..577767d81f 100644 --- a/contrib/spi/timetravel.c +++ b/contrib/spi/timetravel.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/spi/timetravel.c,v 1.30 2009/01/07 13:44:36 tgl Exp $ + * $PostgreSQL: pgsql/contrib/spi/timetravel.c,v 1.31 2009/06/11 14:48:52 momjian Exp $ * * * timetravel.c -- function to get time travel feature @@ -29,7 +29,7 @@ typedef struct { char *ident; SPIPlanPtr splan; -} EPlan; +} EPlan; static EPlan *Plans = NULL; /* for UPDATE/DELETE */ static int nPlans = 0; @@ -38,12 +38,12 @@ typedef struct _TTOffList { struct _TTOffList *next; char name[1]; -} TTOffList; +} TTOffList; static TTOffList TTOff = {NULL, {0}}; static int findTTStatus(char *name); -static EPlan *find_plan(char *ident, EPlan ** eplan, int *nplans); +static EPlan *find_plan(char *ident, EPlan **eplan, int *nplans); /* * timetravel () -- @@ -517,7 +517,7 @@ currabstime() */ static EPlan * -find_plan(char *ident, EPlan ** eplan, int *nplans) +find_plan(char *ident, EPlan **eplan, int *nplans) { EPlan *newp; int i; diff --git a/contrib/tablefunc/tablefunc.c b/contrib/tablefunc/tablefunc.c index 5829c84111..48512bd934 100644 --- a/contrib/tablefunc/tablefunc.c +++ b/contrib/tablefunc/tablefunc.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/tablefunc/tablefunc.c,v 1.59 2009/01/07 13:44:36 tgl Exp $ + * $PostgreSQL: pgsql/contrib/tablefunc/tablefunc.c,v 1.60 2009/06/11 14:48:52 momjian Exp $ * * * tablefunc @@ -93,7 +93,7 @@ typedef struct float8 stddev; /* stddev of the distribution */ float8 carry_val; /* hold second generated value */ bool use_carry; /* use second generated value */ -} normal_rand_fctx; +} normal_rand_fctx; #define xpfree(var_) \ do { \ @@ -124,7 +124,7 @@ typedef struct crosstab_cat_desc { char *catname; /* full category name */ int attidx; /* zero based */ -} crosstab_cat_desc; +} crosstab_cat_desc; #define MAX_CATNAME_LEN NAMEDATALEN #define INIT_CATS 64 @@ -163,7 +163,7 @@ typedef struct crosstab_hashent { char internal_catname[MAX_CATNAME_LEN]; crosstab_cat_desc *catdesc; -} crosstab_HashEnt; +} crosstab_HashEnt; /* * normal_rand - return requested number of random values @@ -440,8 +440,8 @@ crosstab(PG_FUNCTION_ARGS) } /* - * Check that return tupdesc is compatible with the data we got from - * SPI, at least based on number and type of attributes + * Check that return tupdesc is compatible with the data we got from SPI, + * at least based on number and type of attributes */ if (!compatCrosstabTupleDescs(tupdesc, spi_tupdesc)) ereport(ERROR, @@ -465,8 +465,8 @@ crosstab(PG_FUNCTION_ARGS) MemoryContextSwitchTo(oldcontext); /* - * Generate attribute metadata needed later to produce tuples from raw - * C strings + * Generate attribute metadata needed later to produce tuples from raw C + * strings */ attinmeta = TupleDescGetAttInMetadata(tupdesc); @@ -488,8 +488,8 @@ crosstab(PG_FUNCTION_ARGS) values = (char **) palloc0((1 + num_categories) * sizeof(char *)); /* - * now loop through the sql results and assign each value in - * sequence to the next category + * now loop through the sql results and assign each value in sequence + * to the next category */ for (i = 0; i < num_categories; i++) { @@ -507,16 +507,16 @@ crosstab(PG_FUNCTION_ARGS) rowid = SPI_getvalue(spi_tuple, spi_tupdesc, 1); /* - * If this is the first pass through the values for this - * rowid, set the first column to rowid + * If this is the first pass through the values for this rowid, + * set the first column to rowid */ if (i == 0) { xpstrdup(values[0], rowid); /* - * Check to see if the rowid is the same as that of the - * last tuple sent -- if so, skip this tuple entirely + * Check to see if the rowid is the same as that of the last + * tuple sent -- if so, skip this tuple entirely */ if (!firstpass && xstreq(lastrowid, rowid)) { @@ -533,18 +533,18 @@ crosstab(PG_FUNCTION_ARGS) if (xstreq(rowid, values[0])) { /* - * Get the next category item value, which is always - * attribute number three. + * Get the next category item value, which is always attribute + * number three. * - * Be careful to assign the value to the array index based - * on which category we are presently processing. + * Be careful to assign the value to the array index based on + * which category we are presently processing. */ values[1 + i] = SPI_getvalue(spi_tuple, spi_tupdesc, 3); /* * increment the counter since we consume a row for each - * category, but not for last pass because the outer loop - * will do that for us + * category, but not for last pass because the outer loop will + * do that for us */ if (i < (num_categories - 1)) call_cntr++; @@ -553,9 +553,9 @@ crosstab(PG_FUNCTION_ARGS) else { /* - * We'll fill in NULLs for the missing values, but we need - * to decrement the counter since this sql result row - * doesn't belong to the current output tuple. + * We'll fill in NULLs for the missing values, but we need to + * decrement the counter since this sql result row doesn't + * belong to the current output tuple. */ call_cntr--; xpfree(rowid); @@ -690,7 +690,7 @@ crosstab_hash(PG_FUNCTION_ARGS) crosstab_hash, tupdesc, per_query_ctx, - rsinfo->allowedModes & SFRM_Materialize_Random); + rsinfo->allowedModes & SFRM_Materialize_Random); /* * SFRM_Materialize mode expects us to return a NULL Datum. The actual @@ -1059,7 +1059,7 @@ connectby_text(PG_FUNCTION_ARGS) show_branch, show_serial, per_query_ctx, - rsinfo->allowedModes & SFRM_Materialize_Random, + rsinfo->allowedModes & SFRM_Materialize_Random, attinmeta); rsinfo->setDesc = tupdesc; @@ -1139,7 +1139,7 @@ connectby_text_serial(PG_FUNCTION_ARGS) show_branch, show_serial, per_query_ctx, - rsinfo->allowedModes & SFRM_Materialize_Random, + rsinfo->allowedModes & SFRM_Materialize_Random, attinmeta); rsinfo->setDesc = tupdesc; @@ -1603,7 +1603,7 @@ quote_literal_cstr(char *rawstr) rawstr_text = cstring_to_text(rawstr); result_text = DatumGetTextP(DirectFunctionCall1(quote_literal, - PointerGetDatum(rawstr_text))); + PointerGetDatum(rawstr_text))); result = text_to_cstring(result_text); return result; diff --git a/contrib/tablefunc/tablefunc.h b/contrib/tablefunc/tablefunc.h index b2044cbc14..f884b55c33 100644 --- a/contrib/tablefunc/tablefunc.h +++ b/contrib/tablefunc/tablefunc.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/tablefunc/tablefunc.h,v 1.15 2009/01/01 17:23:32 momjian Exp $ + * $PostgreSQL: pgsql/contrib/tablefunc/tablefunc.h,v 1.16 2009/06/11 14:48:52 momjian Exp $ * * * tablefunc diff --git a/contrib/test_parser/test_parser.c b/contrib/test_parser/test_parser.c index e3634a8355..2317f25d0f 100644 --- a/contrib/test_parser/test_parser.c +++ b/contrib/test_parser/test_parser.c @@ -6,7 +6,7 @@ * Copyright (c) 2007-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/contrib/test_parser/test_parser.c,v 1.5 2009/01/01 17:23:32 momjian Exp $ + * $PostgreSQL: pgsql/contrib/test_parser/test_parser.c,v 1.6 2009/06/11 14:48:52 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -27,7 +27,7 @@ typedef struct char *buffer; /* text to parse */ int len; /* length of the text in buffer */ int pos; /* position of the parser */ -} ParserState; +} ParserState; /* copy-paste from wparser.h of tsearch2 */ typedef struct diff --git a/contrib/tsearch2/tsearch2.c b/contrib/tsearch2/tsearch2.c index 2544bc24c1..2452ec69b4 100644 --- a/contrib/tsearch2/tsearch2.c +++ b/contrib/tsearch2/tsearch2.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/contrib/tsearch2/tsearch2.c,v 1.9 2009/01/28 18:31:32 teodor Exp $ + * $PostgreSQL: pgsql/contrib/tsearch2/tsearch2.c,v 1.10 2009/06/11 14:48:52 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -367,7 +367,7 @@ tsa_tsearch2(PG_FUNCTION_ARGS) { TriggerData *trigdata; Trigger *trigger; - char **tgargs, + char **tgargs, **tgargs_old; int i; Datum res; diff --git a/contrib/uuid-ossp/uuid-ossp.c b/contrib/uuid-ossp/uuid-ossp.c index 9ab70f9431..71db0ac269 100644 --- a/contrib/uuid-ossp/uuid-ossp.c +++ b/contrib/uuid-ossp/uuid-ossp.c @@ -4,7 +4,7 @@ * * Copyright (c) 2007-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/contrib/uuid-ossp/uuid-ossp.c,v 1.10 2009/01/01 18:21:19 momjian Exp $ + * $PostgreSQL: pgsql/contrib/uuid-ossp/uuid-ossp.c,v 1.11 2009/06/11 14:48:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -67,7 +67,7 @@ PG_FUNCTION_INFO_V1(uuid_generate_v5); static void pguuid_complain(uuid_rc_t rc) { - char *err = uuid_error(rc); + char *err = uuid_error(rc); if (err != NULL) ereport(ERROR, @@ -80,7 +80,7 @@ pguuid_complain(uuid_rc_t rc) } static char * -uuid_to_string(const uuid_t * uuid) +uuid_to_string(const uuid_t *uuid) { char *buf = palloc(UUID_LEN_STR + 1); void *ptr = buf; @@ -96,7 +96,7 @@ uuid_to_string(const uuid_t * uuid) static void -string_to_uuid(const char *str, uuid_t * uuid) +string_to_uuid(const char *str, uuid_t *uuid) { uuid_rc_t rc; @@ -164,7 +164,7 @@ uuid_ns_x500(PG_FUNCTION_ARGS) static Datum -uuid_generate_internal(int mode, const uuid_t * ns, const char *name) +uuid_generate_internal(int mode, const uuid_t *ns, const char *name) { uuid_t *uuid; char *str; diff --git a/contrib/xml2/xpath.c b/contrib/xml2/xpath.c index d5244a1ce3..203e53905b 100644 --- a/contrib/xml2/xpath.c +++ b/contrib/xml2/xpath.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/xml2/xpath.c,v 1.22 2009/01/07 13:44:36 tgl Exp $ + * $PostgreSQL: pgsql/contrib/xml2/xpath.c,v 1.23 2009/06/11 14:48:53 momjian Exp $ * * Parser interface for DOM-based parser (libxml) rather than * stream-based SAX-type parser @@ -36,15 +36,15 @@ void elog_error(int level, char *explain, int force); void pgxml_parser_init(void); static xmlChar *pgxmlNodeSetToText(xmlNodeSetPtr nodeset, - xmlChar * toptagname, xmlChar * septagname, - xmlChar * plainsep); + xmlChar *toptagname, xmlChar *septagname, + xmlChar *plainsep); -text *pgxml_result_to_text(xmlXPathObjectPtr res, xmlChar * toptag, - xmlChar * septag, xmlChar * plainsep); +text *pgxml_result_to_text(xmlXPathObjectPtr res, xmlChar *toptag, + xmlChar *septag, xmlChar *plainsep); xmlChar *pgxml_texttoxmlchar(text *textstring); -static xmlXPathObjectPtr pgxml_xpath(text *document, xmlChar * xpath); +static xmlXPathObjectPtr pgxml_xpath(text *document, xmlChar *xpath); Datum xml_is_well_formed(PG_FUNCTION_ARGS); @@ -216,11 +216,11 @@ xml_encode_special_chars(PG_FUNCTION_ARGS) } static xmlChar -* + * pgxmlNodeSetToText(xmlNodeSetPtr nodeset, - xmlChar * toptagname, - xmlChar * septagname, - xmlChar * plainsep) + xmlChar *toptagname, + xmlChar *septagname, + xmlChar *plainsep) { /* Function translates a nodeset into a text representation */ @@ -510,7 +510,7 @@ xpath_bool(PG_FUNCTION_ARGS) /* Core function to evaluate XPath query */ xmlXPathObjectPtr -pgxml_xpath(text *document, xmlChar * xpath) +pgxml_xpath(text *document, xmlChar *xpath) { xmlDocPtr doctree; @@ -566,9 +566,9 @@ pgxml_xpath(text *document, xmlChar * xpath) text * pgxml_result_to_text(xmlXPathObjectPtr res, - xmlChar * toptag, - xmlChar * septag, - xmlChar * plainsep) + xmlChar *toptag, + xmlChar *septag, + xmlChar *plainsep) { xmlChar *xpresstr; text *xpres; @@ -814,7 +814,7 @@ xpath_table(PG_FUNCTION_ARGS) /* Parse the document */ if (xmldoc) doctree = xmlParseMemory(xmldoc, strlen(xmldoc)); - else /* treat NULL as not well-formed */ + else /* treat NULL as not well-formed */ doctree = NULL; if (doctree == NULL) diff --git a/contrib/xml2/xslt_proc.c b/contrib/xml2/xslt_proc.c index 4ca176ed2e..08816b273a 100644 --- a/contrib/xml2/xslt_proc.c +++ b/contrib/xml2/xslt_proc.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/xml2/xslt_proc.c,v 1.14 2009/01/07 13:44:36 tgl Exp $ + * $PostgreSQL: pgsql/contrib/xml2/xslt_proc.c,v 1.15 2009/06/11 14:48:53 momjian Exp $ * * XSLT processing functions (requiring libxslt) * diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c index 6499549177..ac5749c713 100644 --- a/src/backend/access/common/heaptuple.c +++ b/src/backend/access/common/heaptuple.c @@ -50,7 +50,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.126 2009/03/30 04:08:43 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.127 2009/06/11 14:48:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -388,7 +388,7 @@ nocachegetattr(HeapTuple tuple, * Now check to see if any preceding bits are null... */ { - int byte = attnum >> 3; + int byte = attnum >> 3; int finalbit = attnum & 0x07; /* check for nulls "before" final bit of last byte */ @@ -1183,7 +1183,7 @@ slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull) { if (tuple == NULL) /* internal error */ elog(ERROR, "cannot extract system attribute from virtual tuple"); - if (tuple == &(slot->tts_minhdr)) /* internal error */ + if (tuple == &(slot->tts_minhdr)) /* internal error */ elog(ERROR, "cannot extract system attribute from minimal tuple"); return heap_getsysattr(tuple, attnum, tupleDesc, isnull); } @@ -1369,7 +1369,7 @@ slot_attisnull(TupleTableSlot *slot, int attnum) { if (tuple == NULL) /* internal error */ elog(ERROR, "cannot extract system attribute from virtual tuple"); - if (tuple == &(slot->tts_minhdr)) /* internal error */ + if (tuple == &(slot->tts_minhdr)) /* internal error */ elog(ERROR, "cannot extract system attribute from minimal tuple"); return heap_attisnull(tuple, attnum); } diff --git a/src/backend/access/common/indextuple.c b/src/backend/access/common/indextuple.c index 839d242913..cd3b88654b 100644 --- a/src/backend/access/common/indextuple.c +++ b/src/backend/access/common/indextuple.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/common/indextuple.c,v 1.87 2009/01/01 17:23:34 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/common/indextuple.c,v 1.88 2009/06/11 14:48:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -86,7 +86,7 @@ index_form_tuple(TupleDesc tupleDescriptor, * try to compress it in-line. */ if (!VARATT_IS_EXTENDED(DatumGetPointer(untoasted_values[i])) && - VARSIZE(DatumGetPointer(untoasted_values[i])) > TOAST_INDEX_TARGET && + VARSIZE(DatumGetPointer(untoasted_values[i])) > TOAST_INDEX_TARGET && (att->attstorage == 'x' || att->attstorage == 'm')) { Datum cvalue = toast_compress_datum(untoasted_values[i]); @@ -270,7 +270,7 @@ nocache_index_getattr(IndexTuple tup, * Now check to see if any preceding bits are null... */ { - int byte = attnum >> 3; + int byte = attnum >> 3; int finalbit = attnum & 0x07; /* check for nulls "before" final bit of last byte */ diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c index 324c978132..13a09dd9b3 100644 --- a/src/backend/access/common/printtup.c +++ b/src/backend/access/common/printtup.c @@ -9,7 +9,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/common/printtup.c,v 1.104 2009/01/01 17:23:34 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/common/printtup.c,v 1.105 2009/06/11 14:48:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -71,7 +71,7 @@ printtup_create_DR(CommandDest dest) { DR_printtup *self = (DR_printtup *) palloc0(sizeof(DR_printtup)); - self->pub.receiveSlot = printtup; /* might get changed later */ + self->pub.receiveSlot = printtup; /* might get changed later */ self->pub.rStartup = printtup_startup; self->pub.rShutdown = printtup_shutdown; self->pub.rDestroy = printtup_destroy; diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c index 2668fd8bfe..b970601b1c 100644 --- a/src/backend/access/common/reloptions.c +++ b/src/backend/access/common/reloptions.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.27 2009/05/24 22:22:44 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.28 2009/06/11 14:48:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -65,7 +65,7 @@ static relopt_bool boolRelOpts[] = true }, /* list terminator */ - { { NULL } } + {{NULL}} }; static relopt_int intRelOpts[] = @@ -158,7 +158,7 @@ static relopt_int intRelOpts[] = }, 150000000, 0, 2000000000 }, /* list terminator */ - { { NULL } } + {{NULL}} }; static relopt_real realRelOpts[] = @@ -180,21 +180,21 @@ static relopt_real realRelOpts[] = 0.1, 0.0, 100.0 }, /* list terminator */ - { { NULL } } + {{NULL}} }; static relopt_string stringRelOpts[] = { /* list terminator */ - { { NULL } } + {{NULL}} }; static relopt_gen **relOpts = NULL; static bits32 last_assigned_kind = RELOPT_KIND_LAST_DEFAULT; -static int num_custom_options = 0; +static int num_custom_options = 0; static relopt_gen **custom_options = NULL; -static bool need_initialization = true; +static bool need_initialization = true; static void initialize_reloptions(void); static void parse_one_reloption(relopt_value *option, char *text_str, @@ -202,15 +202,15 @@ static void parse_one_reloption(relopt_value *option, char *text_str, /* * initialize_reloptions - * initialization routine, must be called before parsing + * initialization routine, must be called before parsing * * Initialize the relOpts array and fill each variable's type and name length. */ static void initialize_reloptions(void) { - int i; - int j = 0; + int i; + int j = 0; for (i = 0; boolRelOpts[i].gen.name; i++) j++; @@ -272,8 +272,8 @@ initialize_reloptions(void) /* * add_reloption_kind - * Create a new relopt_kind value, to be used in custom reloptions by - * user-defined AMs. + * Create a new relopt_kind value, to be used in custom reloptions by + * user-defined AMs. */ relopt_kind add_reloption_kind(void) @@ -282,24 +282,24 @@ add_reloption_kind(void) if (last_assigned_kind >= RELOPT_KIND_MAX) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("user-defined relation parameter types limit exceeded"))); + errmsg("user-defined relation parameter types limit exceeded"))); last_assigned_kind <<= 1; return (relopt_kind) last_assigned_kind; } /* * add_reloption - * Add an already-created custom reloption to the list, and recompute the - * main parser table. + * Add an already-created custom reloption to the list, and recompute the + * main parser table. */ static void add_reloption(relopt_gen *newoption) { - static int max_custom_options = 0; + static int max_custom_options = 0; if (num_custom_options >= max_custom_options) { - MemoryContext oldcxt; + MemoryContext oldcxt; oldcxt = MemoryContextSwitchTo(TopMemoryContext); @@ -312,7 +312,7 @@ add_reloption(relopt_gen *newoption) { max_custom_options *= 2; custom_options = repalloc(custom_options, - max_custom_options * sizeof(relopt_gen *)); + max_custom_options * sizeof(relopt_gen *)); } MemoryContextSwitchTo(oldcxt); } @@ -323,15 +323,15 @@ add_reloption(relopt_gen *newoption) /* * allocate_reloption - * Allocate a new reloption and initialize the type-agnostic fields - * (for types other than string) + * Allocate a new reloption and initialize the type-agnostic fields + * (for types other than string) */ static relopt_gen * allocate_reloption(bits32 kinds, int type, char *name, char *desc) { - MemoryContext oldcxt; - size_t size; - relopt_gen *newoption; + MemoryContext oldcxt; + size_t size; + relopt_gen *newoption; Assert(type != RELOPT_TYPE_STRING); @@ -350,7 +350,7 @@ allocate_reloption(bits32 kinds, int type, char *name, char *desc) break; default: elog(ERROR, "unsupported option type"); - return NULL; /* keep compiler quiet */ + return NULL; /* keep compiler quiet */ } newoption = palloc(size); @@ -371,12 +371,12 @@ allocate_reloption(bits32 kinds, int type, char *name, char *desc) /* * add_bool_reloption - * Add a new boolean reloption + * Add a new boolean reloption */ void add_bool_reloption(bits32 kinds, char *name, char *desc, bool default_val) { - relopt_bool *newoption; + relopt_bool *newoption; newoption = (relopt_bool *) allocate_reloption(kinds, RELOPT_TYPE_BOOL, name, desc); @@ -387,13 +387,13 @@ add_bool_reloption(bits32 kinds, char *name, char *desc, bool default_val) /* * add_int_reloption - * Add a new integer reloption + * Add a new integer reloption */ void add_int_reloption(bits32 kinds, char *name, char *desc, int default_val, int min_val, int max_val) { - relopt_int *newoption; + relopt_int *newoption; newoption = (relopt_int *) allocate_reloption(kinds, RELOPT_TYPE_INT, name, desc); @@ -406,13 +406,13 @@ add_int_reloption(bits32 kinds, char *name, char *desc, int default_val, /* * add_real_reloption - * Add a new float reloption + * Add a new float reloption */ void add_real_reloption(bits32 kinds, char *name, char *desc, double default_val, - double min_val, double max_val) + double min_val, double max_val) { - relopt_real *newoption; + relopt_real *newoption; newoption = (relopt_real *) allocate_reloption(kinds, RELOPT_TYPE_REAL, name, desc); @@ -428,7 +428,7 @@ add_real_reloption(bits32 kinds, char *name, char *desc, double default_val, * Add a new string reloption * * "validator" is an optional function pointer that can be used to test the - * validity of the values. It must elog(ERROR) when the argument string is + * validity of the values. It must elog(ERROR) when the argument string is * not acceptable for the variable. Note that the default value must pass * the validation. */ @@ -436,9 +436,9 @@ void add_string_reloption(bits32 kinds, char *name, char *desc, char *default_val, validate_string_relopt validator) { - MemoryContext oldcxt; - relopt_string *newoption; - int default_len = 0; + MemoryContext oldcxt; + relopt_string *newoption; + int default_len = 0; oldcxt = MemoryContextSwitchTo(TopMemoryContext); @@ -495,7 +495,7 @@ add_string_reloption(bits32 kinds, char *name, char *desc, char *default_val, * Note that this is not responsible for determining whether the options * are valid, but it does check that namespaces for all the options given are * listed in validnsps. The NULL namespace is always valid and needs not be - * explicitely listed. Passing a NULL pointer means that only the NULL + * explicitely listed. Passing a NULL pointer means that only the NULL * namespace is valid. * * Both oldOptions and the result are text arrays (or NULL for "default"), @@ -538,7 +538,7 @@ transformRelOptions(Datum oldOptions, List *defList, char *namspace, /* Search for a match in defList */ foreach(cell, defList) { - DefElem *def = (DefElem *) lfirst(cell); + DefElem *def = (DefElem *) lfirst(cell); int kw_len; /* ignore if not in the same namespace */ @@ -574,7 +574,7 @@ transformRelOptions(Datum oldOptions, List *defList, char *namspace, */ foreach(cell, defList) { - DefElem *def = (DefElem *) lfirst(cell); + DefElem *def = (DefElem *) lfirst(cell); if (isReset) { @@ -590,13 +590,13 @@ transformRelOptions(Datum oldOptions, List *defList, char *namspace, Size len; /* - * Error out if the namespace is not valid. A NULL namespace - * is always valid. + * Error out if the namespace is not valid. A NULL namespace is + * always valid. */ if (def->defnamespace != NULL) { - bool valid = false; - int i; + bool valid = false; + int i; if (validnsps) { @@ -719,10 +719,10 @@ untransformRelOptions(Datum options) bytea * extractRelOptions(HeapTuple tuple, TupleDesc tupdesc, Oid amoptions) { - bytea *options; - bool isnull; - Datum datum; - Form_pg_class classForm; + bytea *options; + bool isnull; + Datum datum; + Form_pg_class classForm; datum = fastgetattr(tuple, Anum_pg_class_reloptions, @@ -768,7 +768,7 @@ extractRelOptions(HeapTuple tuple, TupleDesc tupdesc, Oid amoptions) * is returned. * * Note: values of type int, bool and real are allocated as part of the - * returned array. Values of type string are allocated separately and must + * returned array. Values of type string are allocated separately and must * be freed by the caller. */ relopt_value * @@ -894,31 +894,31 @@ parse_one_reloption(relopt_value *option, char *text_str, int text_len, parsed = parse_bool(value, &option->values.bool_val); if (validate && !parsed) ereport(ERROR, - (errmsg("invalid value for boolean option \"%s\": %s", - option->gen->name, value))); + (errmsg("invalid value for boolean option \"%s\": %s", + option->gen->name, value))); } break; case RELOPT_TYPE_INT: { - relopt_int *optint = (relopt_int *) option->gen; + relopt_int *optint = (relopt_int *) option->gen; parsed = parse_int(value, &option->values.int_val, 0, NULL); if (validate && !parsed) ereport(ERROR, - (errmsg("invalid value for integer option \"%s\": %s", - option->gen->name, value))); + (errmsg("invalid value for integer option \"%s\": %s", + option->gen->name, value))); if (validate && (option->values.int_val < optint->min || option->values.int_val > optint->max)) ereport(ERROR, - (errmsg("value %s out of bounds for option \"%s\"", - value, option->gen->name), - errdetail("Valid values are between \"%d\" and \"%d\".", - optint->min, optint->max))); + (errmsg("value %s out of bounds for option \"%s\"", + value, option->gen->name), + errdetail("Valid values are between \"%d\" and \"%d\".", + optint->min, optint->max))); } break; case RELOPT_TYPE_REAL: { - relopt_real *optreal = (relopt_real *) option->gen; + relopt_real *optreal = (relopt_real *) option->gen; parsed = parse_real(value, &option->values.real_val); if (validate && !parsed) @@ -928,15 +928,15 @@ parse_one_reloption(relopt_value *option, char *text_str, int text_len, if (validate && (option->values.real_val < optreal->min || option->values.real_val > optreal->max)) ereport(ERROR, - (errmsg("value %s out of bounds for option \"%s\"", - value, option->gen->name), - errdetail("Valid values are between \"%f\" and \"%f\".", - optreal->min, optreal->max))); + (errmsg("value %s out of bounds for option \"%s\"", + value, option->gen->name), + errdetail("Valid values are between \"%f\" and \"%f\".", + optreal->min, optreal->max))); } break; case RELOPT_TYPE_STRING: { - relopt_string *optstring = (relopt_string *) option->gen; + relopt_string *optstring = (relopt_string *) option->gen; option->values.string_val = value; nofree = true; @@ -947,7 +947,7 @@ parse_one_reloption(relopt_value *option, char *text_str, int text_len, break; default: elog(ERROR, "unsupported reloption type %d", option->gen->type); - parsed = true; /* quiet compiler */ + parsed = true; /* quiet compiler */ break; } @@ -967,8 +967,8 @@ parse_one_reloption(relopt_value *option, char *text_str, int text_len, void * allocateReloptStruct(Size base, relopt_value *options, int numoptions) { - Size size = base; - int i; + Size size = base; + int i; for (i = 0; i < numoptions; i++) if (options[i].gen->type == RELOPT_TYPE_STRING) @@ -994,21 +994,21 @@ fillRelOptions(void *rdopts, Size basesize, bool validate, const relopt_parse_elt *elems, int numelems) { - int i; - int offset = basesize; + int i; + int offset = basesize; for (i = 0; i < numoptions; i++) { - int j; - bool found = false; + int j; + bool found = false; for (j = 0; j < numelems; j++) { if (pg_strcasecmp(options[i].gen->name, elems[j].optname) == 0) { relopt_string *optstring; - char *itempos = ((char *) rdopts) + elems[j].offset; - char *string_val; + char *itempos = ((char *) rdopts) + elems[j].offset; + char *string_val; switch (options[i].gen->type) { @@ -1069,31 +1069,31 @@ fillRelOptions(void *rdopts, Size basesize, bytea * default_reloptions(Datum reloptions, bool validate, relopt_kind kind) { - relopt_value *options; - StdRdOptions *rdopts; - int numoptions; + relopt_value *options; + StdRdOptions *rdopts; + int numoptions; static const relopt_parse_elt tab[] = { {"fillfactor", RELOPT_TYPE_INT, offsetof(StdRdOptions, fillfactor)}, {"autovacuum_enabled", RELOPT_TYPE_BOOL, - offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, enabled)}, + offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, enabled)}, {"autovacuum_vacuum_threshold", RELOPT_TYPE_INT, - offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_threshold)}, + offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, vacuum_threshold)}, {"autovacuum_analyze_threshold", RELOPT_TYPE_INT, - offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, analyze_threshold)}, + offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, analyze_threshold)}, {"autovacuum_vacuum_cost_delay", RELOPT_TYPE_INT, - offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_cost_delay)}, + offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, vacuum_cost_delay)}, {"autovacuum_vacuum_cost_limit", RELOPT_TYPE_INT, - offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_cost_limit)}, + offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, vacuum_cost_limit)}, {"autovacuum_freeze_min_age", RELOPT_TYPE_INT, - offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, freeze_min_age)}, + offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, freeze_min_age)}, {"autovacuum_freeze_max_age", RELOPT_TYPE_INT, - offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, freeze_max_age)}, + offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, freeze_max_age)}, {"autovacuum_freeze_table_age", RELOPT_TYPE_INT, - offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, freeze_table_age)}, + offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, freeze_table_age)}, {"autovacuum_vacuum_scale_factor", RELOPT_TYPE_REAL, - offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_scale_factor)}, + offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, vacuum_scale_factor)}, {"autovacuum_analyze_scale_factor", RELOPT_TYPE_REAL, - offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, analyze_scale_factor)} + offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, analyze_scale_factor)} }; options = parseRelOptions(reloptions, validate, kind, &numoptions); diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c index ea16913c8e..79efec0969 100644 --- a/src/backend/access/common/tupdesc.c +++ b/src/backend/access/common/tupdesc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/common/tupdesc.c,v 1.125 2009/01/22 20:16:00 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/common/tupdesc.c,v 1.126 2009/06/11 14:48:53 momjian Exp $ * * NOTES * some of the executor utility code such as "ExecTypeFromTL" should be @@ -55,8 +55,8 @@ CreateTemplateTupleDesc(int natts, bool hasoid) * pointers. * * Note: Only the fixed part of pg_attribute rows is included in tuple - * descriptors, so we only need ATTRIBUTE_FIXED_PART_SIZE space - * per attr. That might need alignment padding, however. + * descriptors, so we only need ATTRIBUTE_FIXED_PART_SIZE space per attr. + * That might need alignment padding, however. */ attroffset = sizeof(struct tupleDesc) + natts * sizeof(Form_pg_attribute); attroffset = MAXALIGN(attroffset); diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c index 717caaad8b..feff95f1d8 100644 --- a/src/backend/access/gin/ginarrayproc.c +++ b/src/backend/access/gin/ginarrayproc.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gin/ginarrayproc.c,v 1.15 2009/03/25 22:19:01 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/ginarrayproc.c,v 1.16 2009/06/11 14:48:53 momjian Exp $ *------------------------------------------------------------------------- */ #include "postgres.h" @@ -95,6 +95,7 @@ ginarrayconsistent(PG_FUNCTION_ARGS) bool *check = (bool *) PG_GETARG_POINTER(0); StrategyNumber strategy = PG_GETARG_UINT16(1); ArrayType *query = PG_GETARG_ARRAYTYPE_P(2); + /* int32 nkeys = PG_GETARG_INT32(3); */ /* Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); */ bool *recheck = (bool *) PG_GETARG_POINTER(5); diff --git a/src/backend/access/gin/ginbulk.c b/src/backend/access/gin/ginbulk.c index a7258619ae..2e800ce44a 100644 --- a/src/backend/access/gin/ginbulk.c +++ b/src/backend/access/gin/ginbulk.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gin/ginbulk.c,v 1.15 2009/03/24 20:17:10 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/ginbulk.c,v 1.16 2009/06/11 14:48:53 momjian Exp $ *------------------------------------------------------------------------- */ @@ -84,7 +84,7 @@ ginInsertData(BuildAccumulator *accum, EntryAccumulator *entry, ItemPointer heap static Datum getDatumCopy(BuildAccumulator *accum, OffsetNumber attnum, Datum value) { - Form_pg_attribute att = accum->ginstate->origTupdesc->attrs[ attnum - 1 ]; + Form_pg_attribute att = accum->ginstate->origTupdesc->attrs[attnum - 1]; Datum res; if (att->attbyval) @@ -161,8 +161,8 @@ ginInsertEntry(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum * then calls itself for each parts */ static void -ginChooseElem(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum, - Datum *entries, uint32 nentry, +ginChooseElem(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum, + Datum *entries, uint32 nentry, uint32 low, uint32 high, uint32 offset) { uint32 pos; @@ -187,8 +187,8 @@ ginChooseElem(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum, * next middle on left part and middle of right part. */ void -ginInsertRecordBA(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum, - Datum *entries, int32 nentry) +ginInsertRecordBA(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum, + Datum *entries, int32 nentry) { uint32 i, nbit = 0, diff --git a/src/backend/access/gin/gindatapage.c b/src/backend/access/gin/gindatapage.c index 22199102dd..ebbdaa33e5 100644 --- a/src/backend/access/gin/gindatapage.c +++ b/src/backend/access/gin/gindatapage.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gin/gindatapage.c,v 1.15 2009/06/06 02:39:40 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/gindatapage.c,v 1.16 2009/06/11 14:48:53 momjian Exp $ *------------------------------------------------------------------------- */ @@ -47,7 +47,7 @@ MergeItemPointers(ItemPointerData *dst, while (aptr - a < na && bptr - b < nb) { - int cmp = compareItemPointers(aptr, bptr); + int cmp = compareItemPointers(aptr, bptr); if (cmp > 0) *dptr++ = *bptr++; diff --git a/src/backend/access/gin/ginentrypage.c b/src/backend/access/gin/ginentrypage.c index f35994db95..c4659cde1f 100644 --- a/src/backend/access/gin/ginentrypage.c +++ b/src/backend/access/gin/ginentrypage.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gin/ginentrypage.c,v 1.20 2009/06/06 02:39:40 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/ginentrypage.c,v 1.21 2009/06/11 14:48:53 momjian Exp $ *------------------------------------------------------------------------- */ @@ -46,23 +46,23 @@ * Attributes of an index tuple are different for single and multicolumn index. * For single-column case, index tuple stores only value to be indexed. * For multicolumn case, it stores two attributes: column number of value - * and value. + * and value. */ IndexTuple GinFormTuple(GinState *ginstate, OffsetNumber attnum, Datum key, ItemPointerData *ipd, uint32 nipd) { - bool isnull[2] = {FALSE,FALSE}; + bool isnull[2] = {FALSE, FALSE}; IndexTuple itup; - if ( ginstate->oneCol ) + if (ginstate->oneCol) itup = index_form_tuple(ginstate->origTupdesc, &key, isnull); else { - Datum datums[2]; + Datum datums[2]; datums[0] = UInt16GetDatum(attnum); datums[1] = key; - itup = index_form_tuple(ginstate->tupdesc[attnum-1], datums, isnull); + itup = index_form_tuple(ginstate->tupdesc[attnum - 1], datums, isnull); } GinSetOrigSizePosting(itup, IndexTupleSize(itup)); @@ -136,12 +136,12 @@ entryIsMoveRight(GinBtree btree, Page page) if (GinPageRightMost(page)) return FALSE; - itup = getRightMostTuple(page); + itup = getRightMostTuple(page); if (compareAttEntries(btree->ginstate, - btree->entryAttnum, btree->entryValue, - gintuple_get_attrnum(btree->ginstate, itup), - gin_index_getattr(btree->ginstate, itup)) > 0) + btree->entryAttnum, btree->entryValue, + gintuple_get_attrnum(btree->ginstate, itup), + gin_index_getattr(btree->ginstate, itup)) > 0) return TRUE; return FALSE; @@ -187,10 +187,10 @@ entryLocateEntry(GinBtree btree, GinBtreeStack *stack) else { itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, mid)); - result = compareAttEntries(btree->ginstate, - btree->entryAttnum, btree->entryValue, - gintuple_get_attrnum(btree->ginstate, itup), - gin_index_getattr(btree->ginstate, itup)); + result = compareAttEntries(btree->ginstate, + btree->entryAttnum, btree->entryValue, + gintuple_get_attrnum(btree->ginstate, itup), + gin_index_getattr(btree->ginstate, itup)); } if (result == 0) @@ -252,10 +252,10 @@ entryLocateLeafEntry(GinBtree btree, GinBtreeStack *stack) int result; itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, mid)); - result = compareAttEntries(btree->ginstate, - btree->entryAttnum, btree->entryValue, - gintuple_get_attrnum(btree->ginstate, itup), - gin_index_getattr(btree->ginstate, itup)); + result = compareAttEntries(btree->ginstate, + btree->entryAttnum, btree->entryValue, + gintuple_get_attrnum(btree->ginstate, itup), + gin_index_getattr(btree->ginstate, itup)); if (result == 0) { stack->off = mid; diff --git a/src/backend/access/gin/ginfast.c b/src/backend/access/gin/ginfast.c index f474ad6598..20887ba56c 100644 --- a/src/backend/access/gin/ginfast.c +++ b/src/backend/access/gin/ginfast.c @@ -11,7 +11,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gin/ginfast.c,v 1.2 2009/03/24 22:06:03 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/ginfast.c,v 1.3 2009/06/11 14:48:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -33,9 +33,9 @@ typedef struct DatumArray { - Datum *values; /* expansible array */ - int32 nvalues; /* current number of valid entries */ - int32 maxvalues; /* allocated size of array */ + Datum *values; /* expansible array */ + int32 nvalues; /* current number of valid entries */ + int32 maxvalues; /* allocated size of array */ } DatumArray; @@ -46,11 +46,14 @@ static int32 writeListPage(Relation index, Buffer buffer, IndexTuple *tuples, int32 ntuples, BlockNumber rightlink) { - Page page = BufferGetPage(buffer); - int i, freesize, size=0; - OffsetNumber l, off; - char *workspace; - char *ptr; + Page page = BufferGetPage(buffer); + int i, + freesize, + size = 0; + OffsetNumber l, + off; + char *workspace; + char *ptr; /* workspace could be a local array; we use palloc for alignment */ workspace = palloc(BLCKSZ); @@ -62,15 +65,15 @@ writeListPage(Relation index, Buffer buffer, off = FirstOffsetNumber; ptr = workspace; - for(i=0; i<ntuples; i++) + for (i = 0; i < ntuples; i++) { - int this_size = IndexTupleSize(tuples[i]); + int this_size = IndexTupleSize(tuples[i]); memcpy(ptr, tuples[i], this_size); ptr += this_size; size += this_size; - l = PageAddItem(page, (Item)tuples[i], this_size, off, false, false); + l = PageAddItem(page, (Item) tuples[i], this_size, off, false, false); if (l == InvalidOffsetNumber) elog(ERROR, "failed to add item to index page in \"%s\"", @@ -84,10 +87,10 @@ writeListPage(Relation index, Buffer buffer, GinPageGetOpaque(page)->rightlink = rightlink; /* - * tail page may contain only the whole row(s) or final - * part of row placed on previous pages + * tail page may contain only the whole row(s) or final part of row placed + * on previous pages */ - if ( rightlink == InvalidBlockNumber ) + if (rightlink == InvalidBlockNumber) { GinPageSetFullRow(page); GinPageGetOpaque(page)->maxoff = 1; @@ -103,15 +106,15 @@ writeListPage(Relation index, Buffer buffer, if (!index->rd_istemp) { - XLogRecData rdata[2]; - ginxlogInsertListPage data; - XLogRecPtr recptr; + XLogRecData rdata[2]; + ginxlogInsertListPage data; + XLogRecPtr recptr; rdata[0].buffer = buffer; rdata[0].buffer_std = true; - rdata[0].data = (char*)&data; + rdata[0].data = (char *) &data; rdata[0].len = sizeof(ginxlogInsertListPage); - rdata[0].next = rdata+1; + rdata[0].next = rdata + 1; rdata[1].buffer = InvalidBuffer; rdata[1].data = workspace; @@ -140,27 +143,29 @@ static void makeSublist(Relation index, IndexTuple *tuples, int32 ntuples, GinMetaPageData *res) { - Buffer curBuffer = InvalidBuffer; - Buffer prevBuffer = InvalidBuffer; - int i, size = 0, tupsize; - int startTuple = 0; + Buffer curBuffer = InvalidBuffer; + Buffer prevBuffer = InvalidBuffer; + int i, + size = 0, + tupsize; + int startTuple = 0; Assert(ntuples > 0); /* * Split tuples into pages */ - for(i=0;i<ntuples;i++) + for (i = 0; i < ntuples; i++) { - if ( curBuffer == InvalidBuffer ) + if (curBuffer == InvalidBuffer) { curBuffer = GinNewBuffer(index); - if ( prevBuffer != InvalidBuffer ) + if (prevBuffer != InvalidBuffer) { res->nPendingPages++; writeListPage(index, prevBuffer, - tuples+startTuple, i-startTuple, + tuples + startTuple, i - startTuple, BufferGetBlockNumber(curBuffer)); } else @@ -175,7 +180,7 @@ makeSublist(Relation index, IndexTuple *tuples, int32 ntuples, tupsize = MAXALIGN(IndexTupleSize(tuples[i])) + sizeof(ItemIdData); - if ( size + tupsize >= GinListPageSize ) + if (size + tupsize >= GinListPageSize) { /* won't fit, force a new page and reprocess */ i--; @@ -192,7 +197,7 @@ makeSublist(Relation index, IndexTuple *tuples, int32 ntuples, */ res->tail = BufferGetBlockNumber(curBuffer); res->tailFreeSize = writeListPage(index, curBuffer, - tuples+startTuple, ntuples-startTuple, + tuples + startTuple, ntuples - startTuple, InvalidBlockNumber); res->nPendingPages++; /* that was only one heap tuple */ @@ -207,17 +212,17 @@ void ginHeapTupleFastInsert(Relation index, GinState *ginstate, GinTupleCollector *collector) { - Buffer metabuffer; - Page metapage; - GinMetaPageData *metadata = NULL; - XLogRecData rdata[2]; - Buffer buffer = InvalidBuffer; - Page page = NULL; - ginxlogUpdateMeta data; - bool separateList = false; - bool needCleanup = false; - - if ( collector->ntuples == 0 ) + Buffer metabuffer; + Page metapage; + GinMetaPageData *metadata = NULL; + XLogRecData rdata[2]; + Buffer buffer = InvalidBuffer; + Page page = NULL; + ginxlogUpdateMeta data; + bool separateList = false; + bool needCleanup = false; + + if (collector->ntuples == 0) return; data.node = index->rd_node; @@ -232,7 +237,7 @@ ginHeapTupleFastInsert(Relation index, GinState *ginstate, metabuffer = ReadBuffer(index, GIN_METAPAGE_BLKNO); metapage = BufferGetPage(metabuffer); - if ( collector->sumsize + collector->ntuples * sizeof(ItemIdData) > GIN_PAGE_FREESIZE ) + if (collector->sumsize + collector->ntuples * sizeof(ItemIdData) > GIN_PAGE_FREESIZE) { /* * Total size is greater than one page => make sublist @@ -244,8 +249,8 @@ ginHeapTupleFastInsert(Relation index, GinState *ginstate, LockBuffer(metabuffer, GIN_EXCLUSIVE); metadata = GinPageGetMeta(metapage); - if ( metadata->head == InvalidBlockNumber || - collector->sumsize + collector->ntuples * sizeof(ItemIdData) > metadata->tailFreeSize ) + if (metadata->head == InvalidBlockNumber || + collector->sumsize + collector->ntuples * sizeof(ItemIdData) > metadata->tailFreeSize) { /* * Pending list is empty or total size is greater than freespace @@ -258,14 +263,14 @@ ginHeapTupleFastInsert(Relation index, GinState *ginstate, } } - if ( separateList ) + if (separateList) { - GinMetaPageData sublist; + GinMetaPageData sublist; /* * We should make sublist separately and append it to the tail */ - memset( &sublist, 0, sizeof(GinMetaPageData) ); + memset(&sublist, 0, sizeof(GinMetaPageData)); makeSublist(index, collector->tuples, collector->ntuples, &sublist); @@ -275,14 +280,14 @@ ginHeapTupleFastInsert(Relation index, GinState *ginstate, LockBuffer(metabuffer, GIN_EXCLUSIVE); metadata = GinPageGetMeta(metapage); - if ( metadata->head == InvalidBlockNumber ) + if (metadata->head == InvalidBlockNumber) { /* * Sublist becomes main list */ START_CRIT_SECTION(); - memcpy(metadata, &sublist, sizeof(GinMetaPageData) ); - memcpy(&data.metadata, &sublist, sizeof(GinMetaPageData) ); + memcpy(metadata, &sublist, sizeof(GinMetaPageData)); + memcpy(&data.metadata, &sublist, sizeof(GinMetaPageData)); } else { @@ -305,7 +310,7 @@ ginHeapTupleFastInsert(Relation index, GinState *ginstate, metadata->nPendingPages += sublist.nPendingPages; metadata->nPendingHeapTuples += sublist.nPendingHeapTuples; - memcpy(&data.metadata, metadata, sizeof(GinMetaPageData) ); + memcpy(&data.metadata, metadata, sizeof(GinMetaPageData)); data.newRightlink = sublist.head; MarkBufferDirty(buffer); @@ -317,21 +322,23 @@ ginHeapTupleFastInsert(Relation index, GinState *ginstate, * Insert into tail page, metapage is already locked */ - OffsetNumber l, off; - int i, tupsize; - char *ptr; + OffsetNumber l, + off; + int i, + tupsize; + char *ptr; buffer = ReadBuffer(index, metadata->tail); LockBuffer(buffer, GIN_EXCLUSIVE); page = BufferGetPage(buffer); off = (PageIsEmpty(page)) ? FirstOffsetNumber : - OffsetNumberNext(PageGetMaxOffsetNumber(page)); + OffsetNumberNext(PageGetMaxOffsetNumber(page)); rdata[0].next = rdata + 1; rdata[1].buffer = buffer; rdata[1].buffer_std = true; - ptr = rdata[1].data = (char *) palloc( collector->sumsize ); + ptr = rdata[1].data = (char *) palloc(collector->sumsize); rdata[1].len = collector->sumsize; rdata[1].next = NULL; @@ -342,44 +349,44 @@ ginHeapTupleFastInsert(Relation index, GinState *ginstate, /* * Increase counter of heap tuples */ - Assert( GinPageGetOpaque(page)->maxoff <= metadata->nPendingHeapTuples ); + Assert(GinPageGetOpaque(page)->maxoff <= metadata->nPendingHeapTuples); GinPageGetOpaque(page)->maxoff++; metadata->nPendingHeapTuples++; - for(i=0; i<collector->ntuples; i++) + for (i = 0; i < collector->ntuples; i++) { tupsize = IndexTupleSize(collector->tuples[i]); - l = PageAddItem(page, (Item)collector->tuples[i], tupsize, off, false, false); + l = PageAddItem(page, (Item) collector->tuples[i], tupsize, off, false, false); if (l == InvalidOffsetNumber) elog(ERROR, "failed to add item to index page in \"%s\"", - RelationGetRelationName(index)); + RelationGetRelationName(index)); memcpy(ptr, collector->tuples[i], tupsize); - ptr+=tupsize; + ptr += tupsize; off++; } metadata->tailFreeSize -= collector->sumsize + collector->ntuples * sizeof(ItemIdData); - memcpy(&data.metadata, metadata, sizeof(GinMetaPageData) ); + memcpy(&data.metadata, metadata, sizeof(GinMetaPageData)); MarkBufferDirty(buffer); } /* - * Make real write + * Make real write */ MarkBufferDirty(metabuffer); - if ( !index->rd_istemp ) + if (!index->rd_istemp) { - XLogRecPtr recptr; + XLogRecPtr recptr; recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_UPDATE_META_PAGE, rdata); PageSetLSN(metapage, recptr); PageSetTLI(metapage, ThisTimeLineID); - if ( buffer != InvalidBuffer ) + if (buffer != InvalidBuffer) { PageSetLSN(page, recptr); PageSetTLI(page, ThisTimeLineID); @@ -390,23 +397,22 @@ ginHeapTupleFastInsert(Relation index, GinState *ginstate, UnlockReleaseBuffer(buffer); /* - * Force pending list cleanup when it becomes too long. - * And, ginInsertCleanup could take significant amount of - * time, so we prefer to call it when it can do all the work in a - * single collection cycle. In non-vacuum mode, it shouldn't - * require maintenance_work_mem, so fire it while pending list is - * still small enough to fit into work_mem. + * Force pending list cleanup when it becomes too long. And, + * ginInsertCleanup could take significant amount of time, so we prefer to + * call it when it can do all the work in a single collection cycle. In + * non-vacuum mode, it shouldn't require maintenance_work_mem, so fire it + * while pending list is still small enough to fit into work_mem. * * ginInsertCleanup() should not be called inside our CRIT_SECTION. */ - if ( metadata->nPendingPages * GIN_PAGE_FREESIZE > work_mem * 1024L ) + if (metadata->nPendingPages * GIN_PAGE_FREESIZE > work_mem * 1024L) needCleanup = true; UnlockReleaseBuffer(metabuffer); END_CRIT_SECTION(); - if ( needCleanup ) + if (needCleanup) ginInsertCleanup(index, ginstate, false, NULL); } @@ -432,17 +438,17 @@ ginHeapTupleFastCollect(Relation index, GinState *ginstate, /* * Allocate/reallocate memory for storing collected tuples */ - if ( collector->tuples == NULL ) + if (collector->tuples == NULL) { collector->lentuples = nentries * index->rd_att->natts; - collector->tuples = (IndexTuple*)palloc(sizeof(IndexTuple) * collector->lentuples); + collector->tuples = (IndexTuple *) palloc(sizeof(IndexTuple) * collector->lentuples); } - while ( collector->ntuples + nentries > collector->lentuples ) + while (collector->ntuples + nentries > collector->lentuples) { collector->lentuples *= 2; - collector->tuples = (IndexTuple*)repalloc( collector->tuples, - sizeof(IndexTuple) * collector->lentuples); + collector->tuples = (IndexTuple *) repalloc(collector->tuples, + sizeof(IndexTuple) * collector->lentuples); } /* @@ -450,13 +456,13 @@ ginHeapTupleFastCollect(Relation index, GinState *ginstate, */ for (i = 0; i < nentries; i++) { - int32 tupsize; + int32 tupsize; collector->tuples[collector->ntuples + i] = GinFormTuple(ginstate, attnum, entries[i], NULL, 0); collector->tuples[collector->ntuples + i]->t_tid = *item; tupsize = IndexTupleSize(collector->tuples[collector->ntuples + i]); - if ( tupsize > TOAST_INDEX_TARGET || tupsize >= GinMaxItemSize) + if (tupsize > TOAST_INDEX_TARGET || tupsize >= GinMaxItemSize) elog(ERROR, "huge tuple"); collector->sumsize += tupsize; @@ -480,9 +486,9 @@ static bool shiftList(Relation index, Buffer metabuffer, BlockNumber newHead, IndexBulkDeleteResult *stats) { - Page metapage; - GinMetaPageData *metadata; - BlockNumber blknoToDelete; + Page metapage; + GinMetaPageData *metadata; + BlockNumber blknoToDelete; metapage = BufferGetPage(metabuffer); metadata = GinPageGetMeta(metapage); @@ -490,12 +496,12 @@ shiftList(Relation index, Buffer metabuffer, BlockNumber newHead, do { - Page page; - int i; - int64 nDeletedHeapTuples = 0; - ginxlogDeleteListPages data; - XLogRecData rdata[1]; - Buffer buffers[GIN_NDELETE_AT_ONCE]; + Page page; + int i; + int64 nDeletedHeapTuples = 0; + ginxlogDeleteListPages data; + XLogRecData rdata[1]; + Buffer buffers[GIN_NDELETE_AT_ONCE]; data.node = index->rd_node; @@ -507,24 +513,24 @@ shiftList(Relation index, Buffer metabuffer, BlockNumber newHead, data.ndeleted = 0; while (data.ndeleted < GIN_NDELETE_AT_ONCE && blknoToDelete != newHead) { - data.toDelete[ data.ndeleted ] = blknoToDelete; - buffers[ data.ndeleted ] = ReadBuffer(index, blknoToDelete); - LockBuffer( buffers[ data.ndeleted ], GIN_EXCLUSIVE ); - page = BufferGetPage( buffers[ data.ndeleted ] ); + data.toDelete[data.ndeleted] = blknoToDelete; + buffers[data.ndeleted] = ReadBuffer(index, blknoToDelete); + LockBuffer(buffers[data.ndeleted], GIN_EXCLUSIVE); + page = BufferGetPage(buffers[data.ndeleted]); data.ndeleted++; - if ( GinPageIsDeleted(page) ) + if (GinPageIsDeleted(page)) { /* concurrent cleanup process is detected */ - for(i=0;i<data.ndeleted;i++) - UnlockReleaseBuffer( buffers[i] ); + for (i = 0; i < data.ndeleted; i++) + UnlockReleaseBuffer(buffers[i]); return true; } nDeletedHeapTuples += GinPageGetOpaque(page)->maxoff; - blknoToDelete = GinPageGetOpaque( page )->rightlink; + blknoToDelete = GinPageGetOpaque(page)->rightlink; } if (stats) @@ -534,50 +540,50 @@ shiftList(Relation index, Buffer metabuffer, BlockNumber newHead, metadata->head = blknoToDelete; - Assert( metadata->nPendingPages >= data.ndeleted ); + Assert(metadata->nPendingPages >= data.ndeleted); metadata->nPendingPages -= data.ndeleted; - Assert( metadata->nPendingHeapTuples >= nDeletedHeapTuples ); + Assert(metadata->nPendingHeapTuples >= nDeletedHeapTuples); metadata->nPendingHeapTuples -= nDeletedHeapTuples; - if ( blknoToDelete == InvalidBlockNumber ) + if (blknoToDelete == InvalidBlockNumber) { metadata->tail = InvalidBlockNumber; metadata->tailFreeSize = 0; metadata->nPendingPages = 0; metadata->nPendingHeapTuples = 0; } - memcpy( &data.metadata, metadata, sizeof(GinMetaPageData)); + memcpy(&data.metadata, metadata, sizeof(GinMetaPageData)); - MarkBufferDirty( metabuffer ); + MarkBufferDirty(metabuffer); - for(i=0; i<data.ndeleted; i++) + for (i = 0; i < data.ndeleted; i++) { - page = BufferGetPage( buffers[ i ] ); - GinPageGetOpaque( page )->flags = GIN_DELETED; - MarkBufferDirty( buffers[ i ] ); + page = BufferGetPage(buffers[i]); + GinPageGetOpaque(page)->flags = GIN_DELETED; + MarkBufferDirty(buffers[i]); } - if ( !index->rd_istemp ) + if (!index->rd_istemp) { - XLogRecPtr recptr; + XLogRecPtr recptr; recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_DELETE_LISTPAGE, rdata); PageSetLSN(metapage, recptr); PageSetTLI(metapage, ThisTimeLineID); - for(i=0; i<data.ndeleted; i++) + for (i = 0; i < data.ndeleted; i++) { - page = BufferGetPage( buffers[ i ] ); + page = BufferGetPage(buffers[i]); PageSetLSN(page, recptr); PageSetTLI(page, ThisTimeLineID); } } - for(i=0; i<data.ndeleted; i++) - UnlockReleaseBuffer( buffers[ i ] ); + for (i = 0; i < data.ndeleted; i++) + UnlockReleaseBuffer(buffers[i]); END_CRIT_SECTION(); - } while( blknoToDelete != newHead ); + } while (blknoToDelete != newHead); return false; } @@ -586,14 +592,14 @@ shiftList(Relation index, Buffer metabuffer, BlockNumber newHead, static void addDatum(DatumArray *datums, Datum datum) { - if ( datums->nvalues >= datums->maxvalues) + if (datums->nvalues >= datums->maxvalues) { datums->maxvalues *= 2; - datums->values = (Datum*)repalloc(datums->values, - sizeof(Datum)*datums->maxvalues); + datums->values = (Datum *) repalloc(datums->values, + sizeof(Datum) * datums->maxvalues); } - datums->values[ datums->nvalues++ ] = datum; + datums->values[datums->nvalues++] = datum; } /* @@ -606,31 +612,33 @@ static void processPendingPage(BuildAccumulator *accum, DatumArray *da, Page page, OffsetNumber startoff) { - ItemPointerData heapptr; - OffsetNumber i,maxoff; - OffsetNumber attrnum, curattnum; + ItemPointerData heapptr; + OffsetNumber i, + maxoff; + OffsetNumber attrnum, + curattnum; /* reset *da to empty */ da->nvalues = 0; maxoff = PageGetMaxOffsetNumber(page); - Assert( maxoff >= FirstOffsetNumber ); + Assert(maxoff >= FirstOffsetNumber); ItemPointerSetInvalid(&heapptr); attrnum = 0; for (i = startoff; i <= maxoff; i = OffsetNumberNext(i)) { - IndexTuple itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, i)); + IndexTuple itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, i)); curattnum = gintuple_get_attrnum(accum->ginstate, itup); - if ( !ItemPointerIsValid(&heapptr) ) + if (!ItemPointerIsValid(&heapptr)) { heapptr = itup->t_tid; attrnum = curattnum; } - else if ( !(ItemPointerEquals(&heapptr, &itup->t_tid) && - curattnum == attrnum) ) + else if (!(ItemPointerEquals(&heapptr, &itup->t_tid) && + curattnum == attrnum)) { /* * We can insert several datums per call, but only for one heap @@ -652,7 +660,7 @@ processPendingPage(BuildAccumulator *accum, DatumArray *da, * * This can be called concurrently by multiple backends, so it must cope. * On first glance it looks completely not concurrent-safe and not crash-safe - * either. The reason it's okay is that multiple insertion of the same entry + * either. The reason it's okay is that multiple insertion of the same entry * is detected and treated as a no-op by gininsert.c. If we crash after * posting entries to the main index and before removing them from the * pending list, it's okay because when we redo the posting later on, nothing @@ -671,20 +679,23 @@ void ginInsertCleanup(Relation index, GinState *ginstate, bool vac_delay, IndexBulkDeleteResult *stats) { - Buffer metabuffer, buffer; - Page metapage, page; - GinMetaPageData *metadata; - MemoryContext opCtx, oldCtx; - BuildAccumulator accum; - DatumArray datums; - BlockNumber blkno; + Buffer metabuffer, + buffer; + Page metapage, + page; + GinMetaPageData *metadata; + MemoryContext opCtx, + oldCtx; + BuildAccumulator accum; + DatumArray datums; + BlockNumber blkno; metabuffer = ReadBuffer(index, GIN_METAPAGE_BLKNO); LockBuffer(metabuffer, GIN_SHARE); metapage = BufferGetPage(metabuffer); metadata = GinPageGetMeta(metapage); - if ( metadata->head == InvalidBlockNumber ) + if (metadata->head == InvalidBlockNumber) { /* Nothing to do */ UnlockReleaseBuffer(metabuffer); @@ -702,7 +713,7 @@ ginInsertCleanup(Relation index, GinState *ginstate, LockBuffer(metabuffer, GIN_UNLOCK); /* - * Initialize. All temporary space will be in opCtx + * Initialize. All temporary space will be in opCtx */ opCtx = AllocSetContextCreate(CurrentMemoryContext, "GIN insert cleanup temporary context", @@ -712,24 +723,24 @@ ginInsertCleanup(Relation index, GinState *ginstate, oldCtx = MemoryContextSwitchTo(opCtx); - datums.maxvalues=128; + datums.maxvalues = 128; datums.nvalues = 0; - datums.values = (Datum*)palloc(sizeof(Datum)*datums.maxvalues); + datums.values = (Datum *) palloc(sizeof(Datum) * datums.maxvalues); ginInitBA(&accum); accum.ginstate = ginstate; /* - * At the top of this loop, we have pin and lock on the current page - * of the pending list. However, we'll release that before exiting - * the loop. Note we also have pin but not lock on the metapage. + * At the top of this loop, we have pin and lock on the current page of + * the pending list. However, we'll release that before exiting the loop. + * Note we also have pin but not lock on the metapage. */ - for(;;) + for (;;) { - if ( GinPageIsDeleted(page) ) + if (GinPageIsDeleted(page)) { /* another cleanup process is running concurrently */ - UnlockReleaseBuffer( buffer ); + UnlockReleaseBuffer(buffer); break; } @@ -742,9 +753,9 @@ ginInsertCleanup(Relation index, GinState *ginstate, vacuum_delay_point(); /* - * Is it time to flush memory to disk? Flush if we are at the end - * of the pending list, or if we have a full row and memory is - * getting full. + * Is it time to flush memory to disk? Flush if we are at the end of + * the pending list, or if we have a full row and memory is getting + * full. * * XXX using up maintenance_work_mem here is probably unreasonably * much, since vacuum might already be using that much. @@ -754,15 +765,16 @@ ginInsertCleanup(Relation index, GinState *ginstate, (accum.allocatedMemory >= maintenance_work_mem * 1024L || accum.maxdepth > GIN_MAX_TREE_DEPTH))) { - ItemPointerData *list; - uint32 nlist; - Datum entry; - OffsetNumber maxoff, attnum; + ItemPointerData *list; + uint32 nlist; + Datum entry; + OffsetNumber maxoff, + attnum; /* - * Unlock current page to increase performance. - * Changes of page will be checked later by comparing - * maxoff after completion of memory flush. + * Unlock current page to increase performance. Changes of page + * will be checked later by comparing maxoff after completion of + * memory flush. */ maxoff = PageGetMaxOffsetNumber(page); LockBuffer(buffer, GIN_UNLOCK); @@ -785,7 +797,7 @@ ginInsertCleanup(Relation index, GinState *ginstate, LockBuffer(metabuffer, GIN_EXCLUSIVE); LockBuffer(buffer, GIN_SHARE); - if ( GinPageIsDeleted(page) ) + if (GinPageIsDeleted(page)) { /* another cleanup process is running concurrently */ UnlockReleaseBuffer(buffer); @@ -795,16 +807,16 @@ ginInsertCleanup(Relation index, GinState *ginstate, /* * While we left the page unlocked, more stuff might have gotten - * added to it. If so, process those entries immediately. There + * added to it. If so, process those entries immediately. There * shouldn't be very many, so we don't worry about the fact that * we're doing this with exclusive lock. Insertion algorithm * gurantees that inserted row(s) will not continue on next page. * NOTE: intentionally no vacuum_delay_point in this loop. */ - if ( PageGetMaxOffsetNumber(page) != maxoff ) + if (PageGetMaxOffsetNumber(page) != maxoff) { ginInitBA(&accum); - processPendingPage(&accum, &datums, page, maxoff+1); + processPendingPage(&accum, &datums, page, maxoff + 1); while ((list = ginGetEntry(&accum, &attnum, &entry, &nlist)) != NULL) ginEntryInsert(index, ginstate, attnum, entry, list, nlist, FALSE); @@ -814,26 +826,27 @@ ginInsertCleanup(Relation index, GinState *ginstate, * Remember next page - it will become the new list head */ blkno = GinPageGetOpaque(page)->rightlink; - UnlockReleaseBuffer(buffer); /* shiftList will do exclusive locking */ + UnlockReleaseBuffer(buffer); /* shiftList will do exclusive + * locking */ /* * remove readed pages from pending list, at this point all * content of readed pages is in regular structure */ - if ( shiftList(index, metabuffer, blkno, stats) ) + if (shiftList(index, metabuffer, blkno, stats)) { /* another cleanup process is running concurrently */ LockBuffer(metabuffer, GIN_UNLOCK); break; } - Assert( blkno == metadata->head ); + Assert(blkno == metadata->head); LockBuffer(metabuffer, GIN_UNLOCK); /* * if we removed the whole pending list just exit */ - if ( blkno == InvalidBlockNumber ) + if (blkno == InvalidBlockNumber) break; /* @@ -842,7 +855,7 @@ ginInsertCleanup(Relation index, GinState *ginstate, MemoryContextReset(opCtx); ginInitBA(&accum); datums.nvalues = 0; - datums.values = (Datum*)palloc(sizeof(Datum)*datums.maxvalues); + datums.values = (Datum *) palloc(sizeof(Datum) * datums.maxvalues); } else { diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c index d57ee8febb..f5e0f788d1 100644 --- a/src/backend/access/gin/ginget.c +++ b/src/backend/access/gin/ginget.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gin/ginget.c,v 1.26 2009/05/19 02:48:26 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/ginget.c,v 1.27 2009/06/11 14:48:53 momjian Exp $ *------------------------------------------------------------------------- */ @@ -25,10 +25,10 @@ typedef struct pendingPosition { - Buffer pendingBuffer; - OffsetNumber firstOffset; - OffsetNumber lastOffset; - ItemPointerData item; + Buffer pendingBuffer; + OffsetNumber firstOffset; + OffsetNumber lastOffset; + ItemPointerData item; } pendingPosition; @@ -64,19 +64,19 @@ findItemInPage(Page page, ItemPointer item, OffsetNumber *off) * Goes to the next page if current offset is outside of bounds */ static bool -moveRightIfItNeeded( GinBtreeData *btree, GinBtreeStack *stack ) +moveRightIfItNeeded(GinBtreeData *btree, GinBtreeStack *stack) { - Page page = BufferGetPage(stack->buffer); + Page page = BufferGetPage(stack->buffer); - if ( stack->off > PageGetMaxOffsetNumber(page) ) + if (stack->off > PageGetMaxOffsetNumber(page)) { /* * We scanned the whole page, so we should take right page */ stack->blkno = GinPageGetOpaque(page)->rightlink; - if ( GinPageRightMost(page) ) - return false; /* no more pages */ + if (GinPageRightMost(page)) + return false; /* no more pages */ LockBuffer(stack->buffer, GIN_UNLOCK); stack->buffer = ReleaseAndReadBuffer(stack->buffer, btree->index, stack->blkno); @@ -92,12 +92,12 @@ moveRightIfItNeeded( GinBtreeData *btree, GinBtreeStack *stack ) * in scanEntry->partialMatch TIDBitmap */ static void -scanForItems( Relation index, GinScanEntry scanEntry, BlockNumber rootPostingTree ) +scanForItems(Relation index, GinScanEntry scanEntry, BlockNumber rootPostingTree) { GinPostingTreeScan *gdi; - Buffer buffer; - Page page; - BlockNumber blkno; + Buffer buffer; + Page page; + BlockNumber blkno; gdi = prepareScanPostingTree(index, rootPostingTree, TRUE); @@ -110,23 +110,23 @@ scanForItems( Relation index, GinScanEntry scanEntry, BlockNumber rootPostingTre /* * Goes through all leaves */ - for(;;) + for (;;) { page = BufferGetPage(buffer); - if ((GinPageGetOpaque(page)->flags & GIN_DELETED) == 0 && GinPageGetOpaque(page)->maxoff >= FirstOffsetNumber ) + if ((GinPageGetOpaque(page)->flags & GIN_DELETED) == 0 && GinPageGetOpaque(page)->maxoff >= FirstOffsetNumber) { - tbm_add_tuples( scanEntry->partialMatch, - (ItemPointer)GinDataPageGetItem(page, FirstOffsetNumber), - GinPageGetOpaque(page)->maxoff, false); + tbm_add_tuples(scanEntry->partialMatch, + (ItemPointer) GinDataPageGetItem(page, FirstOffsetNumber), + GinPageGetOpaque(page)->maxoff, false); scanEntry->predictNumberResult += GinPageGetOpaque(page)->maxoff; } blkno = GinPageGetOpaque(page)->rightlink; - if ( GinPageRightMost(page) ) + if (GinPageRightMost(page)) { UnlockReleaseBuffer(buffer); - return; /* no more pages */ + return; /* no more pages */ } LockBuffer(buffer, GIN_UNLOCK); @@ -142,21 +142,21 @@ scanForItems( Relation index, GinScanEntry scanEntry, BlockNumber rootPostingTre * Returns true if done, false if it's needed to restart scan from scratch */ static bool -computePartialMatchList( GinBtreeData *btree, GinBtreeStack *stack, GinScanEntry scanEntry ) +computePartialMatchList(GinBtreeData *btree, GinBtreeStack *stack, GinScanEntry scanEntry) { - Page page; - IndexTuple itup; + Page page; + IndexTuple itup; Datum idatum; int32 cmp; - scanEntry->partialMatch = tbm_create( work_mem * 1024L ); + scanEntry->partialMatch = tbm_create(work_mem * 1024L); - for(;;) + for (;;) { /* * stack->off points to the interested entry, buffer is already locked */ - if ( moveRightIfItNeeded(btree, stack) == false ) + if (moveRightIfItNeeded(btree, stack) == false) return true; page = BufferGetPage(stack->buffer); @@ -165,10 +165,10 @@ computePartialMatchList( GinBtreeData *btree, GinBtreeStack *stack, GinScanEntry /* * If tuple stores another attribute then stop scan */ - if ( gintuple_get_attrnum( btree->ginstate, itup ) != scanEntry->attnum ) + if (gintuple_get_attrnum(btree->ginstate, itup) != scanEntry->attnum) return true; - idatum = gin_index_getattr( btree->ginstate, itup ); + idatum = gin_index_getattr(btree->ginstate, itup); /*---------- @@ -178,74 +178,74 @@ computePartialMatchList( GinBtreeData *btree, GinBtreeStack *stack, GinScanEntry * case cmp < 0 => not match and continue scan *---------- */ - cmp = DatumGetInt32(FunctionCall4(&btree->ginstate->comparePartialFn[scanEntry->attnum-1], + cmp = DatumGetInt32(FunctionCall4(&btree->ginstate->comparePartialFn[scanEntry->attnum - 1], scanEntry->entry, idatum, UInt16GetDatum(scanEntry->strategy), - PointerGetDatum(scanEntry->extra_data))); + PointerGetDatum(scanEntry->extra_data))); - if ( cmp > 0 ) + if (cmp > 0) return true; - else if ( cmp < 0 ) + else if (cmp < 0) { stack->off++; continue; } - if ( GinIsPostingTree(itup) ) + if (GinIsPostingTree(itup)) { BlockNumber rootPostingTree = GinGetPostingTree(itup); Datum newDatum, - savedDatum = datumCopy ( - idatum, - btree->ginstate->origTupdesc->attrs[scanEntry->attnum-1]->attbyval, - btree->ginstate->origTupdesc->attrs[scanEntry->attnum-1]->attlen - ); + savedDatum = datumCopy( + idatum, + btree->ginstate->origTupdesc->attrs[scanEntry->attnum - 1]->attbyval, + btree->ginstate->origTupdesc->attrs[scanEntry->attnum - 1]->attlen + ); + /* - * We should unlock current page (but not unpin) during - * tree scan to prevent deadlock with vacuum processes. + * We should unlock current page (but not unpin) during tree scan + * to prevent deadlock with vacuum processes. * * We save current entry value (savedDatum) to be able to refind * our tuple after re-locking */ LockBuffer(stack->buffer, GIN_UNLOCK); - scanForItems( btree->index, scanEntry, rootPostingTree ); + scanForItems(btree->index, scanEntry, rootPostingTree); /* - * We lock again the entry page and while it was unlocked - * insert might occured, so we need to refind our position + * We lock again the entry page and while it was unlocked insert + * might occured, so we need to refind our position */ LockBuffer(stack->buffer, GIN_SHARE); page = BufferGetPage(stack->buffer); - if ( !GinPageIsLeaf(page) ) + if (!GinPageIsLeaf(page)) { /* - * Root page becomes non-leaf while we unlock it. We - * will start again, this situation doesn't cause - * often - root can became a non-leaf only one per - * life of index. + * Root page becomes non-leaf while we unlock it. We will + * start again, this situation doesn't cause often - root can + * became a non-leaf only one per life of index. */ return false; } - for(;;) + for (;;) { - if ( moveRightIfItNeeded(btree, stack) == false ) - elog(ERROR, "lost saved point in index"); /* must not happen !!! */ + if (moveRightIfItNeeded(btree, stack) == false) + elog(ERROR, "lost saved point in index"); /* must not happen !!! */ page = BufferGetPage(stack->buffer); itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, stack->off)); - newDatum = gin_index_getattr( btree->ginstate, itup ); + newDatum = gin_index_getattr(btree->ginstate, itup); - if ( gintuple_get_attrnum( btree->ginstate, itup ) != scanEntry->attnum ) - elog(ERROR, "lost saved point in index"); /* must not happen !!! */ + if (gintuple_get_attrnum(btree->ginstate, itup) != scanEntry->attnum) + elog(ERROR, "lost saved point in index"); /* must not happen !!! */ - if ( compareEntries(btree->ginstate, scanEntry->attnum, newDatum, savedDatum) == 0 ) + if (compareEntries(btree->ginstate, scanEntry->attnum, newDatum, savedDatum) == 0) { /* Found! */ - if ( btree->ginstate->origTupdesc->attrs[scanEntry->attnum-1]->attbyval == false ) - pfree( DatumGetPointer(savedDatum) ); + if (btree->ginstate->origTupdesc->attrs[scanEntry->attnum - 1]->attbyval == false) + pfree(DatumGetPointer(savedDatum)); break; } @@ -254,8 +254,8 @@ computePartialMatchList( GinBtreeData *btree, GinBtreeStack *stack, GinScanEntry } else { - tbm_add_tuples( scanEntry->partialMatch, GinGetPosting(itup), GinGetNPosting(itup), false); - scanEntry->predictNumberResult += GinGetNPosting(itup); + tbm_add_tuples(scanEntry->partialMatch, GinGetPosting(itup), GinGetNPosting(itup), false); + scanEntry->predictNumberResult += GinGetNPosting(itup); } /* @@ -273,10 +273,10 @@ computePartialMatchList( GinBtreeData *btree, GinBtreeStack *stack, GinScanEntry static void startScanEntry(Relation index, GinState *ginstate, GinScanEntry entry) { - GinBtreeData btreeEntry; - GinBtreeStack *stackEntry; - Page page; - bool needUnlock = TRUE; + GinBtreeData btreeEntry; + GinBtreeStack *stackEntry; + Page page; + bool needUnlock = TRUE; entry->buffer = InvalidBuffer; entry->offset = InvalidOffsetNumber; @@ -294,8 +294,8 @@ startScanEntry(Relation index, GinState *ginstate, GinScanEntry entry) } /* - * we should find entry, and begin scan of posting tree - * or just store posting list in memory + * we should find entry, and begin scan of posting tree or just store + * posting list in memory */ prepareEntryScan(&btreeEntry, index, entry->attnum, entry->entry, ginstate); @@ -305,27 +305,26 @@ startScanEntry(Relation index, GinState *ginstate, GinScanEntry entry) entry->isFinished = TRUE; - if ( entry->isPartialMatch ) + if (entry->isPartialMatch) { /* - * btreeEntry.findItem points to the first equal or greater value - * than needed. So we will scan further and collect all - * ItemPointers + * btreeEntry.findItem points to the first equal or greater value than + * needed. So we will scan further and collect all ItemPointers */ btreeEntry.findItem(&btreeEntry, stackEntry); - if ( computePartialMatchList( &btreeEntry, stackEntry, entry ) == false ) + if (computePartialMatchList(&btreeEntry, stackEntry, entry) == false) { /* - * GIN tree was seriously restructured, so we will - * cleanup all found data and rescan. See comments near - * 'return false' in computePartialMatchList() + * GIN tree was seriously restructured, so we will cleanup all + * found data and rescan. See comments near 'return false' in + * computePartialMatchList() */ - if ( entry->partialMatch ) + if (entry->partialMatch) { if (entry->partialMatchIterator) tbm_end_iterate(entry->partialMatchIterator); entry->partialMatchIterator = NULL; - tbm_free( entry->partialMatch ); + tbm_free(entry->partialMatch); entry->partialMatch = NULL; } LockBuffer(stackEntry->buffer, GIN_UNLOCK); @@ -335,7 +334,7 @@ startScanEntry(Relation index, GinState *ginstate, GinScanEntry entry) return; } - if ( entry->partialMatch && !tbm_is_empty(entry->partialMatch) ) + if (entry->partialMatch && !tbm_is_empty(entry->partialMatch)) { entry->partialMatchIterator = tbm_begin_iterate(entry->partialMatch); entry->isFinished = FALSE; @@ -352,22 +351,22 @@ startScanEntry(Relation index, GinState *ginstate, GinScanEntry entry) Page page; /* - * We should unlock entry page before make deal with - * posting tree to prevent deadlocks with vacuum processes. - * Because entry is never deleted from page and posting tree is - * never reduced to the posting list, we can unlock page after - * getting BlockNumber of root of posting tree. + * We should unlock entry page before make deal with posting tree + * to prevent deadlocks with vacuum processes. Because entry is + * never deleted from page and posting tree is never reduced to + * the posting list, we can unlock page after getting BlockNumber + * of root of posting tree. */ LockBuffer(stackEntry->buffer, GIN_UNLOCK); needUnlock = FALSE; gdi = prepareScanPostingTree(index, rootPostingTree, TRUE); entry->buffer = scanBeginPostingTree(gdi); + /* * We keep buffer pinned because we need to prevent deletion of - * page during scan. See GIN's vacuum implementation. RefCount - * is increased to keep buffer pinned after freeGinBtreeStack() - * call. + * page during scan. See GIN's vacuum implementation. RefCount is + * increased to keep buffer pinned after freeGinBtreeStack() call. */ IncrBufferRefCount(entry->buffer); @@ -377,10 +376,10 @@ startScanEntry(Relation index, GinState *ginstate, GinScanEntry entry) /* * Keep page content in memory to prevent durable page locking */ - entry->list = (ItemPointerData *) palloc( BLCKSZ ); + entry->list = (ItemPointerData *) palloc(BLCKSZ); entry->nlist = GinPageGetOpaque(page)->maxoff; - memcpy( entry->list, GinDataPageGetItem(page, FirstOffsetNumber), - GinPageGetOpaque(page)->maxoff * sizeof(ItemPointerData) ); + memcpy(entry->list, GinDataPageGetItem(page, FirstOffsetNumber), + GinPageGetOpaque(page)->maxoff * sizeof(ItemPointerData)); LockBuffer(entry->buffer, GIN_UNLOCK); freeGinBtreeStack(gdi->stack); @@ -397,7 +396,7 @@ startScanEntry(Relation index, GinState *ginstate, GinScanEntry entry) } if (needUnlock) - LockBuffer(stackEntry->buffer, GIN_UNLOCK); + LockBuffer(stackEntry->buffer, GIN_UNLOCK); freeGinBtreeStack(stackEntry); } @@ -419,10 +418,10 @@ startScanKey(Relation index, GinState *ginstate, GinScanKey key) if (GinFuzzySearchLimit > 0) { /* - * If all of keys more than threshold we will try to reduce - * result, we hope (and only hope, for intersection operation of - * array our supposition isn't true), that total result will not - * more than minimal predictNumberResult. + * If all of keys more than threshold we will try to reduce result, we + * hope (and only hope, for intersection operation of array our + * supposition isn't true), that total result will not more than + * minimal predictNumberResult. */ for (i = 0; i < key->nentries; i++) @@ -459,7 +458,7 @@ entryGetNextItem(Relation index, GinScanEntry entry) Page page; BlockNumber blkno; - for(;;) + for (;;) { entry->offset++; @@ -471,7 +470,7 @@ entryGetNextItem(Relation index, GinScanEntry entry) LockBuffer(entry->buffer, GIN_SHARE); page = BufferGetPage(entry->buffer); - for(;;) + for (;;) { /* * It's needed to go by right link. During that we should refind @@ -501,20 +500,20 @@ entryGetNextItem(Relation index, GinScanEntry entry) * Found position equal to or greater than stored */ entry->nlist = GinPageGetOpaque(page)->maxoff; - memcpy( entry->list, GinDataPageGetItem(page, FirstOffsetNumber), - GinPageGetOpaque(page)->maxoff * sizeof(ItemPointerData) ); + memcpy(entry->list, GinDataPageGetItem(page, FirstOffsetNumber), + GinPageGetOpaque(page)->maxoff * sizeof(ItemPointerData)); LockBuffer(entry->buffer, GIN_UNLOCK); - if ( !ItemPointerIsValid(&entry->curItem) || - compareItemPointers( &entry->curItem, entry->list + entry->offset - 1 ) == 0 ) + if (!ItemPointerIsValid(&entry->curItem) || + compareItemPointers(&entry->curItem, entry->list + entry->offset - 1) == 0) { /* - * First pages are deleted or empty, or we found exact position, - * so break inner loop and continue outer one. + * First pages are deleted or empty, or we found exact + * position, so break inner loop and continue outer one. */ - break; + break; } /* @@ -543,7 +542,7 @@ entryGetItem(Relation index, GinScanEntry entry) entry->isFinished = entry->master->isFinished; entry->curItem = entry->master->curItem; } - else if ( entry->partialMatch ) + else if (entry->partialMatch) { do { @@ -552,7 +551,7 @@ entryGetItem(Relation index, GinScanEntry entry) { entry->partialMatchResult = tbm_iterate(entry->partialMatchIterator); - if ( entry->partialMatchResult == NULL ) + if (entry->partialMatchResult == NULL) { ItemPointerSet(&entry->curItem, InvalidBlockNumber, InvalidOffsetNumber); tbm_end_iterate(entry->partialMatchIterator); @@ -562,22 +561,23 @@ entryGetItem(Relation index, GinScanEntry entry) } /* - * reset counter to the beginning of entry->partialMatchResult. - * Note: entry->offset is still greater than - * partialMatchResult->ntuples if partialMatchResult is - * lossy. So, on next call we will get next result from - * TIDBitmap. + * reset counter to the beginning of + * entry->partialMatchResult. Note: entry->offset is still + * greater than partialMatchResult->ntuples if + * partialMatchResult is lossy. So, on next call we will get + * next result from TIDBitmap. */ entry->offset = 0; } - if ( entry->partialMatchResult->ntuples < 0 ) + if (entry->partialMatchResult->ntuples < 0) { /* * lossy result, so we need to check the whole page */ ItemPointerSetLossyPage(&entry->curItem, entry->partialMatchResult->blockno); + /* * We might as well fall out of the loop; we could not * estimate number of results on this page to support correct @@ -618,7 +618,7 @@ entryGetItem(Relation index, GinScanEntry entry) * Sets key->curItem to new found heap item pointer for one scan key * Returns isFinished, ie TRUE means we did NOT get a new item pointer! * Also, *keyrecheck is set true if recheck is needed for this scan key. - * Note: lossy page could be returned after items from the same page. + * Note: lossy page could be returned after items from the same page. */ static bool keyGetItem(Relation index, GinState *ginstate, MemoryContext tempCtx, @@ -636,10 +636,10 @@ keyGetItem(Relation index, GinState *ginstate, MemoryContext tempCtx, { /* * move forward from previously value and set new curItem, which is - * minimal from entries->curItems. Lossy page is encoded by ItemPointer - * with max value for offset (0xffff), so if there is an non-lossy entries - * on lossy page they will returned too and after that the whole page. - * That's not a problem for resulting tidbitmap. + * minimal from entries->curItems. Lossy page is encoded by + * ItemPointer with max value for offset (0xffff), so if there is an + * non-lossy entries on lossy page they will returned too and after + * that the whole page. That's not a problem for resulting tidbitmap. */ ItemPointerSetMax(&key->curItem); for (i = 0; i < key->nentries; i++) @@ -649,9 +649,9 @@ keyGetItem(Relation index, GinState *ginstate, MemoryContext tempCtx, if (key->entryRes[i]) { /* - * Move forward only entries which was the least - * on previous call, key->entryRes[i] points that - * current entry was a result of loop/call. + * Move forward only entries which was the least on previous + * call, key->entryRes[i] points that current entry was a + * result of loop/call. */ if (entry->isFinished == FALSE && entryGetItem(index, entry) == FALSE) { @@ -685,10 +685,10 @@ keyGetItem(Relation index, GinState *ginstate, MemoryContext tempCtx, /*---------- * entryRes array is used for: * - as an argument for consistentFn - * - entry->curItem with corresponding key->entryRes[i] == false are - * greater than key->curItem, so next loop/call they should be - * renewed by entryGetItem(). So, we need to set up an array before - * checking of lossy page. + * - entry->curItem with corresponding key->entryRes[i] == false are + * greater than key->curItem, so next loop/call they should be + * renewed by entryGetItem(). So, we need to set up an array before + * checking of lossy page. *---------- */ for (i = 0; i < key->nentries; i++) @@ -717,7 +717,7 @@ keyGetItem(Relation index, GinState *ginstate, MemoryContext tempCtx, return FALSE; oldCtx = MemoryContextSwitchTo(tempCtx); - res = DatumGetBool(FunctionCall6(&ginstate->consistentFn[key->attnum-1], + res = DatumGetBool(FunctionCall6(&ginstate->consistentFn[key->attnum - 1], PointerGetDatum(key->entryRes), UInt16GetDatum(key->strategy), key->query, @@ -745,35 +745,36 @@ keyGetItem(Relation index, GinState *ginstate, MemoryContext tempCtx, static bool scanGetCandidate(IndexScanDesc scan, pendingPosition *pos) { - OffsetNumber maxoff; - Page page; - IndexTuple itup; + OffsetNumber maxoff; + Page page; + IndexTuple itup; - ItemPointerSetInvalid( &pos->item ); - for(;;) + ItemPointerSetInvalid(&pos->item); + for (;;) { page = BufferGetPage(pos->pendingBuffer); maxoff = PageGetMaxOffsetNumber(page); - if ( pos->firstOffset > maxoff ) + if (pos->firstOffset > maxoff) { BlockNumber blkno = GinPageGetOpaque(page)->rightlink; - if ( blkno == InvalidBlockNumber ) + + if (blkno == InvalidBlockNumber) { UnlockReleaseBuffer(pos->pendingBuffer); - pos->pendingBuffer=InvalidBuffer; + pos->pendingBuffer = InvalidBuffer; return false; } else { /* - * Here we must prevent deletion of next page by - * insertcleanup process, which may be trying to obtain - * exclusive lock on current page. So, we lock next - * page before releasing the current one + * Here we must prevent deletion of next page by insertcleanup + * process, which may be trying to obtain exclusive lock on + * current page. So, we lock next page before releasing the + * current one */ - Buffer tmpbuf = ReadBuffer(scan->indexRelation, blkno); + Buffer tmpbuf = ReadBuffer(scan->indexRelation, blkno); LockBuffer(tmpbuf, GIN_SHARE); UnlockReleaseBuffer(pos->pendingBuffer); @@ -786,12 +787,12 @@ scanGetCandidate(IndexScanDesc scan, pendingPosition *pos) { itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, pos->firstOffset)); pos->item = itup->t_tid; - if ( GinPageHasFullRow(page) ) + if (GinPageHasFullRow(page)) { /* * find itempointer to the next row */ - for(pos->lastOffset = pos->firstOffset+1; pos->lastOffset<=maxoff; pos->lastOffset++) + for (pos->lastOffset = pos->firstOffset + 1; pos->lastOffset <= maxoff; pos->lastOffset++) { itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, pos->lastOffset)); if (!ItemPointerEquals(&pos->item, &itup->t_tid)) @@ -807,9 +808,9 @@ scanGetCandidate(IndexScanDesc scan, pendingPosition *pos) } /* - * Now pos->firstOffset points to the first tuple of current heap row, - * pos->lastOffset points to the first tuple of second heap row (or - * to the end of page) + * Now pos->firstOffset points to the first tuple of current heap + * row, pos->lastOffset points to the first tuple of second heap + * row (or to the end of page) */ break; @@ -830,23 +831,23 @@ static bool matchPartialInPendingList(GinState *ginstate, Page page, OffsetNumber off, OffsetNumber maxoff, Datum value, OffsetNumber attrnum, - Datum *datum, bool *datumExtracted, + Datum *datum, bool *datumExtracted, StrategyNumber strategy, Pointer extra_data) { - IndexTuple itup; - int32 cmp; + IndexTuple itup; + int32 cmp; - while ( off < maxoff ) + while (off < maxoff) { itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, off)); - if ( attrnum != gintuple_get_attrnum(ginstate, itup) ) + if (attrnum != gintuple_get_attrnum(ginstate, itup)) return false; - if (datumExtracted[ off-1 ] == false) + if (datumExtracted[off - 1] == false) { - datum[ off-1 ] = gin_index_getattr(ginstate, itup); - datumExtracted[ off-1 ] = true; + datum[off - 1] = gin_index_getattr(ginstate, itup); + datumExtracted[off - 1] = true; } /*---------- @@ -856,9 +857,9 @@ matchPartialInPendingList(GinState *ginstate, Page page, * case cmp < 0 => not match and continue scan *---------- */ - cmp = DatumGetInt32(FunctionCall4(&ginstate->comparePartialFn[attrnum-1], + cmp = DatumGetInt32(FunctionCall4(&ginstate->comparePartialFn[attrnum - 1], value, - datum[off-1], + datum[off - 1], UInt16GetDatum(strategy), PointerGetDatum(extra_data))); if (cmp == 0) @@ -882,12 +883,13 @@ matchPartialInPendingList(GinState *ginstate, Page page, static bool collectDatumForItem(IndexScanDesc scan, pendingPosition *pos) { - GinScanOpaque so = (GinScanOpaque) scan->opaque; - OffsetNumber attrnum; - Page page; - IndexTuple itup; - int i, j; - bool hasMatch = false; + GinScanOpaque so = (GinScanOpaque) scan->opaque; + OffsetNumber attrnum; + Page page; + IndexTuple itup; + int i, + j; + bool hasMatch = false; /* * Resets entryRes @@ -895,38 +897,40 @@ collectDatumForItem(IndexScanDesc scan, pendingPosition *pos) for (i = 0; i < so->nkeys; i++) { GinScanKey key = so->keys + i; - memset( key->entryRes, FALSE, key->nentries ); + + memset(key->entryRes, FALSE, key->nentries); } - for(;;) + for (;;) { - Datum datum[ BLCKSZ/sizeof(IndexTupleData) ]; - bool datumExtracted[ BLCKSZ/sizeof(IndexTupleData) ]; + Datum datum[BLCKSZ / sizeof(IndexTupleData)]; + bool datumExtracted[BLCKSZ / sizeof(IndexTupleData)]; - Assert( pos->lastOffset > pos->firstOffset ); - memset(datumExtracted + pos->firstOffset - 1, 0, sizeof(bool) * (pos->lastOffset - pos->firstOffset )); + Assert(pos->lastOffset > pos->firstOffset); + memset(datumExtracted + pos->firstOffset - 1, 0, sizeof(bool) * (pos->lastOffset - pos->firstOffset)); page = BufferGetPage(pos->pendingBuffer); - for(i = 0; i < so->nkeys; i++) + for (i = 0; i < so->nkeys; i++) { - GinScanKey key = so->keys + i; + GinScanKey key = so->keys + i; - for(j=0; j<key->nentries; j++) + for (j = 0; j < key->nentries; j++) { - OffsetNumber StopLow = pos->firstOffset, - StopHigh = pos->lastOffset, - StopMiddle; - GinScanEntry entry = key->scanEntry + j; + OffsetNumber StopLow = pos->firstOffset, + StopHigh = pos->lastOffset, + StopMiddle; + GinScanEntry entry = key->scanEntry + j; /* already true - do not extra work */ - if ( key->entryRes[j] ) + if (key->entryRes[j]) continue; /* - * Interested tuples are from pos->firstOffset to pos->lastOffset - * and they are ordered by (attnum, Datum) as it's done in entry tree - * So we could use binary search to prevent linear scanning + * Interested tuples are from pos->firstOffset to + * pos->lastOffset and they are ordered by (attnum, Datum) as + * it's done in entry tree So we could use binary search to + * prevent linear scanning */ while (StopLow < StopHigh) { @@ -941,53 +945,53 @@ collectDatumForItem(IndexScanDesc scan, pendingPosition *pos) StopLow = StopMiddle + 1; else { - int res; + int res; - if (datumExtracted[ StopMiddle-1 ] == false) + if (datumExtracted[StopMiddle - 1] == false) { - datum[ StopMiddle-1 ] = gin_index_getattr(&so->ginstate, itup); - datumExtracted[ StopMiddle-1 ] = true; + datum[StopMiddle - 1] = gin_index_getattr(&so->ginstate, itup); + datumExtracted[StopMiddle - 1] = true; } - res = compareEntries(&so->ginstate, - entry->attnum, - entry->entry, - datum[ StopMiddle-1 ]); + res = compareEntries(&so->ginstate, + entry->attnum, + entry->entry, + datum[StopMiddle - 1]); - if ( res == 0 ) + if (res == 0) { /* - * The exact match causes, so we just scan from - * current position to find a partial match. - * See comment above about tuple's ordering. + * The exact match causes, so we just scan from + * current position to find a partial match. See + * comment above about tuple's ordering. */ - if ( entry->isPartialMatch ) + if (entry->isPartialMatch) key->entryRes[j] = matchPartialInPendingList(&so->ginstate, - page, StopMiddle, + page, StopMiddle, pos->lastOffset, entry->entry, entry->attnum, datum, datumExtracted, entry->strategy, - entry->extra_data); + entry->extra_data); else key->entryRes[j] = true; break; } - else if ( res < 0 ) + else if (res < 0) StopHigh = StopMiddle; else StopLow = StopMiddle + 1; } } - if ( StopLow>=StopHigh && entry->isPartialMatch ) + if (StopLow >= StopHigh && entry->isPartialMatch) { - /* - * The exact match wasn't found, so we need to start - * scan from first tuple greater then current entry - * See comment above about tuple's ordering. + /* + * The exact match wasn't found, so we need to start scan + * from first tuple greater then current entry See comment + * above about tuple's ordering. */ key->entryRes[j] = matchPartialInPendingList(&so->ginstate, @@ -1007,7 +1011,7 @@ collectDatumForItem(IndexScanDesc scan, pendingPosition *pos) pos->firstOffset = pos->lastOffset; - if ( GinPageHasFullRow(page) ) + if (GinPageHasFullRow(page)) { /* * We scan all values from one tuple, go to next one @@ -1020,12 +1024,13 @@ collectDatumForItem(IndexScanDesc scan, pendingPosition *pos) ItemPointerData item = pos->item; /* - * need to get next portion of tuples of row containing - * on several pages + * need to get next portion of tuples of row containing on several + * pages */ - if ( scanGetCandidate(scan, pos) == false || !ItemPointerEquals(&pos->item, &item) ) - elog(ERROR,"Could not process tuple"); /* XXX should not be here ! */ + if (scanGetCandidate(scan, pos) == false || !ItemPointerEquals(&pos->item, &item)) + elog(ERROR, "Could not process tuple"); /* XXX should not be + * here ! */ } } @@ -1039,12 +1044,14 @@ static void scanPendingInsert(IndexScanDesc scan, TIDBitmap *tbm, int64 *ntids) { GinScanOpaque so = (GinScanOpaque) scan->opaque; - MemoryContext oldCtx; - bool recheck, keyrecheck, match; - int i; - pendingPosition pos; - Buffer metabuffer = ReadBuffer(scan->indexRelation, GIN_METAPAGE_BLKNO); - BlockNumber blkno; + MemoryContext oldCtx; + bool recheck, + keyrecheck, + match; + int i; + pendingPosition pos; + Buffer metabuffer = ReadBuffer(scan->indexRelation, GIN_METAPAGE_BLKNO); + BlockNumber blkno; *ntids = 0; @@ -1052,39 +1059,38 @@ scanPendingInsert(IndexScanDesc scan, TIDBitmap *tbm, int64 *ntids) blkno = GinPageGetMeta(BufferGetPage(metabuffer))->head; /* - * fetch head of list before unlocking metapage. - * head page must be pinned to prevent deletion by vacuum process + * fetch head of list before unlocking metapage. head page must be pinned + * to prevent deletion by vacuum process */ - if ( blkno == InvalidBlockNumber ) + if (blkno == InvalidBlockNumber) { /* No pending list, so proceed with normal scan */ - UnlockReleaseBuffer( metabuffer ); + UnlockReleaseBuffer(metabuffer); return; } pos.pendingBuffer = ReadBuffer(scan->indexRelation, blkno); LockBuffer(pos.pendingBuffer, GIN_SHARE); pos.firstOffset = FirstOffsetNumber; - UnlockReleaseBuffer( metabuffer ); + UnlockReleaseBuffer(metabuffer); /* - * loop for each heap row. scanGetCandidate returns full row - * or row's tuples from first page. + * loop for each heap row. scanGetCandidate returns full row or row's + * tuples from first page. */ - while( scanGetCandidate(scan, &pos) ) + while (scanGetCandidate(scan, &pos)) { - /* - * Check entries in tuple and setup entryRes array - * If tuples of heap's row are placed on several pages - * collectDatumForItem will read all of that pages. + * Check entries in tuple and setup entryRes array If tuples of heap's + * row are placed on several pages collectDatumForItem will read all + * of that pages. */ if (!collectDatumForItem(scan, &pos)) continue; /* - * Matching of entries of one row is finished, - * so check row by consistent function. + * Matching of entries of one row is finished, so check row by + * consistent function. */ oldCtx = MemoryContextSwitchTo(so->tempCtx); recheck = false; @@ -1092,11 +1098,11 @@ scanPendingInsert(IndexScanDesc scan, TIDBitmap *tbm, int64 *ntids) for (i = 0; i < so->nkeys; i++) { - GinScanKey key = so->keys + i; + GinScanKey key = so->keys + i; keyrecheck = true; - if (!DatumGetBool(FunctionCall6(&so->ginstate.consistentFn[key->attnum-1], + if (!DatumGetBool(FunctionCall6(&so->ginstate.consistentFn[key->attnum - 1], PointerGetDatum(key->entryRes), UInt16GetDatum(key->strategy), key->query, @@ -1114,7 +1120,7 @@ scanPendingInsert(IndexScanDesc scan, TIDBitmap *tbm, int64 *ntids) MemoryContextSwitchTo(oldCtx); MemoryContextReset(so->tempCtx); - if ( match ) + if (match) { tbm_add_tuples(tbm, &pos.item, 1, recheck); (*ntids)++; @@ -1137,10 +1143,10 @@ scanGetItem(IndexScanDesc scan, ItemPointerData *item, bool *recheck) * We return recheck = true if any of the keyGetItem calls return * keyrecheck = true. Note that because the second loop might advance * some keys, this could theoretically be too conservative. In practice - * though, we expect that a consistentFn's recheck result will depend - * only on the operator and the query, so for any one key it should - * stay the same regardless of advancing to new items. So it's not - * worth working harder. + * though, we expect that a consistentFn's recheck result will depend only + * on the operator and the query, so for any one key it should stay the + * same regardless of advancing to new items. So it's not worth working + * harder. */ *recheck = false; @@ -1165,13 +1171,13 @@ scanGetItem(IndexScanDesc scan, ItemPointerData *item, bool *recheck) { int cmp = compareItemPointers(item, &key->curItem); - if ( cmp != 0 && (ItemPointerIsLossyPage(item) || ItemPointerIsLossyPage(&key->curItem)) ) + if (cmp != 0 && (ItemPointerIsLossyPage(item) || ItemPointerIsLossyPage(&key->curItem))) { /* * if one of ItemPointers points to the whole page then * compare only page's number */ - if ( ItemPointerGetBlockNumber(item) == ItemPointerGetBlockNumber(&key->curItem) ) + if (ItemPointerGetBlockNumber(item) == ItemPointerGetBlockNumber(&key->curItem)) cmp = 0; else cmp = (ItemPointerGetBlockNumber(item) > ItemPointerGetBlockNumber(&key->curItem)) ? 1 : -1; @@ -1205,7 +1211,7 @@ Datum gingetbitmap(PG_FUNCTION_ARGS) { IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0); - TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1); + TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1); int64 ntids; if (GinIsNewKey(scan)) @@ -1217,15 +1223,14 @@ gingetbitmap(PG_FUNCTION_ARGS) ntids = 0; /* - * First, scan the pending list and collect any matching entries into - * the bitmap. After we scan a pending item, some other backend could - * post it into the main index, and so we might visit it a second time - * during the main scan. This is okay because we'll just re-set the - * same bit in the bitmap. (The possibility of duplicate visits is a - * major reason why GIN can't support the amgettuple API, however.) - * Note that it would not do to scan the main index before the pending - * list, since concurrent cleanup could then make us miss entries - * entirely. + * First, scan the pending list and collect any matching entries into the + * bitmap. After we scan a pending item, some other backend could post it + * into the main index, and so we might visit it a second time during the + * main scan. This is okay because we'll just re-set the same bit in the + * bitmap. (The possibility of duplicate visits is a major reason why GIN + * can't support the amgettuple API, however.) Note that it would not do + * to scan the main index before the pending list, since concurrent + * cleanup could then make us miss entries entirely. */ scanPendingInsert(scan, tbm, &ntids); @@ -1244,7 +1249,7 @@ gingetbitmap(PG_FUNCTION_ARGS) if (!scanGetItem(scan, &iptr, &recheck)) break; - if ( ItemPointerIsLossyPage(&iptr) ) + if (ItemPointerIsLossyPage(&iptr)) tbm_add_page(tbm, ItemPointerGetBlockNumber(&iptr)); else tbm_add_tuples(tbm, &iptr, 1, recheck); diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c index ef3d4bbb03..2adaed43d4 100644 --- a/src/backend/access/gin/gininsert.c +++ b/src/backend/access/gin/gininsert.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gin/gininsert.c,v 1.21 2009/06/06 02:39:40 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/gininsert.c,v 1.22 2009/06/11 14:48:53 momjian Exp $ *------------------------------------------------------------------------- */ @@ -100,15 +100,15 @@ static IndexTuple addItemPointersToTuple(Relation index, GinState *ginstate, GinBtreeStack *stack, IndexTuple old, ItemPointerData *items, uint32 nitem, bool isBuild) { - Datum key = gin_index_getattr(ginstate, old); - OffsetNumber attnum = gintuple_get_attrnum(ginstate, old); - IndexTuple res = GinFormTuple(ginstate, attnum, key, - NULL, nitem + GinGetNPosting(old)); + Datum key = gin_index_getattr(ginstate, old); + OffsetNumber attnum = gintuple_get_attrnum(ginstate, old); + IndexTuple res = GinFormTuple(ginstate, attnum, key, + NULL, nitem + GinGetNPosting(old)); if (res) { /* good, small enough */ - uint32 newnitem; + uint32 newnitem; newnitem = MergeItemPointers(GinGetPosting(res), GinGetPosting(old), GinGetNPosting(old), @@ -236,15 +236,15 @@ ginBuildCallback(Relation index, HeapTuple htup, Datum *values, { GinBuildState *buildstate = (GinBuildState *) state; MemoryContext oldCtx; - int i; + int i; oldCtx = MemoryContextSwitchTo(buildstate->tmpCtx); - for(i=0; i<buildstate->ginstate.origTupdesc->natts;i++) - if ( !isnull[i] ) - buildstate->indtuples += ginHeapTupleBulkInsert(buildstate, - (OffsetNumber)(i+1), values[i], - &htup->t_self); + for (i = 0; i < buildstate->ginstate.origTupdesc->natts; i++) + if (!isnull[i]) + buildstate->indtuples += ginHeapTupleBulkInsert(buildstate, + (OffsetNumber) (i + 1), values[i], + &htup->t_self); /* If we've maxed out our available memory, dump everything to the index */ /* Also dump if the tree seems to be getting too unbalanced */ @@ -254,7 +254,7 @@ ginBuildCallback(Relation index, HeapTuple htup, Datum *values, ItemPointerData *list; Datum entry; uint32 nlist; - OffsetNumber attnum; + OffsetNumber attnum; while ((list = ginGetEntry(&buildstate->accum, &attnum, &entry, &nlist)) != NULL) { @@ -279,7 +279,8 @@ ginbuild(PG_FUNCTION_ARGS) IndexBuildResult *result; double reltuples; GinBuildState buildstate; - Buffer RootBuffer, MetaBuffer; + Buffer RootBuffer, + MetaBuffer; ItemPointerData *list; Datum entry; uint32 nlist; @@ -316,7 +317,7 @@ ginbuild(PG_FUNCTION_ARGS) rdata.next = NULL; recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_CREATE_INDEX, &rdata); - + page = BufferGetPage(RootBuffer); PageSetLSN(page, recptr); PageSetTLI(page, ThisTimeLineID); @@ -420,7 +421,7 @@ gininsert(PG_FUNCTION_ARGS) MemoryContext oldCtx; MemoryContext insertCtx; uint32 res = 0; - int i; + int i; insertCtx = AllocSetContextCreate(CurrentMemoryContext, "Gin insert temporary context", @@ -432,24 +433,24 @@ gininsert(PG_FUNCTION_ARGS) initGinState(&ginstate, index); - if ( GinGetUseFastUpdate(index) ) + if (GinGetUseFastUpdate(index)) { - GinTupleCollector collector; + GinTupleCollector collector; memset(&collector, 0, sizeof(GinTupleCollector)); - for(i=0; i<ginstate.origTupdesc->natts;i++) - if ( !isnull[i] ) + for (i = 0; i < ginstate.origTupdesc->natts; i++) + if (!isnull[i]) res += ginHeapTupleFastCollect(index, &ginstate, &collector, - (OffsetNumber)(i+1), values[i], ht_ctid); + (OffsetNumber) (i + 1), values[i], ht_ctid); ginHeapTupleFastInsert(index, &ginstate, &collector); } else { - for(i=0; i<ginstate.origTupdesc->natts;i++) - if ( !isnull[i] ) - res += ginHeapTupleInsert(index, &ginstate, - (OffsetNumber)(i+1), values[i], ht_ctid); + for (i = 0; i < ginstate.origTupdesc->natts; i++) + if (!isnull[i]) + res += ginHeapTupleInsert(index, &ginstate, + (OffsetNumber) (i + 1), values[i], ht_ctid); } diff --git a/src/backend/access/gin/ginscan.c b/src/backend/access/gin/ginscan.c index a3d1135708..bda97033ad 100644 --- a/src/backend/access/gin/ginscan.c +++ b/src/backend/access/gin/ginscan.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gin/ginscan.c,v 1.23 2009/04/05 11:32:01 teodor Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/ginscan.c,v 1.24 2009/06/11 14:48:53 momjian Exp $ *------------------------------------------------------------------------- */ @@ -37,7 +37,7 @@ ginbeginscan(PG_FUNCTION_ARGS) static void fillScanKey(GinState *ginstate, GinScanKey key, OffsetNumber attnum, Datum query, - Datum *entryValues, bool *partial_matches, uint32 nEntryValues, + Datum *entryValues, bool *partial_matches, uint32 nEntryValues, StrategyNumber strategy, Pointer *extra_data) { uint32 i, @@ -68,8 +68,8 @@ fillScanKey(GinState *ginstate, GinScanKey key, OffsetNumber attnum, Datum query key->scanEntry[i].strategy = strategy; key->scanEntry[i].list = NULL; key->scanEntry[i].nlist = 0; - key->scanEntry[i].isPartialMatch = ( ginstate->canPartialMatch[attnum - 1] && partial_matches ) - ? partial_matches[i] : false; + key->scanEntry[i].isPartialMatch = (ginstate->canPartialMatch[attnum - 1] && partial_matches) + ? partial_matches[i] : false; /* link to the equals entry in current scan key */ key->scanEntry[i].master = NULL; @@ -172,12 +172,12 @@ newScanKey(IndexScanDesc scan) ScanKey skey = &scankey[i]; Datum *entryValues; int32 nEntryValues = 0; - bool *partial_matches = NULL; - Pointer *extra_data = NULL; + bool *partial_matches = NULL; + Pointer *extra_data = NULL; /* - * Assume, that GIN-indexable operators are strict, so - * nothing could be found + * Assume, that GIN-indexable operators are strict, so nothing could + * be found */ if (skey->sk_flags & SK_ISNULL) { @@ -196,8 +196,8 @@ newScanKey(IndexScanDesc scan) if (nEntryValues < 0) { /* - * extractQueryFn signals that nothing can match, so we can - * just set isVoidRes flag. No need to examine any more keys. + * extractQueryFn signals that nothing can match, so we can just + * set isVoidRes flag. No need to examine any more keys. */ so->isVoidRes = true; break; @@ -206,10 +206,10 @@ newScanKey(IndexScanDesc scan) if (entryValues == NULL || nEntryValues == 0) { /* - * extractQueryFn signals that everything matches. This would - * require a full scan, which we can't do, but perhaps there - * is another scankey that provides a restriction to use. So - * we keep going and check only at the end. + * extractQueryFn signals that everything matches. This would + * require a full scan, which we can't do, but perhaps there is + * another scankey that provides a restriction to use. So we keep + * going and check only at the end. */ continue; } diff --git a/src/backend/access/gin/ginutil.c b/src/backend/access/gin/ginutil.c index e0951a6a4f..3834ae3b56 100644 --- a/src/backend/access/gin/ginutil.c +++ b/src/backend/access/gin/ginutil.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gin/ginutil.c,v 1.21 2009/03/24 20:17:11 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/ginutil.c,v 1.22 2009/06/11 14:48:53 momjian Exp $ *------------------------------------------------------------------------- */ @@ -16,7 +16,7 @@ #include "access/genam.h" #include "access/gin.h" #include "access/reloptions.h" -#include "catalog/pg_type.h" +#include "catalog/pg_type.h" #include "storage/bufmgr.h" #include "storage/freespace.h" #include "storage/indexfsm.h" @@ -25,44 +25,44 @@ void initGinState(GinState *state, Relation index) { - int i; + int i; state->origTupdesc = index->rd_att; state->oneCol = (index->rd_att->natts == 1) ? true : false; - for(i=0;i<index->rd_att->natts;i++) + for (i = 0; i < index->rd_att->natts; i++) { - state->tupdesc[i] = CreateTemplateTupleDesc(2,false); + state->tupdesc[i] = CreateTemplateTupleDesc(2, false); - TupleDescInitEntry( state->tupdesc[i], (AttrNumber) 1, NULL, - INT2OID, -1, 0); - TupleDescInitEntry( state->tupdesc[i], (AttrNumber) 2, NULL, - index->rd_att->attrs[i]->atttypid, - index->rd_att->attrs[i]->atttypmod, - index->rd_att->attrs[i]->attndims - ); + TupleDescInitEntry(state->tupdesc[i], (AttrNumber) 1, NULL, + INT2OID, -1, 0); + TupleDescInitEntry(state->tupdesc[i], (AttrNumber) 2, NULL, + index->rd_att->attrs[i]->atttypid, + index->rd_att->attrs[i]->atttypmod, + index->rd_att->attrs[i]->attndims + ); fmgr_info_copy(&(state->compareFn[i]), - index_getprocinfo(index, i+1, GIN_COMPARE_PROC), - CurrentMemoryContext); + index_getprocinfo(index, i + 1, GIN_COMPARE_PROC), + CurrentMemoryContext); fmgr_info_copy(&(state->extractValueFn[i]), - index_getprocinfo(index, i+1, GIN_EXTRACTVALUE_PROC), - CurrentMemoryContext); + index_getprocinfo(index, i + 1, GIN_EXTRACTVALUE_PROC), + CurrentMemoryContext); fmgr_info_copy(&(state->extractQueryFn[i]), - index_getprocinfo(index, i+1, GIN_EXTRACTQUERY_PROC), - CurrentMemoryContext); + index_getprocinfo(index, i + 1, GIN_EXTRACTQUERY_PROC), + CurrentMemoryContext); fmgr_info_copy(&(state->consistentFn[i]), - index_getprocinfo(index, i+1, GIN_CONSISTENT_PROC), - CurrentMemoryContext); + index_getprocinfo(index, i + 1, GIN_CONSISTENT_PROC), + CurrentMemoryContext); /* * Check opclass capability to do partial match. */ - if ( index_getprocid(index, i+1, GIN_COMPARE_PARTIAL_PROC) != InvalidOid ) + if (index_getprocid(index, i + 1, GIN_COMPARE_PARTIAL_PROC) != InvalidOid) { fmgr_info_copy(&(state->comparePartialFn[i]), - index_getprocinfo(index, i+1, GIN_COMPARE_PARTIAL_PROC), + index_getprocinfo(index, i + 1, GIN_COMPARE_PARTIAL_PROC), CurrentMemoryContext); state->canPartialMatch[i] = true; @@ -82,21 +82,21 @@ gintuple_get_attrnum(GinState *ginstate, IndexTuple tuple) { OffsetNumber colN = FirstOffsetNumber; - if ( !ginstate->oneCol ) + if (!ginstate->oneCol) { - Datum res; - bool isnull; + Datum res; + bool isnull; /* - * First attribute is always int16, so we can safely use any - * tuple descriptor to obtain first attribute of tuple + * First attribute is always int16, so we can safely use any tuple + * descriptor to obtain first attribute of tuple */ res = index_getattr(tuple, FirstOffsetNumber, ginstate->tupdesc[0], &isnull); Assert(!isnull); colN = DatumGetUInt16(res); - Assert( colN >= FirstOffsetNumber && colN <= ginstate->origTupdesc->natts ); + Assert(colN >= FirstOffsetNumber && colN <= ginstate->origTupdesc->natts); } return colN; @@ -108,10 +108,10 @@ gintuple_get_attrnum(GinState *ginstate, IndexTuple tuple) Datum gin_index_getattr(GinState *ginstate, IndexTuple tuple) { - bool isnull; - Datum res; + bool isnull; + Datum res; - if ( ginstate->oneCol ) + if (ginstate->oneCol) { /* * Single column index doesn't store attribute numbers in tuples @@ -122,8 +122,8 @@ gin_index_getattr(GinState *ginstate, IndexTuple tuple) else { /* - * Since the datum type depends on which index column it's from, - * we must be careful to use the right tuple descriptor here. + * Since the datum type depends on which index column it's from, we + * must be careful to use the right tuple descriptor here. */ OffsetNumber colN = gintuple_get_attrnum(ginstate, tuple); @@ -216,8 +216,8 @@ GinInitBuffer(Buffer b, uint32 f) void GinInitMetabuffer(Buffer b) { - GinMetaPageData *metadata; - Page page = BufferGetPage(b); + GinMetaPageData *metadata; + Page page = BufferGetPage(b); GinInitPage(page, GIN_META, BufferGetPageSize(b)); @@ -234,7 +234,7 @@ compareEntries(GinState *ginstate, OffsetNumber attnum, Datum a, Datum b) { return DatumGetInt32( FunctionCall2( - &ginstate->compareFn[attnum-1], + &ginstate->compareFn[attnum - 1], a, b ) ); @@ -242,12 +242,12 @@ compareEntries(GinState *ginstate, OffsetNumber attnum, Datum a, Datum b) int compareAttEntries(GinState *ginstate, OffsetNumber attnum_a, Datum a, - OffsetNumber attnum_b, Datum b) + OffsetNumber attnum_b, Datum b) { - if ( attnum_a == attnum_b ) - return compareEntries( ginstate, attnum_a, a, b); + if (attnum_a == attnum_b) + return compareEntries(ginstate, attnum_a, a, b); - return ( attnum_a < attnum_b ) ? -1 : 1; + return (attnum_a < attnum_b) ? -1 : 1; } typedef struct @@ -275,7 +275,7 @@ extractEntriesS(GinState *ginstate, OffsetNumber attnum, Datum value, int32 *nen Datum *entries; entries = (Datum *) DatumGetPointer(FunctionCall2( - &ginstate->extractValueFn[attnum-1], + &ginstate->extractValueFn[attnum - 1], value, PointerGetDatum(nentries) )); @@ -288,7 +288,7 @@ extractEntriesS(GinState *ginstate, OffsetNumber attnum, Datum value, int32 *nen { cmpEntriesData arg; - arg.cmpDatumFunc = &ginstate->compareFn[attnum-1]; + arg.cmpDatumFunc = &ginstate->compareFn[attnum - 1]; arg.needUnique = needUnique; qsort_arg(entries, *nentries, sizeof(Datum), (qsort_arg_comparator) cmpEntries, (void *) &arg); @@ -348,7 +348,7 @@ ginoptions(PG_FUNCTION_ARGS) rdopts = allocateReloptStruct(sizeof(GinOptions), options, numoptions); fillRelOptions((void *) rdopts, sizeof(GinOptions), options, numoptions, - validate, tab, lengthof(tab)); + validate, tab, lengthof(tab)); pfree(options); diff --git a/src/backend/access/gin/ginvacuum.c b/src/backend/access/gin/ginvacuum.c index 934bf7c362..7f2ff9896f 100644 --- a/src/backend/access/gin/ginvacuum.c +++ b/src/backend/access/gin/ginvacuum.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gin/ginvacuum.c,v 1.29 2009/06/06 22:13:50 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/ginvacuum.c,v 1.30 2009/06/11 14:48:53 momjian Exp $ *------------------------------------------------------------------------- */ @@ -533,8 +533,8 @@ ginVacuumEntryPage(GinVacuumState *gvs, Buffer buffer, BlockNumber *roots, uint3 if (GinGetNPosting(itup) != newN) { - Datum value; - OffsetNumber attnum; + Datum value; + OffsetNumber attnum; /* * Some ItemPointers was deleted, so we should remake our @@ -724,9 +724,9 @@ ginvacuumcleanup(PG_FUNCTION_ARGS) PG_RETURN_POINTER(stats); } - /* - * Set up all-zero stats and cleanup pending inserts - * if ginbulkdelete wasn't called + /* + * Set up all-zero stats and cleanup pending inserts if ginbulkdelete + * wasn't called */ if (stats == NULL) { @@ -758,7 +758,7 @@ ginvacuumcleanup(PG_FUNCTION_ARGS) if (needLock) UnlockRelationForExtension(index, ExclusiveLock); - totFreePages = 0; + totFreePages = 0; for (blkno = GIN_ROOT_BLKNO + 1; blkno < npages; blkno++) { diff --git a/src/backend/access/gin/ginxlog.c b/src/backend/access/gin/ginxlog.c index 03cdc1129c..1f008b727f 100644 --- a/src/backend/access/gin/ginxlog.c +++ b/src/backend/access/gin/ginxlog.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gin/ginxlog.c,v 1.18 2009/03/24 20:17:11 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/ginxlog.c,v 1.19 2009/06/11 14:48:53 momjian Exp $ *------------------------------------------------------------------------- */ #include "postgres.h" @@ -71,7 +71,8 @@ static void ginRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record) { RelFileNode *node = (RelFileNode *) XLogRecGetData(record); - Buffer RootBuffer, MetaBuffer; + Buffer RootBuffer, + MetaBuffer; Page page; MetaBuffer = XLogReadBuffer(*node, GIN_METAPAGE_BLKNO, true); @@ -446,7 +447,7 @@ ginRedoDeletePage(XLogRecPtr lsn, XLogRecord *record) static void ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record) { - ginxlogUpdateMeta *data = (ginxlogUpdateMeta*) XLogRecGetData(record); + ginxlogUpdateMeta *data = (ginxlogUpdateMeta *) XLogRecGetData(record); Buffer metabuffer; Page metapage; @@ -455,39 +456,41 @@ ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record) if (!XLByteLE(lsn, PageGetLSN(metapage))) { - memcpy( GinPageGetMeta(metapage), &data->metadata, sizeof(GinMetaPageData)); + memcpy(GinPageGetMeta(metapage), &data->metadata, sizeof(GinMetaPageData)); PageSetLSN(metapage, lsn); PageSetTLI(metapage, ThisTimeLineID); MarkBufferDirty(metabuffer); } - if ( data->ntuples > 0 ) + if (data->ntuples > 0) { /* * insert into tail page */ if (!(record->xl_info & XLR_BKP_BLOCK_1)) { - Buffer buffer = XLogReadBuffer(data->node, data->metadata.tail, false); - Page page = BufferGetPage(buffer); + Buffer buffer = XLogReadBuffer(data->node, data->metadata.tail, false); + Page page = BufferGetPage(buffer); - if ( !XLByteLE(lsn, PageGetLSN(page))) + if (!XLByteLE(lsn, PageGetLSN(page))) { - OffsetNumber l, off = (PageIsEmpty(page)) ? FirstOffsetNumber : - OffsetNumberNext(PageGetMaxOffsetNumber(page)); - int i, tupsize; - IndexTuple tuples = (IndexTuple) (XLogRecGetData(record) + sizeof(ginxlogUpdateMeta)); - - for(i=0; i<data->ntuples; i++) + OffsetNumber l, + off = (PageIsEmpty(page)) ? FirstOffsetNumber : + OffsetNumberNext(PageGetMaxOffsetNumber(page)); + int i, + tupsize; + IndexTuple tuples = (IndexTuple) (XLogRecGetData(record) + sizeof(ginxlogUpdateMeta)); + + for (i = 0; i < data->ntuples; i++) { tupsize = IndexTupleSize(tuples); - l = PageAddItem(page, (Item)tuples, tupsize, off, false, false); + l = PageAddItem(page, (Item) tuples, tupsize, off, false, false); if (l == InvalidOffsetNumber) elog(ERROR, "failed to add item to index page"); - tuples = (IndexTuple)( ((char*)tuples) + tupsize ); + tuples = (IndexTuple) (((char *) tuples) + tupsize); } /* @@ -502,16 +505,16 @@ ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record) UnlockReleaseBuffer(buffer); } } - else if ( data->prevTail != InvalidBlockNumber ) + else if (data->prevTail != InvalidBlockNumber) { /* * New tail */ - Buffer buffer = XLogReadBuffer(data->node, data->prevTail, false); - Page page = BufferGetPage(buffer); + Buffer buffer = XLogReadBuffer(data->node, data->prevTail, false); + Page page = BufferGetPage(buffer); - if ( !XLByteLE(lsn, PageGetLSN(page))) + if (!XLByteLE(lsn, PageGetLSN(page))) { GinPageGetOpaque(page)->rightlink = data->newRightlink; @@ -528,12 +531,14 @@ ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record) static void ginRedoInsertListPage(XLogRecPtr lsn, XLogRecord *record) { - ginxlogInsertListPage *data = (ginxlogInsertListPage*) XLogRecGetData(record); - Buffer buffer; - Page page; - OffsetNumber l, off = FirstOffsetNumber; - int i, tupsize; - IndexTuple tuples = (IndexTuple) (XLogRecGetData(record) + sizeof(ginxlogInsertListPage)); + ginxlogInsertListPage *data = (ginxlogInsertListPage *) XLogRecGetData(record); + Buffer buffer; + Page page; + OffsetNumber l, + off = FirstOffsetNumber; + int i, + tupsize; + IndexTuple tuples = (IndexTuple) (XLogRecGetData(record) + sizeof(ginxlogInsertListPage)); if (record->xl_info & XLR_BKP_BLOCK_1) return; @@ -543,7 +548,7 @@ ginRedoInsertListPage(XLogRecPtr lsn, XLogRecord *record) GinInitBuffer(buffer, GIN_LIST); GinPageGetOpaque(page)->rightlink = data->rightlink; - if ( data->rightlink == InvalidBlockNumber ) + if (data->rightlink == InvalidBlockNumber) { /* tail of sublist */ GinPageSetFullRow(page); @@ -554,16 +559,16 @@ ginRedoInsertListPage(XLogRecPtr lsn, XLogRecord *record) GinPageGetOpaque(page)->maxoff = 0; } - for(i=0; i<data->ntuples; i++) + for (i = 0; i < data->ntuples; i++) { tupsize = IndexTupleSize(tuples); - l = PageAddItem(page, (Item)tuples, tupsize, off, false, false); + l = PageAddItem(page, (Item) tuples, tupsize, off, false, false); if (l == InvalidOffsetNumber) elog(ERROR, "failed to add item to index page"); - tuples = (IndexTuple)( ((char*)tuples) + tupsize ); + tuples = (IndexTuple) (((char *) tuples) + tupsize); } PageSetLSN(page, lsn); @@ -576,28 +581,28 @@ ginRedoInsertListPage(XLogRecPtr lsn, XLogRecord *record) static void ginRedoDeleteListPages(XLogRecPtr lsn, XLogRecord *record) { - ginxlogDeleteListPages *data = (ginxlogDeleteListPages*) XLogRecGetData(record); + ginxlogDeleteListPages *data = (ginxlogDeleteListPages *) XLogRecGetData(record); Buffer metabuffer; Page metapage; - int i; + int i; metabuffer = XLogReadBuffer(data->node, GIN_METAPAGE_BLKNO, false); metapage = BufferGetPage(metabuffer); if (!XLByteLE(lsn, PageGetLSN(metapage))) { - memcpy( GinPageGetMeta(metapage), &data->metadata, sizeof(GinMetaPageData)); + memcpy(GinPageGetMeta(metapage), &data->metadata, sizeof(GinMetaPageData)); PageSetLSN(metapage, lsn); PageSetTLI(metapage, ThisTimeLineID); MarkBufferDirty(metabuffer); } - for(i=0; i<data->ndeleted; i++) + for (i = 0; i < data->ndeleted; i++) { - Buffer buffer = XLogReadBuffer(data->node,data->toDelete[i],false); - Page page = BufferGetPage(buffer); + Buffer buffer = XLogReadBuffer(data->node, data->toDelete[i], false); + Page page = BufferGetPage(buffer); - if ( !XLByteLE(lsn, PageGetLSN(page))) + if (!XLByteLE(lsn, PageGetLSN(page))) { GinPageGetOpaque(page)->flags = GIN_DELETED; @@ -645,7 +650,7 @@ gin_redo(XLogRecPtr lsn, XLogRecord *record) case XLOG_GIN_INSERT_LISTPAGE: ginRedoInsertListPage(lsn, record); break; - case XLOG_GIN_DELETE_LISTPAGE: + case XLOG_GIN_DELETE_LISTPAGE: ginRedoDeleteListPages(lsn, record); break; default: @@ -705,15 +710,15 @@ gin_desc(StringInfo buf, uint8 xl_info, char *rec) break; case XLOG_GIN_UPDATE_META_PAGE: appendStringInfo(buf, "Update metapage, "); - desc_node(buf, ((ginxlogUpdateMeta *) rec)->node, ((ginxlogUpdateMeta *) rec)->metadata.tail); + desc_node(buf, ((ginxlogUpdateMeta *) rec)->node, ((ginxlogUpdateMeta *) rec)->metadata.tail); break; case XLOG_GIN_INSERT_LISTPAGE: appendStringInfo(buf, "Insert new list page, "); - desc_node(buf, ((ginxlogInsertListPage *) rec)->node, ((ginxlogInsertListPage *) rec)->blkno); + desc_node(buf, ((ginxlogInsertListPage *) rec)->node, ((ginxlogInsertListPage *) rec)->blkno); break; case XLOG_GIN_DELETE_LISTPAGE: appendStringInfo(buf, "Delete list pages (%d), ", ((ginxlogDeleteListPages *) rec)->ndeleted); - desc_node(buf, ((ginxlogDeleteListPages *) rec)->node, ((ginxlogDeleteListPages *) rec)->metadata.head); + desc_node(buf, ((ginxlogDeleteListPages *) rec)->node, ((ginxlogDeleteListPages *) rec)->metadata.head); break; default: elog(PANIC, "gin_desc: unknown op code %u", info); diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c index 9701d30e38..e7ca8f6476 100644 --- a/src/backend/access/gist/gistget.c +++ b/src/backend/access/gist/gistget.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.80 2009/01/01 17:23:35 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.81 2009/06/11 14:48:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -79,7 +79,7 @@ gistgettuple(PG_FUNCTION_ARGS) so = (GISTScanOpaque) scan->opaque; - if (dir != ForwardScanDirection) + if (dir != ForwardScanDirection) elog(ERROR, "GiST doesn't support other scan directions than forward"); /* @@ -101,8 +101,8 @@ Datum gistgetbitmap(PG_FUNCTION_ARGS) { IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0); - TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1); - int64 ntids; + TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1); + int64 ntids; ntids = gistnext(scan, tbm); @@ -136,10 +136,10 @@ gistnext(IndexScanDesc scan, TIDBitmap *tbm) so = (GISTScanOpaque) scan->opaque; - if ( so->qual_ok == false ) + if (so->qual_ok == false) return 0; - if ( so->curbuf == InvalidBuffer ) + if (so->curbuf == InvalidBuffer) { if (ItemPointerIsValid(&so->curpos) == false) { @@ -155,7 +155,7 @@ gistnext(IndexScanDesc scan, TIDBitmap *tbm) stk->block = GIST_ROOT_BLKNO; pgstat_count_index_scan(scan->indexRelation); - } + } else { /* scan is finished */ @@ -164,25 +164,25 @@ gistnext(IndexScanDesc scan, TIDBitmap *tbm) } /* - * check stored pointers from last visit + * check stored pointers from last visit */ - if ( so->nPageData > 0 ) + if (so->nPageData > 0) { /* * gistgetmulti never should go here */ - Assert( tbm == NULL ); + Assert(tbm == NULL); - if ( so->curPageData < so->nPageData ) + if (so->curPageData < so->nPageData) { - scan->xs_ctup.t_self = so->pageData[ so->curPageData ].heapPtr; - scan->xs_recheck = so->pageData[ so->curPageData ].recheck; + scan->xs_ctup.t_self = so->pageData[so->curPageData].heapPtr; + scan->xs_recheck = so->pageData[so->curPageData].recheck; ItemPointerSet(&so->curpos, - BufferGetBlockNumber(so->curbuf), - so->pageData[ so->curPageData ].pageOffset); + BufferGetBlockNumber(so->curbuf), + so->pageData[so->curPageData].pageOffset); - so->curPageData ++; + so->curPageData++; return 1; } @@ -227,7 +227,7 @@ gistnext(IndexScanDesc scan, TIDBitmap *tbm) if (!XLogRecPtrIsInvalid(so->stack->parentlsn) && XLByteLT(so->stack->parentlsn, opaque->nsn) && opaque->rightlink != InvalidBlockNumber /* sanity check */ && - (so->stack->next == NULL || so->stack->next->block != opaque->rightlink) /* check if already + (so->stack->next == NULL || so->stack->next->block != opaque->rightlink) /* check if already added */ ) { /* detect page split, follow right link to add pages */ @@ -272,12 +272,12 @@ gistnext(IndexScanDesc scan, TIDBitmap *tbm) if (!OffsetNumberIsValid(n)) { /* - * If we was called from gistgettuple and current buffer contains - * something matched then make a recursive call - it will return - * ItemPointer from so->pageData. But we save buffer pinned to - * support tuple's killing + * If we was called from gistgettuple and current buffer + * contains something matched then make a recursive call - it + * will return ItemPointer from so->pageData. But we save + * buffer pinned to support tuple's killing */ - if ( !tbm && so->nPageData > 0 ) + if (!tbm && so->nPageData > 0) { LockBuffer(so->curbuf, GIST_UNLOCK); return gistnext(scan, NULL); @@ -324,12 +324,12 @@ gistnext(IndexScanDesc scan, TIDBitmap *tbm) ntids++; if (tbm != NULL) tbm_add_tuples(tbm, &it->t_tid, 1, scan->xs_recheck); - else + else { - so->pageData[ so->nPageData ].heapPtr = it->t_tid; - so->pageData[ so->nPageData ].pageOffset = n; - so->pageData[ so->nPageData ].recheck = scan->xs_recheck; - so->nPageData ++; + so->pageData[so->nPageData].heapPtr = it->t_tid; + so->pageData[so->nPageData].pageOffset = n; + so->pageData[so->nPageData].recheck = scan->xs_recheck; + so->nPageData++; } } } @@ -437,8 +437,8 @@ gistindex_keytest(IndexTuple tuple, /* * Call the Consistent function to evaluate the test. The * arguments are the index datum (as a GISTENTRY*), the comparison - * datum, the comparison operator's strategy number and - * subtype from pg_amop, and the recheck flag. + * datum, the comparison operator's strategy number and subtype + * from pg_amop, and the recheck flag. * * (Presently there's no need to pass the subtype since it'll * always be zero, but might as well pass it for possible future diff --git a/src/backend/access/gist/gistproc.c b/src/backend/access/gist/gistproc.c index 396b93ab97..ef44380e77 100644 --- a/src/backend/access/gist/gistproc.c +++ b/src/backend/access/gist/gistproc.c @@ -10,7 +10,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gist/gistproc.c,v 1.16 2009/04/06 14:27:27 teodor Exp $ + * $PostgreSQL: pgsql/src/backend/access/gist/gistproc.c,v 1.17 2009/06/11 14:48:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -86,6 +86,7 @@ gist_box_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); BOX *query = PG_GETARG_BOX_P(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); @@ -279,11 +280,11 @@ chooseLR(GIST_SPLITVEC *v, static void fallbackSplit(GistEntryVector *entryvec, GIST_SPLITVEC *v) { - OffsetNumber i, - maxoff; - BOX *unionL = NULL, - *unionR = NULL; - int nbytes; + OffsetNumber i, + maxoff; + BOX *unionL = NULL, + *unionR = NULL; + int nbytes; maxoff = entryvec->n - 1; @@ -294,7 +295,7 @@ fallbackSplit(GistEntryVector *entryvec, GIST_SPLITVEC *v) for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i)) { - BOX * cur = DatumGetBoxP(entryvec->vector[i].key); + BOX *cur = DatumGetBoxP(entryvec->vector[i].key); if (i <= (maxoff - FirstOffsetNumber + 1) / 2) { @@ -767,6 +768,7 @@ gist_poly_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); POLYGON *query = PG_GETARG_POLYGON_P(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); bool result; @@ -843,6 +845,7 @@ gist_circle_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); CIRCLE *query = PG_GETARG_CIRCLE_P(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); BOX bbox; diff --git a/src/backend/access/gist/gistscan.c b/src/backend/access/gist/gistscan.c index 68924332b7..aed3e95b4e 100644 --- a/src/backend/access/gist/gistscan.c +++ b/src/backend/access/gist/gistscan.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gist/gistscan.c,v 1.75 2009/01/01 17:23:35 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/gist/gistscan.c,v 1.76 2009/06/11 14:48:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -94,11 +94,13 @@ gistrescan(PG_FUNCTION_ARGS) * Next, if any of keys is a NULL and that key is not marked with * SK_SEARCHNULL then nothing can be found. */ - for (i = 0; i < scan->numberOfKeys; i++) { + for (i = 0; i < scan->numberOfKeys; i++) + { scan->keyData[i].sk_func = so->giststate->consistentFn[scan->keyData[i].sk_attno - 1]; - if ( scan->keyData[i].sk_flags & SK_ISNULL ) { - if ( (scan->keyData[i].sk_flags & SK_SEARCHNULL) == 0 ) + if (scan->keyData[i].sk_flags & SK_ISNULL) + { + if ((scan->keyData[i].sk_flags & SK_SEARCHNULL) == 0) so->qual_ok = false; } } diff --git a/src/backend/access/gist/gistsplit.c b/src/backend/access/gist/gistsplit.c index 0d11e7c9ab..c5e5f6f13a 100644 --- a/src/backend/access/gist/gistsplit.c +++ b/src/backend/access/gist/gistsplit.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gist/gistsplit.c,v 1.9 2009/06/10 20:02:15 petere Exp $ + * $PostgreSQL: pgsql/src/backend/access/gist/gistsplit.c,v 1.10 2009/06/11 14:48:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -281,7 +281,7 @@ supportSecondarySplit(Relation r, GISTSTATE *giststate, int attno, GIST_SPLITVEC } /* - * Trivial picksplit implementaion. Function called only + * Trivial picksplit implementaion. Function called only * if user-defined picksplit puts all keys to the one page. * That is a bug of user-defined picksplit but we'd like * to "fix" that. @@ -289,10 +289,10 @@ supportSecondarySplit(Relation r, GISTSTATE *giststate, int attno, GIST_SPLITVEC static void genericPickSplit(GISTSTATE *giststate, GistEntryVector *entryvec, GIST_SPLITVEC *v, int attno) { - OffsetNumber i, - maxoff; - int nbytes; - GistEntryVector *evec; + OffsetNumber i, + maxoff; + int nbytes; + GistEntryVector *evec; maxoff = entryvec->n - 1; @@ -320,21 +320,21 @@ genericPickSplit(GISTSTATE *giststate, GistEntryVector *entryvec, GIST_SPLITVEC * Form unions of each page */ - evec = palloc( sizeof(GISTENTRY) * entryvec->n + GEVHDRSZ ); + evec = palloc(sizeof(GISTENTRY) * entryvec->n + GEVHDRSZ); evec->n = v->spl_nleft; - memcpy(evec->vector, entryvec->vector + FirstOffsetNumber, - sizeof(GISTENTRY) * evec->n); - v->spl_ldatum = FunctionCall2(&giststate->unionFn[attno], - PointerGetDatum(evec), - PointerGetDatum(&nbytes)); + memcpy(evec->vector, entryvec->vector + FirstOffsetNumber, + sizeof(GISTENTRY) * evec->n); + v->spl_ldatum = FunctionCall2(&giststate->unionFn[attno], + PointerGetDatum(evec), + PointerGetDatum(&nbytes)); evec->n = v->spl_nright; - memcpy(evec->vector, entryvec->vector + FirstOffsetNumber + v->spl_nleft, - sizeof(GISTENTRY) * evec->n); - v->spl_rdatum = FunctionCall2(&giststate->unionFn[attno], - PointerGetDatum(evec), - PointerGetDatum(&nbytes)); + memcpy(evec->vector, entryvec->vector + FirstOffsetNumber + v->spl_nleft, + sizeof(GISTENTRY) * evec->n); + v->spl_rdatum = FunctionCall2(&giststate->unionFn[attno], + PointerGetDatum(evec), + PointerGetDatum(&nbytes)); } /* @@ -365,17 +365,17 @@ gistUserPicksplit(Relation r, GistEntryVector *entryvec, int attno, GistSplitVec PointerGetDatum(entryvec), PointerGetDatum(sv)); - if ( sv->spl_nleft == 0 || sv->spl_nright == 0 ) + if (sv->spl_nleft == 0 || sv->spl_nright == 0) { ereport(DEBUG1, (errcode(ERRCODE_INTERNAL_ERROR), - errmsg("picksplit method for %d column of index \"%s\" failed", - attno+1, RelationGetRelationName(r)), + errmsg("picksplit method for %d column of index \"%s\" failed", + attno + 1, RelationGetRelationName(r)), errhint("The index is not optimal. To optimize it, contact a developer, or try to use the column as the second one in the CREATE INDEX command."))); /* - * Reinit GIST_SPLITVEC. Although that fields are not used - * by genericPickSplit(), let us set up it for further processing + * Reinit GIST_SPLITVEC. Although that fields are not used by + * genericPickSplit(), let us set up it for further processing */ sv->spl_ldatum_exists = (v->spl_lisnull[attno]) ? false : true; sv->spl_rdatum_exists = (v->spl_risnull[attno]) ? false : true; diff --git a/src/backend/access/gist/gistutil.c b/src/backend/access/gist/gistutil.c index fa1e3088ad..78eb378725 100644 --- a/src/backend/access/gist/gistutil.c +++ b/src/backend/access/gist/gistutil.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gist/gistutil.c,v 1.33 2009/01/05 17:14:28 alvherre Exp $ + * $PostgreSQL: pgsql/src/backend/access/gist/gistutil.c,v 1.34 2009/06/11 14:48:53 momjian Exp $ *------------------------------------------------------------------------- */ #include "postgres.h" @@ -43,7 +43,8 @@ gistfillbuffer(Page page, IndexTuple *itup, int len, OffsetNumber off) for (i = 0; i < len; i++) { - Size sz = IndexTupleSize(itup[i]); + Size sz = IndexTupleSize(itup[i]); + l = PageAddItem(page, (Item) itup[i], sz, off, false, false); if (l == InvalidOffsetNumber) elog(ERROR, "failed to add item to GiST index page, item %d out of %d, size %d bytes", diff --git a/src/backend/access/gist/gistvacuum.c b/src/backend/access/gist/gistvacuum.c index 833e6c574e..975f9d8c56 100644 --- a/src/backend/access/gist/gistvacuum.c +++ b/src/backend/access/gist/gistvacuum.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gist/gistvacuum.c,v 1.44 2009/06/06 22:13:50 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/gist/gistvacuum.c,v 1.45 2009/06/11 14:48:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -510,7 +510,7 @@ gistvacuumcleanup(PG_FUNCTION_ARGS) Relation rel = info->index; BlockNumber npages, blkno; - BlockNumber totFreePages; + BlockNumber totFreePages; BlockNumber lastBlock = GIST_ROOT_BLKNO, lastFilledBlock = GIST_ROOT_BLKNO; bool needLock; diff --git a/src/backend/access/hash/hash.c b/src/backend/access/hash/hash.c index 4c1cd5ceda..49b6594f1e 100644 --- a/src/backend/access/hash/hash.c +++ b/src/backend/access/hash/hash.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/hash/hash.c,v 1.111 2009/06/06 22:13:50 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/hash/hash.c,v 1.112 2009/06/11 14:48:53 momjian Exp $ * * NOTES * This file contains only the public interface routines. @@ -52,7 +52,7 @@ hashbuild(PG_FUNCTION_ARGS) Relation index = (Relation) PG_GETARG_POINTER(1); IndexInfo *indexInfo = (IndexInfo *) PG_GETARG_POINTER(2); IndexBuildResult *result; - BlockNumber relpages; + BlockNumber relpages; double reltuples; uint32 num_buckets; HashBuildState buildstate; @@ -76,12 +76,12 @@ hashbuild(PG_FUNCTION_ARGS) * (assuming their hash codes are pretty random) there will be no locality * of access to the index, and if the index is bigger than available RAM * then we'll thrash horribly. To prevent that scenario, we can sort the - * tuples by (expected) bucket number. However, such a sort is useless + * tuples by (expected) bucket number. However, such a sort is useless * overhead when the index does fit in RAM. We choose to sort if the * initial index size exceeds NBuffers. * - * NOTE: this test will need adjustment if a bucket is ever different - * from one page. + * NOTE: this test will need adjustment if a bucket is ever different from + * one page. */ if (num_buckets >= (uint32) NBuffers) buildstate.spool = _h_spoolinit(index, num_buckets); @@ -285,7 +285,7 @@ Datum hashgetbitmap(PG_FUNCTION_ARGS) { IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0); - TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1); + TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1); HashScanOpaque so = (HashScanOpaque) scan->opaque; bool res; int64 ntids = 0; @@ -294,7 +294,7 @@ hashgetbitmap(PG_FUNCTION_ARGS) while (res) { - bool add_tuple; + bool add_tuple; /* * Skip killed tuples if asked to. @@ -312,7 +312,7 @@ hashgetbitmap(PG_FUNCTION_ARGS) add_tuple = true; /* Save tuple ID, and continue scanning */ - if (add_tuple) + if (add_tuple) { /* Note we mark the tuple ID as requiring recheck */ tbm_add_tuples(tbm, &scan->xs_ctup.t_self, 1, true); @@ -481,7 +481,7 @@ hashbulkdelete(PG_FUNCTION_ARGS) * each bucket. */ metabuf = _hash_getbuf(rel, HASH_METAPAGE, HASH_READ, LH_META_PAGE); - metap = HashPageGetMeta(BufferGetPage(metabuf)); + metap = HashPageGetMeta(BufferGetPage(metabuf)); orig_maxbucket = metap->hashm_maxbucket; orig_ntuples = metap->hashm_ntuples; memcpy(&local_metapage, metap, sizeof(local_metapage)); diff --git a/src/backend/access/hash/hashfunc.c b/src/backend/access/hash/hashfunc.c index 4561a09481..3242e2713e 100644 --- a/src/backend/access/hash/hashfunc.c +++ b/src/backend/access/hash/hashfunc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/hash/hashfunc.c,v 1.58 2009/02/09 21:18:28 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/hash/hashfunc.c,v 1.59 2009/06/11 14:48:53 momjian Exp $ * * NOTES * These functions are stored in pg_amproc. For each operator class @@ -225,35 +225,35 @@ hashvarlena(PG_FUNCTION_ARGS) * are sometimes the same for one pair and different for another pair. * This was tested for: * * pairs that differed by one bit, by two bits, in any combination - * of top bits of (a,b,c), or in any combination of bottom bits of - * (a,b,c). + * of top bits of (a,b,c), or in any combination of bottom bits of + * (a,b,c). * * "differ" is defined as +, -, ^, or ~^. For + and -, I transformed - * the output delta to a Gray code (a^(a>>1)) so a string of 1's (as - * is commonly produced by subtraction) look like a single 1-bit - * difference. + * the output delta to a Gray code (a^(a>>1)) so a string of 1's (as + * is commonly produced by subtraction) look like a single 1-bit + * difference. * * the base values were pseudorandom, all zero but one bit set, or - * all zero plus a counter that starts at zero. - * + * all zero plus a counter that starts at zero. + * * This does not achieve avalanche. There are input bits of (a,b,c) * that fail to affect some output bits of (a,b,c), especially of a. The * most thoroughly mixed value is c, but it doesn't really even achieve - * avalanche in c. - * + * avalanche in c. + * * This allows some parallelism. Read-after-writes are good at doubling * the number of bits affected, so the goal of mixing pulls in the opposite - * direction from the goal of parallelism. I did what I could. Rotates + * direction from the goal of parallelism. I did what I could. Rotates * seem to cost as much as shifts on every machine I could lay my hands on, * and rotates are much kinder to the top and bottom bits, so I used rotates. *---------- */ #define mix(a,b,c) \ { \ - a -= c; a ^= rot(c, 4); c += b; \ - b -= a; b ^= rot(a, 6); a += c; \ - c -= b; c ^= rot(b, 8); b += a; \ - a -= c; a ^= rot(c,16); c += b; \ - b -= a; b ^= rot(a,19); a += c; \ - c -= b; c ^= rot(b, 4); b += a; \ + a -= c; a ^= rot(c, 4); c += b; \ + b -= a; b ^= rot(a, 6); a += c; \ + c -= b; c ^= rot(b, 8); b += a; \ + a -= c; a ^= rot(c,16); c += b; \ + b -= a; b ^= rot(a,19); a += c; \ + c -= b; c ^= rot(b, 4); b += a; \ } /*---------- @@ -262,20 +262,20 @@ hashvarlena(PG_FUNCTION_ARGS) * Pairs of (a,b,c) values differing in only a few bits will usually * produce values of c that look totally different. This was tested for * * pairs that differed by one bit, by two bits, in any combination - * of top bits of (a,b,c), or in any combination of bottom bits of - * (a,b,c). + * of top bits of (a,b,c), or in any combination of bottom bits of + * (a,b,c). * * "differ" is defined as +, -, ^, or ~^. For + and -, I transformed - * the output delta to a Gray code (a^(a>>1)) so a string of 1's (as - * is commonly produced by subtraction) look like a single 1-bit - * difference. + * the output delta to a Gray code (a^(a>>1)) so a string of 1's (as + * is commonly produced by subtraction) look like a single 1-bit + * difference. * * the base values were pseudorandom, all zero but one bit set, or - * all zero plus a counter that starts at zero. - * + * all zero plus a counter that starts at zero. + * * The use of separate functions for mix() and final() allow for a * substantial performance increase since final() does not need to * do well in reverse, but is does need to affect all output bits. * mix(), on the other hand, does not need to affect all output - * bits (affecting 32 bits is enough). The original hash function had + * bits (affecting 32 bits is enough). The original hash function had * a single mixing operation that had to satisfy both sets of requirements * and was slower as a result. *---------- @@ -374,9 +374,9 @@ hash_any(register const unsigned char *k, register int keylen) /* fall through */ case 1: a += ((uint32) k[0] << 24); - /* case 0: nothing left to add */ + /* case 0: nothing left to add */ } -#else /* !WORDS_BIGENDIAN */ +#else /* !WORDS_BIGENDIAN */ switch (len) { case 11: @@ -413,9 +413,9 @@ hash_any(register const unsigned char *k, register int keylen) /* fall through */ case 1: a += k[0]; - /* case 0: nothing left to add */ + /* case 0: nothing left to add */ } -#endif /* WORDS_BIGENDIAN */ +#endif /* WORDS_BIGENDIAN */ } else { @@ -428,11 +428,11 @@ hash_any(register const unsigned char *k, register int keylen) a += (k[3] + ((uint32) k[2] << 8) + ((uint32) k[1] << 16) + ((uint32) k[0] << 24)); b += (k[7] + ((uint32) k[6] << 8) + ((uint32) k[5] << 16) + ((uint32) k[4] << 24)); c += (k[11] + ((uint32) k[10] << 8) + ((uint32) k[9] << 16) + ((uint32) k[8] << 24)); -#else /* !WORDS_BIGENDIAN */ +#else /* !WORDS_BIGENDIAN */ a += (k[0] + ((uint32) k[1] << 8) + ((uint32) k[2] << 16) + ((uint32) k[3] << 24)); b += (k[4] + ((uint32) k[5] << 8) + ((uint32) k[6] << 16) + ((uint32) k[7] << 24)); c += (k[8] + ((uint32) k[9] << 8) + ((uint32) k[10] << 16) + ((uint32) k[11] << 24)); -#endif /* WORDS_BIGENDIAN */ +#endif /* WORDS_BIGENDIAN */ mix(a, b, c); k += 12; len -= 12; @@ -465,9 +465,9 @@ hash_any(register const unsigned char *k, register int keylen) a += ((uint32) k[1] << 16); case 1: a += ((uint32) k[0] << 24); - /* case 0: nothing left to add */ + /* case 0: nothing left to add */ } -#else /* !WORDS_BIGENDIAN */ +#else /* !WORDS_BIGENDIAN */ switch (len) /* all the case statements fall through */ { case 11: @@ -493,9 +493,9 @@ hash_any(register const unsigned char *k, register int keylen) a += ((uint32) k[1] << 8); case 1: a += k[0]; - /* case 0: nothing left to add */ + /* case 0: nothing left to add */ } -#endif /* WORDS_BIGENDIAN */ +#endif /* WORDS_BIGENDIAN */ } final(a, b, c); diff --git a/src/backend/access/hash/hashpage.c b/src/backend/access/hash/hashpage.c index f47d213298..bd1f930e06 100644 --- a/src/backend/access/hash/hashpage.c +++ b/src/backend/access/hash/hashpage.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/hash/hashpage.c,v 1.79 2009/01/01 17:23:35 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/hash/hashpage.c,v 1.80 2009/06/11 14:48:53 momjian Exp $ * * NOTES * Postgres hash pages look like ordinary relation pages. The opaque @@ -361,8 +361,8 @@ _hash_metapinit(Relation rel, double num_tuples) /* * Choose the number of initial bucket pages to match the fill factor * given the estimated number of tuples. We round up the result to the - * next power of 2, however, and always force at least 2 bucket pages. - * The upper limit is determined by considerations explained in + * next power of 2, however, and always force at least 2 bucket pages. The + * upper limit is determined by considerations explained in * _hash_expandtable(). */ dnumbuckets = num_tuples / ffactor; @@ -421,8 +421,8 @@ _hash_metapinit(Relation rel, double num_tuples) /* * We initialize the index with N buckets, 0 .. N-1, occupying physical - * blocks 1 to N. The first freespace bitmap page is in block N+1. - * Since N is a power of 2, we can set the masks this way: + * blocks 1 to N. The first freespace bitmap page is in block N+1. Since + * N is a power of 2, we can set the masks this way: */ metap->hashm_maxbucket = metap->hashm_lowmask = num_buckets - 1; metap->hashm_highmask = (num_buckets << 1) - 1; @@ -438,8 +438,8 @@ _hash_metapinit(Relation rel, double num_tuples) /* * Release buffer lock on the metapage while we initialize buckets. * Otherwise, we'll be in interrupt holdoff and the CHECK_FOR_INTERRUPTS - * won't accomplish anything. It's a bad idea to hold buffer locks - * for long intervals in any case, since that can block the bgwriter. + * won't accomplish anything. It's a bad idea to hold buffer locks for + * long intervals in any case, since that can block the bgwriter. */ _hash_chgbufaccess(rel, metabuf, HASH_WRITE, HASH_NOLOCK); @@ -552,8 +552,8 @@ _hash_expandtable(Relation rel, Buffer metabuf) * _hash_alloc_buckets() would fail, but if we supported buckets smaller * than a disk block then this would be an independent constraint. * - * If you change this, see also the maximum initial number of buckets - * in _hash_metapinit(). + * If you change this, see also the maximum initial number of buckets in + * _hash_metapinit(). */ if (metap->hashm_maxbucket >= (uint32) 0x7FFFFFFE) goto fail; @@ -839,8 +839,8 @@ _hash_splitbucket(Relation rel, } /* - * Fetch the item's hash key (conveniently stored in the item) - * and determine which bucket it now belongs in. + * Fetch the item's hash key (conveniently stored in the item) and + * determine which bucket it now belongs in. */ itup = (IndexTuple) PageGetItem(opage, PageGetItemId(opage, ooffnum)); bucket = _hash_hashkey2bucket(_hash_get_indextuple_hashkey(itup), diff --git a/src/backend/access/hash/hashscan.c b/src/backend/access/hash/hashscan.c index 8cd371e902..1b0ce2c739 100644 --- a/src/backend/access/hash/hashscan.c +++ b/src/backend/access/hash/hashscan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/hash/hashscan.c,v 1.46 2009/01/01 17:23:35 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/hash/hashscan.c,v 1.47 2009/06/11 14:48:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -59,8 +59,8 @@ ReleaseResources_hash(void) /* * Release all HashScanList items belonging to the current ResourceOwner. * Note that we do not release the underlying IndexScanDesc; that's in - * executor memory and will go away on its own (in fact quite possibly - * has gone away already, so we mustn't try to touch it here). + * executor memory and will go away on its own (in fact quite possibly has + * gone away already, so we mustn't try to touch it here). * * Note: this should be a no-op during normal query shutdown. However, in * an abort situation ExecutorEnd is not called and so there may be open diff --git a/src/backend/access/hash/hashsearch.c b/src/backend/access/hash/hashsearch.c index 5a9763fe9a..fec2f5d78a 100644 --- a/src/backend/access/hash/hashsearch.c +++ b/src/backend/access/hash/hashsearch.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/hash/hashsearch.c,v 1.56 2009/05/05 19:36:32 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/hash/hashsearch.c,v 1.57 2009/06/11 14:48:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -312,15 +312,15 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir) for (;;) { /* - * check if we're still in the range of items with - * the target hash key + * check if we're still in the range of items with the + * target hash key */ if (offnum <= maxoff) { Assert(offnum >= FirstOffsetNumber); itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, offnum)); if (so->hashso_sk_hash == _hash_get_indextuple_hashkey(itup)) - break; /* yes, so exit for-loop */ + break; /* yes, so exit for-loop */ } /* @@ -353,15 +353,15 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir) for (;;) { /* - * check if we're still in the range of items with - * the target hash key + * check if we're still in the range of items with the + * target hash key */ if (offnum >= FirstOffsetNumber) { Assert(offnum <= maxoff); itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, offnum)); if (so->hashso_sk_hash == _hash_get_indextuple_hashkey(itup)) - break; /* yes, so exit for-loop */ + break; /* yes, so exit for-loop */ } /* diff --git a/src/backend/access/hash/hashsort.c b/src/backend/access/hash/hashsort.c index 6ba8362a9e..00e7dc5f5d 100644 --- a/src/backend/access/hash/hashsort.c +++ b/src/backend/access/hash/hashsort.c @@ -8,7 +8,7 @@ * thrashing. We use tuplesort.c to sort the given index tuples into order. * * Note: if the number of rows in the table has been underestimated, - * bucket splits may occur during the index build. In that case we'd + * bucket splits may occur during the index build. In that case we'd * be inserting into two or more buckets for each possible masked-off * hash code value. That's no big problem though, since we'll still have * plenty of locality of access. @@ -18,7 +18,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/hash/hashsort.c,v 1.2 2009/01/01 17:23:35 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/hash/hashsort.c,v 1.3 2009/06/11 14:48:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -52,13 +52,13 @@ _h_spoolinit(Relation index, uint32 num_buckets) hspool->index = index; /* - * Determine the bitmask for hash code values. Since there are currently + * Determine the bitmask for hash code values. Since there are currently * num_buckets buckets in the index, the appropriate mask can be computed * as follows. * - * Note: at present, the passed-in num_buckets is always a power of 2, - * so we could just compute num_buckets - 1. We prefer not to assume - * that here, though. + * Note: at present, the passed-in num_buckets is always a power of 2, so + * we could just compute num_buckets - 1. We prefer not to assume that + * here, though. */ hash_mask = (((uint32) 1) << _hash_log2(num_buckets)) - 1; diff --git a/src/backend/access/hash/hashutil.c b/src/backend/access/hash/hashutil.c index 42e79376f8..ba1d6fbbf5 100644 --- a/src/backend/access/hash/hashutil.c +++ b/src/backend/access/hash/hashutil.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/hash/hashutil.c,v 1.59 2009/01/05 17:14:28 alvherre Exp $ + * $PostgreSQL: pgsql/src/backend/access/hash/hashutil.c,v 1.60 2009/06/11 14:48:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -29,10 +29,10 @@ bool _hash_checkqual(IndexScanDesc scan, IndexTuple itup) { /* - * Currently, we can't check any of the scan conditions since we do - * not have the original index entry value to supply to the sk_func. - * Always return true; we expect that hashgettuple already set the - * recheck flag to make the main indexscan code do it. + * Currently, we can't check any of the scan conditions since we do not + * have the original index entry value to supply to the sk_func. Always + * return true; we expect that hashgettuple already set the recheck flag + * to make the main indexscan code do it. */ #ifdef NOT_USED TupleDesc tupdesc = RelationGetDescr(scan->indexRelation); @@ -240,8 +240,8 @@ _hash_get_indextuple_hashkey(IndexTuple itup) char *attp; /* - * We assume the hash key is the first attribute and can't be null, - * so this can be done crudely but very very cheaply ... + * We assume the hash key is the first attribute and can't be null, so + * this can be done crudely but very very cheaply ... */ attp = (char *) itup + IndexInfoFindDataOffset(itup->t_info); return *((uint32 *) attp); @@ -253,10 +253,10 @@ _hash_get_indextuple_hashkey(IndexTuple itup) IndexTuple _hash_form_tuple(Relation index, Datum *values, bool *isnull) { - IndexTuple itup; - uint32 hashkey; - Datum hashkeydatum; - TupleDesc hashdesc; + IndexTuple itup; + uint32 hashkey; + Datum hashkeydatum; + TupleDesc hashdesc; if (isnull[0]) hashkeydatum = (Datum) 0; @@ -280,14 +280,14 @@ _hash_form_tuple(Relation index, Datum *values, bool *isnull) * * Returns the offset of the first index entry having hashkey >= hash_value, * or the page's max offset plus one if hash_value is greater than all - * existing hash keys in the page. This is the appropriate place to start + * existing hash keys in the page. This is the appropriate place to start * a search, or to insert a new item. */ OffsetNumber _hash_binsearch(Page page, uint32 hash_value) { - OffsetNumber upper; - OffsetNumber lower; + OffsetNumber upper; + OffsetNumber lower; /* Loop invariant: lower <= desired place <= upper */ upper = PageGetMaxOffsetNumber(page) + 1; @@ -295,9 +295,9 @@ _hash_binsearch(Page page, uint32 hash_value) while (upper > lower) { - OffsetNumber off; - IndexTuple itup; - uint32 hashkey; + OffsetNumber off; + IndexTuple itup; + uint32 hashkey; off = (upper + lower) / 2; Assert(OffsetNumberIsValid(off)); @@ -324,8 +324,8 @@ _hash_binsearch(Page page, uint32 hash_value) OffsetNumber _hash_binsearch_last(Page page, uint32 hash_value) { - OffsetNumber upper; - OffsetNumber lower; + OffsetNumber upper; + OffsetNumber lower; /* Loop invariant: lower <= desired place <= upper */ upper = PageGetMaxOffsetNumber(page); @@ -333,9 +333,9 @@ _hash_binsearch_last(Page page, uint32 hash_value) while (upper > lower) { - IndexTuple itup; - OffsetNumber off; - uint32 hashkey; + IndexTuple itup; + OffsetNumber off; + uint32 hashkey; off = (upper + lower + 1) / 2; Assert(OffsetNumberIsValid(off)); diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 1f6edf6caf..2e45c041a6 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.276 2009/06/10 18:54:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.277 2009/06/11 14:48:53 momjian Exp $ * * * INTERFACE ROUTINES @@ -69,7 +69,7 @@ /* GUC variable */ -bool synchronize_seqscans = true; +bool synchronize_seqscans = true; static HeapScanDesc heap_beginscan_internal(Relation relation, @@ -116,9 +116,9 @@ initscan(HeapScanDesc scan, ScanKey key, bool is_rescan) * strategy and enable synchronized scanning (see syncscan.c). Although * the thresholds for these features could be different, we make them the * same so that there are only two behaviors to tune rather than four. - * (However, some callers need to be able to disable one or both of - * these behaviors, independently of the size of the table; also there - * is a GUC variable that can disable synchronized scanning.) + * (However, some callers need to be able to disable one or both of these + * behaviors, independently of the size of the table; also there is a GUC + * variable that can disable synchronized scanning.) * * During a rescan, don't make a new strategy object if we don't have to. */ @@ -146,8 +146,8 @@ initscan(HeapScanDesc scan, ScanKey key, bool is_rescan) if (is_rescan) { /* - * If rescan, keep the previous startblock setting so that rewinding - * a cursor doesn't generate surprising results. Reset the syncscan + * If rescan, keep the previous startblock setting so that rewinding a + * cursor doesn't generate surprising results. Reset the syncscan * setting, though. */ scan->rs_syncscan = (allow_sync && synchronize_seqscans); @@ -1793,7 +1793,7 @@ void FreeBulkInsertState(BulkInsertState bistate) { if (bistate->current_buf != InvalidBuffer) - ReleaseBuffer(bistate->current_buf); + ReleaseBuffer(bistate->current_buf); FreeAccessStrategy(bistate->strategy); pfree(bistate); } @@ -1977,7 +1977,7 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid, /* Clear the bit in the visibility map if necessary */ if (all_visible_cleared) - visibilitymap_clear(relation, + visibilitymap_clear(relation, ItemPointerGetBlockNumber(&(heaptup->t_self))); /* @@ -3437,8 +3437,8 @@ l3: LockBuffer(*buffer, BUFFER_LOCK_UNLOCK); /* - * Don't update the visibility map here. Locking a tuple doesn't - * change visibility info. + * Don't update the visibility map here. Locking a tuple doesn't change + * visibility info. */ /* @@ -4115,11 +4115,11 @@ heap_xlog_clean(XLogRecPtr lsn, XLogRecord *record, bool clean_move) nowunused, nunused, clean_move); - freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */ + freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */ /* - * Note: we don't worry about updating the page's prunability hints. - * At worst this will cause an extra prune cycle to occur soon. + * Note: we don't worry about updating the page's prunability hints. At + * worst this will cause an extra prune cycle to occur soon. */ PageSetLSN(page, lsn); @@ -4217,17 +4217,18 @@ heap_xlog_delete(XLogRecPtr lsn, XLogRecord *record) OffsetNumber offnum; ItemId lp = NULL; HeapTupleHeader htup; - BlockNumber blkno; + BlockNumber blkno; blkno = ItemPointerGetBlockNumber(&(xlrec->target.tid)); /* - * The visibility map always needs to be updated, even if the heap page - * is already up-to-date. + * The visibility map always needs to be updated, even if the heap page is + * already up-to-date. */ if (xlrec->all_visible_cleared) { - Relation reln = CreateFakeRelcacheEntry(xlrec->target.node); + Relation reln = CreateFakeRelcacheEntry(xlrec->target.node); + visibilitymap_clear(reln, blkno); FreeFakeRelcacheEntry(reln); } @@ -4294,17 +4295,18 @@ heap_xlog_insert(XLogRecPtr lsn, XLogRecord *record) xl_heap_header xlhdr; uint32 newlen; Size freespace; - BlockNumber blkno; + BlockNumber blkno; blkno = ItemPointerGetBlockNumber(&(xlrec->target.tid)); /* - * The visibility map always needs to be updated, even if the heap page - * is already up-to-date. + * The visibility map always needs to be updated, even if the heap page is + * already up-to-date. */ if (xlrec->all_visible_cleared) { - Relation reln = CreateFakeRelcacheEntry(xlrec->target.node); + Relation reln = CreateFakeRelcacheEntry(xlrec->target.node); + visibilitymap_clear(reln, blkno); FreeFakeRelcacheEntry(reln); } @@ -4361,7 +4363,7 @@ heap_xlog_insert(XLogRecPtr lsn, XLogRecord *record) if (offnum == InvalidOffsetNumber) elog(PANIC, "heap_insert_redo: failed to add tuple"); - freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */ + freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */ PageSetLSN(page, lsn); PageSetTLI(page, ThisTimeLineID); @@ -4374,8 +4376,8 @@ heap_xlog_insert(XLogRecPtr lsn, XLogRecord *record) /* * If the page is running low on free space, update the FSM as well. - * Arbitrarily, our definition of "low" is less than 20%. We can't do - * much better than that without knowing the fill-factor for the table. + * Arbitrarily, our definition of "low" is less than 20%. We can't do much + * better than that without knowing the fill-factor for the table. * * XXX: We don't get here if the page was restored from full page image. * We don't bother to update the FSM in that case, it doesn't need to be @@ -4410,12 +4412,13 @@ heap_xlog_update(XLogRecPtr lsn, XLogRecord *record, bool move, bool hot_update) Size freespace; /* - * The visibility map always needs to be updated, even if the heap page - * is already up-to-date. + * The visibility map always needs to be updated, even if the heap page is + * already up-to-date. */ if (xlrec->all_visible_cleared) { - Relation reln = CreateFakeRelcacheEntry(xlrec->target.node); + Relation reln = CreateFakeRelcacheEntry(xlrec->target.node); + visibilitymap_clear(reln, ItemPointerGetBlockNumber(&xlrec->target.tid)); FreeFakeRelcacheEntry(reln); @@ -4504,12 +4507,13 @@ heap_xlog_update(XLogRecPtr lsn, XLogRecord *record, bool move, bool hot_update) newt:; /* - * The visibility map always needs to be updated, even if the heap page - * is already up-to-date. + * The visibility map always needs to be updated, even if the heap page is + * already up-to-date. */ if (xlrec->new_all_visible_cleared) { - Relation reln = CreateFakeRelcacheEntry(xlrec->target.node); + Relation reln = CreateFakeRelcacheEntry(xlrec->target.node); + visibilitymap_clear(reln, ItemPointerGetBlockNumber(&xlrec->newtid)); FreeFakeRelcacheEntry(reln); } @@ -4595,7 +4599,7 @@ newsame:; if (xlrec->new_all_visible_cleared) PageClearAllVisible(page); - freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */ + freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */ PageSetLSN(page, lsn); PageSetTLI(page, ThisTimeLineID); @@ -4604,8 +4608,8 @@ newsame:; /* * If the page is running low on free space, update the FSM as well. - * Arbitrarily, our definition of "low" is less than 20%. We can't do - * much better than that without knowing the fill-factor for the table. + * Arbitrarily, our definition of "low" is less than 20%. We can't do much + * better than that without knowing the fill-factor for the table. * * However, don't update the FSM on HOT updates, because after crash * recovery, either the old or the new tuple will certainly be dead and @@ -4619,7 +4623,7 @@ newsame:; */ if (!hot_update && freespace < BLCKSZ / 5) XLogRecordPageWithFreeSpace(xlrec->target.node, - ItemPointerGetBlockNumber(&(xlrec->newtid)), freespace); + ItemPointerGetBlockNumber(&(xlrec->newtid)), freespace); } static void diff --git a/src/backend/access/heap/hio.c b/src/backend/access/heap/hio.c index 1d70e6c01a..7ed8612357 100644 --- a/src/backend/access/heap/hio.c +++ b/src/backend/access/heap/hio.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/heap/hio.c,v 1.75 2009/01/01 17:23:35 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/heap/hio.c,v 1.76 2009/06/11 14:48:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -64,7 +64,7 @@ static Buffer ReadBufferBI(Relation relation, BlockNumber targetBlock, BulkInsertState bistate) { - Buffer buffer; + Buffer buffer; /* If not bulk-insert, exactly like ReadBuffer */ if (!bistate) @@ -118,7 +118,7 @@ ReadBufferBI(Relation relation, BlockNumber targetBlock, * happen if space is freed in that page after heap_update finds there's not * enough there). In that case, the page will be pinned and locked only once. * - * We normally use FSM to help us find free space. However, + * We normally use FSM to help us find free space. However, * if HEAP_INSERT_SKIP_FSM is specified, we just append a new empty page to * the end of the relation if the tuple won't fit on the current target page. * This can save some cycles when we know the relation is new and doesn't @@ -133,7 +133,7 @@ ReadBufferBI(Relation relation, BlockNumber targetBlock, * for additional constraints needed for safe usage of this behavior.) * * The caller can also provide a BulkInsertState object to optimize many - * insertions into the same relation. This keeps a pin on the current + * insertions into the same relation. This keeps a pin on the current * insertion target page (to save pin/unpin cycles) and also passes a * BULKWRITE buffer selection strategy object to the buffer manager. * Passing NULL for bistate selects the default behavior. @@ -186,7 +186,7 @@ RelationGetBufferForTuple(Relation relation, Size len, /* * We first try to put the tuple on the same page we last inserted a tuple - * on, as cached in the BulkInsertState or relcache entry. If that + * on, as cached in the BulkInsertState or relcache entry. If that * doesn't work, we ask the Free Space Map to locate a suitable page. * Since the FSM's info might be out of date, we have to be prepared to * loop around and retry multiple times. (To insure this isn't an infinite diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c index 4b445c7ad8..71ea689d0e 100644 --- a/src/backend/access/heap/pruneheap.c +++ b/src/backend/access/heap/pruneheap.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/heap/pruneheap.c,v 1.17 2009/01/01 17:23:35 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/heap/pruneheap.c,v 1.18 2009/06/11 14:48:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -30,7 +30,7 @@ typedef struct { TransactionId new_prune_xid; /* new prune hint value for page */ - int nredirected; /* numbers of entries in arrays below */ + int nredirected; /* numbers of entries in arrays below */ int ndead; int nunused; /* arrays that accumulate indexes of items to be changed */ @@ -159,21 +159,21 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin, /* * Our strategy is to scan the page and make lists of items to change, - * then apply the changes within a critical section. This keeps as - * much logic as possible out of the critical section, and also ensures - * that WAL replay will work the same as the normal case. + * then apply the changes within a critical section. This keeps as much + * logic as possible out of the critical section, and also ensures that + * WAL replay will work the same as the normal case. * - * First, inform inval.c that upcoming CacheInvalidateHeapTuple calls - * are nontransactional. + * First, inform inval.c that upcoming CacheInvalidateHeapTuple calls are + * nontransactional. */ if (redirect_move) BeginNonTransactionalInvalidation(); /* - * Initialize the new pd_prune_xid value to zero (indicating no - * prunable tuples). If we find any tuples which may soon become - * prunable, we will save the lowest relevant XID in new_prune_xid. - * Also initialize the rest of our working state. + * Initialize the new pd_prune_xid value to zero (indicating no prunable + * tuples). If we find any tuples which may soon become prunable, we will + * save the lowest relevant XID in new_prune_xid. Also initialize the rest + * of our working state. */ prstate.new_prune_xid = InvalidTransactionId; prstate.nredirected = prstate.ndead = prstate.nunused = 0; @@ -204,9 +204,9 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin, } /* - * Send invalidation messages for any tuples we are about to move. - * It is safe to do this now, even though we could theoretically still - * fail before making the actual page update, because a useless cache + * Send invalidation messages for any tuples we are about to move. It is + * safe to do this now, even though we could theoretically still fail + * before making the actual page update, because a useless cache * invalidation doesn't hurt anything. Also, no one else can reload the * tuples while we have exclusive buffer lock, so it's not too early to * send the invals. This avoids sending the invals while inside the @@ -222,9 +222,8 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin, if (prstate.nredirected > 0 || prstate.ndead > 0 || prstate.nunused > 0) { /* - * Apply the planned item changes, then repair page fragmentation, - * and update the page's hint bit about whether it has free line - * pointers. + * Apply the planned item changes, then repair page fragmentation, and + * update the page's hint bit about whether it has free line pointers. */ heap_page_prune_execute(buffer, prstate.redirected, prstate.nredirected, @@ -268,8 +267,8 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin, { /* * If we didn't prune anything, but have found a new value for the - * pd_prune_xid field, update it and mark the buffer dirty. - * This is treated as a non-WAL-logged hint. + * pd_prune_xid field, update it and mark the buffer dirty. This is + * treated as a non-WAL-logged hint. * * Also clear the "page is full" flag if it is set, since there's no * point in repeating the prune/defrag process until something else @@ -334,8 +333,8 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin, * OldestXmin is the cutoff XID used to identify dead tuples. * * We don't actually change the page here, except perhaps for hint-bit updates - * caused by HeapTupleSatisfiesVacuum. We just add entries to the arrays in - * prstate showing the changes to be made. Items to be redirected are added + * caused by HeapTupleSatisfiesVacuum. We just add entries to the arrays in + * prstate showing the changes to be made. Items to be redirected are added * to the redirected[] array (two entries per redirection); items to be set to * LP_DEAD state are added to nowdead[]; and items to be set to LP_UNUSED * state are added to nowunused[]. @@ -598,19 +597,19 @@ heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum, else if (redirect_move && ItemIdIsRedirected(rootlp)) { /* - * If we desire to eliminate LP_REDIRECT items by moving tuples, - * make a redirection entry for each redirected root item; this - * will cause heap_page_prune_execute to actually do the move. - * (We get here only when there are no DEAD tuples in the chain; - * otherwise the redirection entry was made above.) + * If we desire to eliminate LP_REDIRECT items by moving tuples, make + * a redirection entry for each redirected root item; this will cause + * heap_page_prune_execute to actually do the move. (We get here only + * when there are no DEAD tuples in the chain; otherwise the + * redirection entry was made above.) */ heap_prune_record_redirect(prstate, rootoffnum, chainitems[1]); redirect_target = chainitems[1]; } /* - * If we are going to implement a redirect by moving tuples, we have - * to issue a cache invalidation against the redirection target tuple, + * If we are going to implement a redirect by moving tuples, we have to + * issue a cache invalidation against the redirection target tuple, * because its CTID will be effectively changed by the move. Note that * CacheInvalidateHeapTuple only queues the request, it doesn't send it; * if we fail before reaching EndNonTransactionalInvalidation, nothing @@ -693,7 +692,7 @@ heap_prune_record_unused(PruneState *prstate, OffsetNumber offnum) * buffer, and is inside a critical section. * * This is split out because it is also used by heap_xlog_clean() - * to replay the WAL record when needed after a crash. Note that the + * to replay the WAL record when needed after a crash. Note that the * arguments are identical to those of log_heap_clean(). */ void diff --git a/src/backend/access/heap/rewriteheap.c b/src/backend/access/heap/rewriteheap.c index f6a16b8492..6f00c24845 100644 --- a/src/backend/access/heap/rewriteheap.c +++ b/src/backend/access/heap/rewriteheap.c @@ -96,7 +96,7 @@ * Portions Copyright (c) 1994-5, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/heap/rewriteheap.c,v 1.17 2009/01/01 17:23:35 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/heap/rewriteheap.c,v 1.18 2009/06/11 14:48:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -577,7 +577,7 @@ raw_heap_insert(RewriteState state, HeapTuple tup) heaptup = toast_insert_or_update(state->rs_new_rel, tup, NULL, HEAP_INSERT_SKIP_FSM | (state->rs_use_wal ? - 0 : HEAP_INSERT_SKIP_WAL)); + 0 : HEAP_INSERT_SKIP_WAL)); else heaptup = tup; diff --git a/src/backend/access/heap/tuptoaster.c b/src/backend/access/heap/tuptoaster.c index 35019a543c..a3203085b7 100644 --- a/src/backend/access/heap/tuptoaster.c +++ b/src/backend/access/heap/tuptoaster.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.92 2009/01/01 17:23:35 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.93 2009/06/11 14:48:54 momjian Exp $ * * * INTERFACE ROUTINES @@ -1073,8 +1073,8 @@ toast_compress_datum(Datum value) Assert(!VARATT_IS_COMPRESSED(DatumGetPointer(value))); /* - * No point in wasting a palloc cycle if value size is out of the - * allowed range for compression + * No point in wasting a palloc cycle if value size is out of the allowed + * range for compression */ if (valsize < PGLZ_strategy_default->min_input_size || valsize > PGLZ_strategy_default->max_input_size) @@ -1087,10 +1087,10 @@ toast_compress_datum(Datum value) * because it might be satisfied with having saved as little as one byte * in the compressed data --- which could turn into a net loss once you * consider header and alignment padding. Worst case, the compressed - * format might require three padding bytes (plus header, which is included - * in VARSIZE(tmp)), whereas the uncompressed format would take only one - * header byte and no padding if the value is short enough. So we insist - * on a savings of more than 2 bytes to ensure we have a gain. + * format might require three padding bytes (plus header, which is + * included in VARSIZE(tmp)), whereas the uncompressed format would take + * only one header byte and no padding if the value is short enough. So + * we insist on a savings of more than 2 bytes to ensure we have a gain. */ if (pglz_compress(VARDATA_ANY(DatumGetPointer(value)), valsize, (PGLZ_Header *) tmp, PGLZ_strategy_default) && @@ -1130,7 +1130,7 @@ toast_save_datum(Relation rel, Datum value, int options) struct { struct varlena hdr; - char data[TOAST_MAX_CHUNK_SIZE]; /* make struct big enough */ + char data[TOAST_MAX_CHUNK_SIZE]; /* make struct big enough */ int32 align_it; /* ensure struct is aligned well enough */ } chunk_data; int32 chunk_size; @@ -1295,8 +1295,8 @@ toast_delete_datum(Relation rel, Datum value) /* * Find all the chunks. (We don't actually care whether we see them in - * sequence or not, but since we've already locked the index we might - * as well use systable_beginscan_ordered.) + * sequence or not, but since we've already locked the index we might as + * well use systable_beginscan_ordered.) */ toastscan = systable_beginscan_ordered(toastrel, toastidx, SnapshotToast, 1, &toastkey); @@ -1598,7 +1598,7 @@ toast_fetch_datum_slice(struct varlena * attr, int32 sliceoffset, int32 length) */ nextidx = startchunk; toastscan = systable_beginscan_ordered(toastrel, toastidx, - SnapshotToast, nscankeys, toastkey); + SnapshotToast, nscankeys, toastkey); while ((ttup = systable_getnext_ordered(toastscan, ForwardScanDirection)) != NULL) { /* diff --git a/src/backend/access/heap/visibilitymap.c b/src/backend/access/heap/visibilitymap.c index 2b5a0704ed..d425e772b9 100644 --- a/src/backend/access/heap/visibilitymap.c +++ b/src/backend/access/heap/visibilitymap.c @@ -8,10 +8,10 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/heap/visibilitymap.c,v 1.3 2009/01/01 17:23:35 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/heap/visibilitymap.c,v 1.4 2009/06/11 14:48:54 momjian Exp $ * * INTERFACE ROUTINES - * visibilitymap_clear - clear a bit in the visibility map + * visibilitymap_clear - clear a bit in the visibility map * visibilitymap_pin - pin a map page for setting a bit * visibilitymap_set - set a bit in a previously pinned page * visibilitymap_test - test if a bit is set @@ -144,7 +144,7 @@ visibilitymap_clear(Relation rel, BlockNumber heapBlk) mapBuffer = vm_readbuf(rel, mapBlock, false); if (!BufferIsValid(mapBuffer)) - return; /* nothing to do */ + return; /* nothing to do */ LockBuffer(mapBuffer, BUFFER_LOCK_EXCLUSIVE); map = PageGetContents(BufferGetPage(mapBuffer)); @@ -295,10 +295,11 @@ void visibilitymap_truncate(Relation rel, BlockNumber nheapblocks) { BlockNumber newnblocks; + /* last remaining block, byte, and bit */ BlockNumber truncBlock = HEAPBLK_TO_MAPBLOCK(nheapblocks); - uint32 truncByte = HEAPBLK_TO_MAPBYTE(nheapblocks); - uint8 truncBit = HEAPBLK_TO_MAPBIT(nheapblocks); + uint32 truncByte = HEAPBLK_TO_MAPBYTE(nheapblocks); + uint8 truncBit = HEAPBLK_TO_MAPBIT(nheapblocks); #ifdef TRACE_VISIBILITYMAP elog(DEBUG1, "vm_truncate %s %d", RelationGetRelationName(rel), nheapblocks); @@ -315,14 +316,14 @@ visibilitymap_truncate(Relation rel, BlockNumber nheapblocks) * Unless the new size is exactly at a visibility map page boundary, the * tail bits in the last remaining map page, representing truncated heap * blocks, need to be cleared. This is not only tidy, but also necessary - * because we don't get a chance to clear the bits if the heap is - * extended again. + * because we don't get a chance to clear the bits if the heap is extended + * again. */ if (truncByte != 0 || truncBit != 0) { - Buffer mapBuffer; - Page page; - char *map; + Buffer mapBuffer; + Page page; + char *map; newnblocks = truncBlock + 1; @@ -344,11 +345,8 @@ visibilitymap_truncate(Relation rel, BlockNumber nheapblocks) /* * Mask out the unwanted bits of the last remaining byte. * - * ((1 << 0) - 1) = 00000000 - * ((1 << 1) - 1) = 00000001 - * ... - * ((1 << 6) - 1) = 00111111 - * ((1 << 7) - 1) = 01111111 + * ((1 << 0) - 1) = 00000000 ((1 << 1) - 1) = 00000001 ... ((1 << 6) - + * 1) = 00111111 ((1 << 7) - 1) = 01111111 */ map[truncByte] &= (1 << truncBit) - 1; @@ -368,8 +366,8 @@ visibilitymap_truncate(Relation rel, BlockNumber nheapblocks) rel->rd_istemp); /* - * Need to invalidate the relcache entry, because rd_vm_nblocks - * seen by other backends is no longer valid. + * Need to invalidate the relcache entry, because rd_vm_nblocks seen by + * other backends is no longer valid. */ if (!InRecovery) CacheInvalidateRelcache(rel); @@ -386,7 +384,7 @@ visibilitymap_truncate(Relation rel, BlockNumber nheapblocks) static Buffer vm_readbuf(Relation rel, BlockNumber blkno, bool extend) { - Buffer buf; + Buffer buf; RelationOpenSmgr(rel); @@ -433,20 +431,20 @@ static void vm_extend(Relation rel, BlockNumber vm_nblocks) { BlockNumber vm_nblocks_now; - Page pg; + Page pg; pg = (Page) palloc(BLCKSZ); PageInit(pg, BLCKSZ, 0); /* - * We use the relation extension lock to lock out other backends trying - * to extend the visibility map at the same time. It also locks out - * extension of the main fork, unnecessarily, but extending the - * visibility map happens seldom enough that it doesn't seem worthwhile to - * have a separate lock tag type for it. + * We use the relation extension lock to lock out other backends trying to + * extend the visibility map at the same time. It also locks out extension + * of the main fork, unnecessarily, but extending the visibility map + * happens seldom enough that it doesn't seem worthwhile to have a + * separate lock tag type for it. * - * Note that another backend might have extended or created the - * relation before we get the lock. + * Note that another backend might have extended or created the relation + * before we get the lock. */ LockRelationForExtension(rel, ExclusiveLock); diff --git a/src/backend/access/index/genam.c b/src/backend/access/index/genam.c index 9193ee40eb..a79c392071 100644 --- a/src/backend/access/index/genam.c +++ b/src/backend/access/index/genam.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/index/genam.c,v 1.73 2009/01/01 17:23:35 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/index/genam.c,v 1.74 2009/06/11 14:48:54 momjian Exp $ * * NOTES * many of the old access method routines have been turned into @@ -197,7 +197,7 @@ systable_beginscan(Relation heapRelation, /* Change attribute numbers to be index column numbers. */ for (i = 0; i < nkeys; i++) { - int j; + int j; for (j = 0; j < irel->rd_index->indnatts; j++) { @@ -241,12 +241,13 @@ systable_getnext(SysScanDesc sysscan) if (sysscan->irel) { htup = index_getnext(sysscan->iscan, ForwardScanDirection); + /* - * We currently don't need to support lossy index operators for - * any system catalog scan. It could be done here, using the - * scan keys to drive the operator calls, if we arranged to save - * the heap attnums during systable_beginscan(); this is practical - * because we still wouldn't need to support indexes on expressions. + * We currently don't need to support lossy index operators for any + * system catalog scan. It could be done here, using the scan keys to + * drive the operator calls, if we arranged to save the heap attnums + * during systable_beginscan(); this is practical because we still + * wouldn't need to support indexes on expressions. */ if (htup && sysscan->iscan->xs_recheck) elog(ERROR, "system catalog scans with lossy index conditions are not implemented"); @@ -326,7 +327,7 @@ systable_endscan(SysScanDesc sysscan) * index order. Also, for largely historical reasons, the index to use * is opened and locked by the caller, not here. * - * Currently we do not support non-index-based scans here. (In principle + * Currently we do not support non-index-based scans here. (In principle * we could do a heapscan and sort, but the uses are in places that * probably don't need to still work with corrupted catalog indexes.) * For the moment, therefore, these functions are merely the thinnest of @@ -360,7 +361,7 @@ systable_beginscan_ordered(Relation heapRelation, /* Change attribute numbers to be index column numbers. */ for (i = 0; i < nkeys; i++) { - int j; + int j; for (j = 0; j < indexRelation->rd_index->indnatts; j++) { diff --git a/src/backend/access/index/indexam.c b/src/backend/access/index/indexam.c index 197fa3b041..32623965c7 100644 --- a/src/backend/access/index/indexam.c +++ b/src/backend/access/index/indexam.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/index/indexam.c,v 1.113 2009/03/24 20:17:12 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/index/indexam.c,v 1.114 2009/06/11 14:48:54 momjian Exp $ * * INTERFACE ROUTINES * index_open - open an index relation by relation OID @@ -21,7 +21,7 @@ * index_markpos - mark a scan position * index_restrpos - restore a scan position * index_getnext - get the next tuple from a scan - * index_getbitmap - get all tuples from a scan + * index_getbitmap - get all tuples from a scan * index_bulk_delete - bulk deletion of index tuples * index_vacuum_cleanup - post-deletion cleanup of an index * index_getprocid - get a support procedure OID @@ -461,9 +461,9 @@ index_getnext(IndexScanDesc scan, ScanDirection direction) /* * The AM's gettuple proc finds the next index entry matching the - * scan keys, and puts the TID in xs_ctup.t_self (ie, *tid). - * It should also set scan->xs_recheck, though we pay no - * attention to that here. + * scan keys, and puts the TID in xs_ctup.t_self (ie, *tid). It + * should also set scan->xs_recheck, though we pay no attention to + * that here. */ found = DatumGetBool(FunctionCall2(procedure, PointerGetDatum(scan), diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c index b0d14319b7..a06faa2020 100644 --- a/src/backend/access/nbtree/nbtinsert.c +++ b/src/backend/access/nbtree/nbtinsert.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.169 2009/01/01 17:23:35 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.170 2009/06/11 14:48:54 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -374,7 +374,7 @@ _bt_check_unique(Relation rel, IndexTuple itup, Relation heapRel, * removing any LP_DEAD tuples. * * On entry, *buf and *offsetptr point to the first legal position - * where the new tuple could be inserted. The caller should hold an + * where the new tuple could be inserted. The caller should hold an * exclusive lock on *buf. *offsetptr can also be set to * InvalidOffsetNumber, in which case the function will search for the * right location within the page if needed. On exit, they point to the @@ -951,7 +951,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright, sopaque = (BTPageOpaque) PageGetSpecialPointer(spage); if (sopaque->btpo_prev != ropaque->btpo_prev) elog(PANIC, "right sibling's left-link doesn't match: " - "block %u links to %u instead of expected %u in index \"%s\"", + "block %u links to %u instead of expected %u in index \"%s\"", ropaque->btpo_next, sopaque->btpo_prev, ropaque->btpo_prev, RelationGetRelationName(rel)); diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c index 55d947e9f2..2b76e7cd45 100644 --- a/src/backend/access/nbtree/nbtree.c +++ b/src/backend/access/nbtree/nbtree.c @@ -12,7 +12,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtree.c,v 1.170 2009/06/06 22:13:51 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtree.c,v 1.171 2009/06/11 14:48:54 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -290,7 +290,7 @@ Datum btgetbitmap(PG_FUNCTION_ARGS) { IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0); - TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1); + TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1); BTScanOpaque so = (BTScanOpaque) scan->opaque; int64 ntids = 0; ItemPointer heapTid; @@ -579,9 +579,8 @@ btvacuumcleanup(PG_FUNCTION_ARGS) /* * During a non-FULL vacuum it's quite possible for us to be fooled by * concurrent page splits into double-counting some index tuples, so - * disbelieve any total that exceeds the underlying heap's count ... - * if we know that accurately. Otherwise this might just make matters - * worse. + * disbelieve any total that exceeds the underlying heap's count ... if we + * know that accurately. Otherwise this might just make matters worse. */ if (!info->vacuum_full && !info->estimated_count) { diff --git a/src/backend/access/nbtree/nbtxlog.c b/src/backend/access/nbtree/nbtxlog.c index 3de7d50e01..d132d6bdee 100644 --- a/src/backend/access/nbtree/nbtxlog.c +++ b/src/backend/access/nbtree/nbtxlog.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.54 2009/01/20 18:59:37 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.55 2009/06/11 14:48:54 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -338,8 +338,8 @@ btree_xlog_split(bool onleft, bool isroot, _bt_restore_page(rpage, datapos, datalen); /* - * On leaf level, the high key of the left page is equal to the - * first key on the right page. + * On leaf level, the high key of the left page is equal to the first key + * on the right page. */ if (xlrec->level == 0) { @@ -936,7 +936,7 @@ btree_xlog_cleanup(void) buf = XLogReadBuffer(action->node, action->delblk, false); if (BufferIsValid(buf)) { - Relation reln; + Relation reln; reln = CreateFakeRelcacheEntry(action->node); if (_bt_pagedel(reln, buf, NULL, true) == 0) diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c index 368d2c9d1a..8544725abb 100644 --- a/src/backend/access/transam/clog.c +++ b/src/backend/access/transam/clog.c @@ -26,7 +26,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/clog.c,v 1.52 2009/01/20 18:59:37 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/clog.c,v 1.53 2009/06/11 14:48:54 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -81,7 +81,7 @@ static bool CLOGPagePrecedes(int page1, int page2); static void WriteZeroPageXlogRec(int pageno); static void WriteTruncateXlogRec(int pageno); static void TransactionIdSetPageStatus(TransactionId xid, int nsubxids, - TransactionId *subxids, XidStatus status, + TransactionId *subxids, XidStatus status, XLogRecPtr lsn, int pageno); static void TransactionIdSetStatusBit(TransactionId xid, XidStatus status, XLogRecPtr lsn, int slotno); @@ -112,10 +112,10 @@ static void set_status_by_pages(int nsubxids, TransactionId *subxids, * the same CLOG page as xid. If they all are, then the lock will be grabbed * only once, and the status will be set to committed directly. Otherwise * we must - * 1. set sub-committed all subxids that are not on the same page as the - * main xid - * 2. atomically set committed the main xid and the subxids on the same page - * 3. go over the first bunch again and set them committed + * 1. set sub-committed all subxids that are not on the same page as the + * main xid + * 2. atomically set committed the main xid and the subxids on the same page + * 3. go over the first bunch again and set them committed * Note that as far as concurrent checkers are concerned, main transaction * commit as a whole is still atomic. * @@ -126,13 +126,13 @@ static void set_status_by_pages(int nsubxids, TransactionId *subxids, * page2: set t2,t3 as sub-committed * page3: set t4 as sub-committed * 2. update page1: - * set t1 as sub-committed, + * set t1 as sub-committed, * then set t as committed, then set t1 as committed * 3. update pages2-3: * page2: set t2,t3 as committed * page3: set t4 as committed - * + * * NB: this is a low-level routine and is NOT the preferred entry point * for most uses; functions in transam.c are the intended callers. * @@ -142,16 +142,17 @@ static void set_status_by_pages(int nsubxids, TransactionId *subxids, */ void TransactionIdSetTreeStatus(TransactionId xid, int nsubxids, - TransactionId *subxids, XidStatus status, XLogRecPtr lsn) + TransactionId *subxids, XidStatus status, XLogRecPtr lsn) { - int pageno = TransactionIdToPage(xid); /* get page of parent */ - int i; + int pageno = TransactionIdToPage(xid); /* get page of parent */ + int i; Assert(status == TRANSACTION_STATUS_COMMITTED || status == TRANSACTION_STATUS_ABORTED); /* - * See how many subxids, if any, are on the same page as the parent, if any. + * See how many subxids, if any, are on the same page as the parent, if + * any. */ for (i = 0; i < nsubxids; i++) { @@ -172,14 +173,14 @@ TransactionIdSetTreeStatus(TransactionId xid, int nsubxids, } else { - int nsubxids_on_first_page = i; + int nsubxids_on_first_page = i; /* * If this is a commit then we care about doing this correctly (i.e. - * using the subcommitted intermediate status). By here, we know we're - * updating more than one page of clog, so we must mark entries that - * are *not* on the first page so that they show as subcommitted before - * we then return to update the status to fully committed. + * using the subcommitted intermediate status). By here, we know + * we're updating more than one page of clog, so we must mark entries + * that are *not* on the first page so that they show as subcommitted + * before we then return to update the status to fully committed. * * To avoid touching the first page twice, skip marking subcommitted * for the subxids on that first page. @@ -217,13 +218,13 @@ static void set_status_by_pages(int nsubxids, TransactionId *subxids, XidStatus status, XLogRecPtr lsn) { - int pageno = TransactionIdToPage(subxids[0]); - int offset = 0; - int i = 0; + int pageno = TransactionIdToPage(subxids[0]); + int offset = 0; + int i = 0; while (i < nsubxids) { - int num_on_page = 0; + int num_on_page = 0; while (TransactionIdToPage(subxids[i]) == pageno && i < nsubxids) { @@ -251,7 +252,7 @@ TransactionIdSetPageStatus(TransactionId xid, int nsubxids, XLogRecPtr lsn, int pageno) { int slotno; - int i; + int i; Assert(status == TRANSACTION_STATUS_COMMITTED || status == TRANSACTION_STATUS_ABORTED || @@ -275,9 +276,9 @@ TransactionIdSetPageStatus(TransactionId xid, int nsubxids, * * If we update more than one xid on this page while it is being written * out, we might find that some of the bits go to disk and others don't. - * If we are updating commits on the page with the top-level xid that could - * break atomicity, so we subcommit the subxids first before we mark the - * top-level commit. + * If we are updating commits on the page with the top-level xid that + * could break atomicity, so we subcommit the subxids first before we mark + * the top-level commit. */ if (TransactionIdIsValid(xid)) { @@ -336,7 +337,7 @@ TransactionIdSetStatusBit(TransactionId xid, XidStatus status, XLogRecPtr lsn, i curval == TRANSACTION_STATUS_COMMITTED) return; - /* + /* * Current state change should be from 0 or subcommitted to target state * or we should already be there when replaying changes during recovery. */ diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c index 4685ccdf10..4a43579c40 100644 --- a/src/backend/access/transam/twophase.c +++ b/src/backend/access/transam/twophase.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.52 2009/04/23 00:23:45 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.53 2009/06/11 14:48:54 momjian Exp $ * * NOTES * Each global transaction is associated with a global transaction @@ -233,7 +233,7 @@ MarkAsPreparing(TransactionId xid, const char *gid, ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("prepared transactions are disabled"), - errhint("Set max_prepared_transactions to a nonzero value."))); + errhint("Set max_prepared_transactions to a nonzero value."))); LWLockAcquire(TwoPhaseStateLock, LW_EXCLUSIVE); diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index ac330411aa..2b6a222477 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.273 2009/05/13 20:27:17 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.274 2009/06/11 14:48:54 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -456,7 +456,7 @@ GetCurrentSubTransactionId(void) * * "used" must be TRUE if the caller intends to use the command ID to mark * inserted/updated/deleted tuples. FALSE means the ID is being fetched - * for read-only purposes (ie, as a snapshot validity cutoff). See + * for read-only purposes (ie, as a snapshot validity cutoff). See * CommandCounterIncrement() for discussion. */ CommandId @@ -566,7 +566,8 @@ TransactionIdIsCurrentTransactionId(TransactionId xid) */ for (s = CurrentTransactionState; s != NULL; s = s->parent) { - int low, high; + int low, + high; if (s->state == TRANS_ABORT) continue; @@ -579,8 +580,8 @@ TransactionIdIsCurrentTransactionId(TransactionId xid) high = s->nChildXids - 1; while (low <= high) { - int middle; - TransactionId probe; + int middle; + TransactionId probe; middle = low + (high - low) / 2; probe = s->childXids[middle]; @@ -604,33 +605,31 @@ void CommandCounterIncrement(void) { /* - * If the current value of the command counter hasn't been "used" to - * mark tuples, we need not increment it, since there's no need to - * distinguish a read-only command from others. This helps postpone - * command counter overflow, and keeps no-op CommandCounterIncrement - * operations cheap. + * If the current value of the command counter hasn't been "used" to mark + * tuples, we need not increment it, since there's no need to distinguish + * a read-only command from others. This helps postpone command counter + * overflow, and keeps no-op CommandCounterIncrement operations cheap. */ if (currentCommandIdUsed) { currentCommandId += 1; - if (currentCommandId == FirstCommandId) /* check for overflow */ + if (currentCommandId == FirstCommandId) /* check for overflow */ { currentCommandId -= 1; ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("cannot have more than 2^32-1 commands in a transaction"))); + errmsg("cannot have more than 2^32-1 commands in a transaction"))); } currentCommandIdUsed = false; /* Propagate new command ID into static snapshots */ SnapshotSetCommandId(currentCommandId); - + /* - * Make any catalog changes done by the just-completed command - * visible in the local syscache. We obviously don't need to do - * this after a read-only command. (But see hacks in inval.c - * to make real sure we don't think a command that queued inval - * messages was read-only.) + * Make any catalog changes done by the just-completed command visible + * in the local syscache. We obviously don't need to do this after a + * read-only command. (But see hacks in inval.c to make real sure we + * don't think a command that queued inval messages was read-only.) */ AtCommit_LocalCache(); } @@ -638,11 +637,11 @@ CommandCounterIncrement(void) /* * Make any other backends' catalog changes visible to me. * - * XXX this is probably in the wrong place: CommandCounterIncrement - * should be purely a local operation, most likely. However fooling - * with this will affect asynchronous cross-backend interactions, - * which doesn't seem like a wise thing to do in late beta, so save - * improving this for another day - tgl 2007-11-30 + * XXX this is probably in the wrong place: CommandCounterIncrement should + * be purely a local operation, most likely. However fooling with this + * will affect asynchronous cross-backend interactions, which doesn't seem + * like a wise thing to do in late beta, so save improving this for + * another day - tgl 2007-11-30 */ AtStart_Cache(); } @@ -1086,14 +1085,14 @@ AtSubCommit_childXids(void) /* Allocate or enlarge the parent array if necessary */ if (s->parent->maxChildXids < new_nChildXids) { - int new_maxChildXids; - TransactionId *new_childXids; + int new_maxChildXids; + TransactionId *new_childXids; /* * Make it 2x what's needed right now, to avoid having to enlarge it - * repeatedly. But we can't go above MaxAllocSize. (The latter - * limit is what ensures that we don't need to worry about integer - * overflow here or in the calculation of new_nChildXids.) + * repeatedly. But we can't go above MaxAllocSize. (The latter limit + * is what ensures that we don't need to worry about integer overflow + * here or in the calculation of new_nChildXids.) */ new_maxChildXids = Min(new_nChildXids * 2, (int) (MaxAllocSize / sizeof(TransactionId))); @@ -1111,13 +1110,13 @@ AtSubCommit_childXids(void) */ if (s->parent->childXids == NULL) new_childXids = - MemoryContextAlloc(TopTransactionContext, + MemoryContextAlloc(TopTransactionContext, new_maxChildXids * sizeof(TransactionId)); else - new_childXids = repalloc(s->parent->childXids, - new_maxChildXids * sizeof(TransactionId)); + new_childXids = repalloc(s->parent->childXids, + new_maxChildXids * sizeof(TransactionId)); - s->parent->childXids = new_childXids; + s->parent->childXids = new_childXids; s->parent->maxChildXids = new_maxChildXids; } @@ -1126,9 +1125,9 @@ AtSubCommit_childXids(void) * * Note: We rely on the fact that the XID of a child always follows that * of its parent. By copying the XID of this subtransaction before the - * XIDs of its children, we ensure that the array stays ordered. Likewise, - * all XIDs already in the array belong to subtransactions started and - * subcommitted before us, so their XIDs must precede ours. + * XIDs of its children, we ensure that the array stays ordered. + * Likewise, all XIDs already in the array belong to subtransactions + * started and subcommitted before us, so their XIDs must precede ours. */ s->parent->childXids[s->parent->nChildXids] = s->transactionId; @@ -1801,15 +1800,15 @@ PrepareTransaction(void) /* NOTIFY and flatfiles will be handled below */ /* - * Don't allow PREPARE TRANSACTION if we've accessed a temporary table - * in this transaction. Having the prepared xact hold locks on another + * Don't allow PREPARE TRANSACTION if we've accessed a temporary table in + * this transaction. Having the prepared xact hold locks on another * backend's temp table seems a bad idea --- for instance it would prevent - * the backend from exiting. There are other problems too, such as how - * to clean up the source backend's local buffers and ON COMMIT state - * if the prepared xact includes a DROP of a temp table. + * the backend from exiting. There are other problems too, such as how to + * clean up the source backend's local buffers and ON COMMIT state if the + * prepared xact includes a DROP of a temp table. * - * We must check this after executing any ON COMMIT actions, because - * they might still access a temp relation. + * We must check this after executing any ON COMMIT actions, because they + * might still access a temp relation. * * XXX In principle this could be relaxed to allow some useful special * cases, such as a temp table created and dropped all within the @@ -2021,8 +2020,8 @@ AbortTransaction(void) /* * Reset user ID which might have been changed transiently. We need this * to clean up in case control escaped out of a SECURITY DEFINER function - * or other local change of CurrentUserId; therefore, the prior value - * of SecurityDefinerContext also needs to be restored. + * or other local change of CurrentUserId; therefore, the prior value of + * SecurityDefinerContext also needs to be restored. * * (Note: it is not necessary to restore session authorization or role * settings here because those can only be changed via GUC, and GUC will @@ -3749,8 +3748,8 @@ CommitSubTransaction(void) /* Must CCI to ensure commands of subtransaction are seen as done */ CommandCounterIncrement(); - /* - * Prior to 8.4 we marked subcommit in clog at this point. We now only + /* + * Prior to 8.4 we marked subcommit in clog at this point. We now only * perform that step, if required, as part of the atomic update of the * whole transaction tree at top level commit or abort. */ @@ -3868,8 +3867,8 @@ AbortSubTransaction(void) s->state = TRANS_ABORT; /* - * Reset user ID which might have been changed transiently. (See notes - * in AbortTransaction.) + * Reset user ID which might have been changed transiently. (See notes in + * AbortTransaction.) */ SetUserIdAndContext(s->prevUser, s->prevSecDefCxt); @@ -4089,7 +4088,7 @@ ShowTransactionStateRec(TransactionState s) if (s->nChildXids > 0) { - int i; + int i; appendStringInfo(&buf, "%u", s->childXids[0]); for (i = 1; i < s->nChildXids; i++) @@ -4241,7 +4240,7 @@ xact_redo_commit(xl_xact_commit *xlrec, TransactionId xid) for (i = 0; i < xlrec->nrels; i++) { SMgrRelation srel = smgropen(xlrec->xnodes[i]); - ForkNumber fork; + ForkNumber fork; for (fork = 0; fork <= MAX_FORKNUM; fork++) { @@ -4284,7 +4283,7 @@ xact_redo_abort(xl_xact_abort *xlrec, TransactionId xid) for (i = 0; i < xlrec->nrels; i++) { SMgrRelation srel = smgropen(xlrec->xnodes[i]); - ForkNumber fork; + ForkNumber fork; for (fork = 0; fork <= MAX_FORKNUM; fork++) { @@ -4353,7 +4352,8 @@ xact_desc_commit(StringInfo buf, xl_xact_commit *xlrec) appendStringInfo(buf, "; rels:"); for (i = 0; i < xlrec->nrels; i++) { - char *path = relpath(xlrec->xnodes[i], MAIN_FORKNUM); + char *path = relpath(xlrec->xnodes[i], MAIN_FORKNUM); + appendStringInfo(buf, " %s", path); pfree(path); } @@ -4380,7 +4380,8 @@ xact_desc_abort(StringInfo buf, xl_xact_abort *xlrec) appendStringInfo(buf, "; rels:"); for (i = 0; i < xlrec->nrels; i++) { - char *path = relpath(xlrec->xnodes[i], MAIN_FORKNUM); + char *path = relpath(xlrec->xnodes[i], MAIN_FORKNUM); + appendStringInfo(buf, " %s", path); pfree(path); } diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index b6171c78c0..d521fa6e7b 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.342 2009/06/02 06:18:06 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.343 2009/06/11 14:48:54 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -69,7 +69,7 @@ bool XLogArchiveMode = false; char *XLogArchiveCommand = NULL; bool fullPageWrites = true; bool log_checkpoints = false; -int sync_method = DEFAULT_SYNC_METHOD; +int sync_method = DEFAULT_SYNC_METHOD; #ifdef WAL_DEBUG bool XLOG_DEBUG = false; @@ -122,7 +122,7 @@ CheckpointStatsData CheckpointStats; TimeLineID ThisTimeLineID = 0; /* - * Are we doing recovery from XLOG? + * Are we doing recovery from XLOG? * * This is only ever true in the startup process, even if the system is still * in recovery. Prior to 8.4, all activity during recovery were carried out @@ -336,9 +336,8 @@ typedef struct XLogCtlData bool SharedRecoveryInProgress; /* - * During recovery, we keep a copy of the latest checkpoint record - * here. Used by the background writer when it wants to create - * a restartpoint. + * During recovery, we keep a copy of the latest checkpoint record here. + * Used by the background writer when it wants to create a restartpoint. * * Protected by info_lck. */ @@ -422,8 +421,9 @@ static XLogRecPtr ReadRecPtr; /* start of last record read */ static XLogRecPtr EndRecPtr; /* end+1 of last record read */ static XLogRecord *nextRecord = NULL; static TimeLineID lastPageTLI = 0; -static XLogRecPtr minRecoveryPoint; /* local copy of ControlFile->minRecoveryPoint */ -static bool updateMinRecoveryPoint = true; +static XLogRecPtr minRecoveryPoint; /* local copy of + * ControlFile->minRecoveryPoint */ +static bool updateMinRecoveryPoint = true; static bool InRedo = false; @@ -432,6 +432,7 @@ static bool InRedo = false; */ static volatile sig_atomic_t got_SIGHUP = false; static volatile sig_atomic_t shutdown_requested = false; + /* * Flag set when executing a restore command, to tell SIGTERM signal handler * that it's safe to just proc_exit. @@ -482,6 +483,7 @@ static void writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI, static void WriteControlFile(void); static void ReadControlFile(void); static char *str_time(pg_time_t tnow); + #ifdef WAL_DEBUG static void xlog_outrec(StringInfo buf, XLogRecord *record); #endif @@ -490,7 +492,7 @@ static void pg_start_backup_callback(int code, Datum arg); static bool read_backup_label(XLogRecPtr *checkPointLoc, XLogRecPtr *minRecoveryLoc); static void rm_redo_error_callback(void *arg); -static int get_sync_bit(int method); +static int get_sync_bit(int method); /* @@ -1260,9 +1262,9 @@ XLogArchiveIsBusy(const char *xlog) return false; /* - * Check to see if the WAL file has been removed by checkpoint, - * which implies it has already been archived, and explains why we - * can't see a status file for it. + * Check to see if the WAL file has been removed by checkpoint, which + * implies it has already been archived, and explains why we can't see a + * status file for it. */ snprintf(archiveStatusPath, MAXPGPATH, XLOGDIR "/%s", xlog); if (stat(archiveStatusPath, &stat_buf) != 0 && @@ -1775,8 +1777,8 @@ XLogSetAsyncCommitLSN(XLogRecPtr asyncCommitLSN) * Advance minRecoveryPoint in control file. * * If we crash during recovery, we must reach this point again before the - * database is consistent. - * + * database is consistent. + * * If 'force' is true, 'lsn' argument is ignored. Otherwise, minRecoveryPoint * is is only updated if it's not already greater than or equal to 'lsn'. */ @@ -1802,7 +1804,7 @@ UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force) { /* use volatile pointer to prevent code rearrangement */ volatile XLogCtlData *xlogctl = XLogCtl; - XLogRecPtr newMinRecoveryPoint; + XLogRecPtr newMinRecoveryPoint; /* * To avoid having to update the control file too often, we update it @@ -2567,7 +2569,7 @@ XLogFileClose(void) /* * WAL segment files will not be re-read in normal operation, so we advise - * the OS to release any cached pages. But do not do so if WAL archiving + * the OS to release any cached pages. But do not do so if WAL archiving * is active, because archiver process could use the cache to read the WAL * segment. Also, don't bother with it if we are using O_DIRECT, since * the kernel is presumably not caching in that case. @@ -2663,19 +2665,19 @@ RestoreArchivedFile(char *path, const char *xlogfname, /* * Calculate the archive file cutoff point for use during log shipping - * replication. All files earlier than this point can be deleted - * from the archive, though there is no requirement to do so. + * replication. All files earlier than this point can be deleted from the + * archive, though there is no requirement to do so. * * We initialise this with the filename of an InvalidXLogRecPtr, which - * will prevent the deletion of any WAL files from the archive - * because of the alphabetic sorting property of WAL filenames. + * will prevent the deletion of any WAL files from the archive because of + * the alphabetic sorting property of WAL filenames. * * Once we have successfully located the redo pointer of the checkpoint * from which we start recovery we never request a file prior to the redo - * pointer of the last restartpoint. When redo begins we know that we - * have successfully located it, so there is no need for additional - * status flags to signify the point when we can begin deleting WAL files - * from the archive. + * pointer of the last restartpoint. When redo begins we know that we have + * successfully located it, so there is no need for additional status + * flags to signify the point when we can begin deleting WAL files from + * the archive. */ if (InRedo) { @@ -2821,9 +2823,9 @@ RestoreArchivedFile(char *path, const char *xlogfname, * On SIGTERM, assume we have received a fast shutdown request, and exit * cleanly. It's pure chance whether we receive the SIGTERM first, or the * child process. If we receive it first, the signal handler will call - * proc_exit, otherwise we do it here. If we or the child process - * received SIGTERM for any other reason than a fast shutdown request, - * postmaster will perform an immediate shutdown when it sees us exiting + * proc_exit, otherwise we do it here. If we or the child process received + * SIGTERM for any other reason than a fast shutdown request, postmaster + * will perform an immediate shutdown when it sees us exiting * unexpectedly. * * Per the Single Unix Spec, shells report exit status > 128 when a called @@ -2871,19 +2873,19 @@ ExecuteRecoveryEndCommand(void) /* * Calculate the archive file cutoff point for use during log shipping - * replication. All files earlier than this point can be deleted - * from the archive, though there is no requirement to do so. + * replication. All files earlier than this point can be deleted from the + * archive, though there is no requirement to do so. * * We initialise this with the filename of an InvalidXLogRecPtr, which - * will prevent the deletion of any WAL files from the archive - * because of the alphabetic sorting property of WAL filenames. + * will prevent the deletion of any WAL files from the archive because of + * the alphabetic sorting property of WAL filenames. * * Once we have successfully located the redo pointer of the checkpoint * from which we start recovery we never request a file prior to the redo - * pointer of the last restartpoint. When redo begins we know that we - * have successfully located it, so there is no need for additional - * status flags to signify the point when we can begin deleting WAL files - * from the archive. + * pointer of the last restartpoint. When redo begins we know that we have + * successfully located it, so there is no need for additional status + * flags to signify the point when we can begin deleting WAL files from + * the archive. */ if (InRedo) { @@ -2948,14 +2950,14 @@ ExecuteRecoveryEndCommand(void) { /* * If the failure was due to any sort of signal, it's best to punt and - * abort recovery. See also detailed comments on signals in + * abort recovery. See also detailed comments on signals in * RestoreArchivedFile(). */ signaled = WIFSIGNALED(rc) || WEXITSTATUS(rc) > 125; ereport(signaled ? FATAL : WARNING, (errmsg("recovery_end_command \"%s\": return code %d", - xlogRecoveryEndCmd, rc))); + xlogRecoveryEndCmd, rc))); } } @@ -3101,12 +3103,12 @@ static void ValidateXLOGDirectoryStructure(void) { char path[MAXPGPATH]; - struct stat stat_buf; + struct stat stat_buf; /* Check for pg_xlog; if it doesn't exist, error out */ if (stat(XLOGDIR, &stat_buf) != 0 || !S_ISDIR(stat_buf.st_mode)) - ereport(FATAL, + ereport(FATAL, (errmsg("required WAL directory \"%s\" does not exist", XLOGDIR))); @@ -3116,7 +3118,7 @@ ValidateXLOGDirectoryStructure(void) { /* Check for weird cases where it exists but isn't a directory */ if (!S_ISDIR(stat_buf.st_mode)) - ereport(FATAL, + ereport(FATAL, (errmsg("required WAL directory \"%s\" does not exist", path))); } @@ -3125,7 +3127,7 @@ ValidateXLOGDirectoryStructure(void) ereport(LOG, (errmsg("creating missing WAL directory \"%s\"", path))); if (mkdir(path, 0700) < 0) - ereport(FATAL, + ereport(FATAL, (errmsg("could not create missing directory \"%s\": %m", path))); } @@ -3187,7 +3189,7 @@ CleanupBackupHistory(void) * ignoring them as already applied, but that's not a huge drawback. * * If 'cleanup' is true, a cleanup lock is used when restoring blocks. - * Otherwise, a normal exclusive lock is used. At the moment, that's just + * Otherwise, a normal exclusive lock is used. At the moment, that's just * pro forma, because there can't be any regular backends in the system * during recovery. The 'cleanup' argument applies to all backup blocks * in the WAL record, that suffices for now. @@ -4283,8 +4285,8 @@ ReadControlFile(void) ereport(FATAL, (errmsg("database files are incompatible with server"), errdetail("The database cluster was initialized with PG_CONTROL_VERSION %d (0x%08x)," - " but the server was compiled with PG_CONTROL_VERSION %d (0x%08x).", - ControlFile->pg_control_version, ControlFile->pg_control_version, + " but the server was compiled with PG_CONTROL_VERSION %d (0x%08x).", + ControlFile->pg_control_version, ControlFile->pg_control_version, PG_CONTROL_VERSION, PG_CONTROL_VERSION), errhint("This could be a problem of mismatched byte ordering. It looks like you need to initdb."))); @@ -4309,8 +4311,8 @@ ReadControlFile(void) /* * Do compatibility checking immediately. If the database isn't - * compatible with the backend executable, we want to abort before we - * can possibly do any damage. + * compatible with the backend executable, we want to abort before we can + * possibly do any damage. */ if (ControlFile->catalog_version_no != CATALOG_VERSION_NO) ereport(FATAL, @@ -4402,14 +4404,14 @@ ReadControlFile(void) ereport(FATAL, (errmsg("database files are incompatible with server"), errdetail("The database cluster was initialized without USE_FLOAT4_BYVAL" - " but the server was compiled with USE_FLOAT4_BYVAL."), + " but the server was compiled with USE_FLOAT4_BYVAL."), errhint("It looks like you need to recompile or initdb."))); #else if (ControlFile->float4ByVal != false) ereport(FATAL, (errmsg("database files are incompatible with server"), - errdetail("The database cluster was initialized with USE_FLOAT4_BYVAL" - " but the server was compiled without USE_FLOAT4_BYVAL."), + errdetail("The database cluster was initialized with USE_FLOAT4_BYVAL" + " but the server was compiled without USE_FLOAT4_BYVAL."), errhint("It looks like you need to recompile or initdb."))); #endif @@ -4418,14 +4420,14 @@ ReadControlFile(void) ereport(FATAL, (errmsg("database files are incompatible with server"), errdetail("The database cluster was initialized without USE_FLOAT8_BYVAL" - " but the server was compiled with USE_FLOAT8_BYVAL."), + " but the server was compiled with USE_FLOAT8_BYVAL."), errhint("It looks like you need to recompile or initdb."))); #else if (ControlFile->float8ByVal != false) ereport(FATAL, (errmsg("database files are incompatible with server"), - errdetail("The database cluster was initialized with USE_FLOAT8_BYVAL" - " but the server was compiled without USE_FLOAT8_BYVAL."), + errdetail("The database cluster was initialized with USE_FLOAT8_BYVAL" + " but the server was compiled without USE_FLOAT8_BYVAL."), errhint("It looks like you need to recompile or initdb."))); #endif } @@ -4848,9 +4850,9 @@ readRecoveryCommandFile(void) * does nothing if a recovery_target is not also set */ if (!parse_bool(tok2, &recoveryTargetInclusive)) - ereport(ERROR, - (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("parameter \"recovery_target_inclusive\" requires a Boolean value"))); + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("parameter \"recovery_target_inclusive\" requires a Boolean value"))); ereport(LOG, (errmsg("recovery_target_inclusive = %s", tok2))); } @@ -5204,8 +5206,8 @@ StartupXLOG(void) /* * Verify that pg_xlog and pg_xlog/archive_status exist. In cases where - * someone has performed a copy for PITR, these directories may have - * been excluded and need to be re-created. + * someone has performed a copy for PITR, these directories may have been + * excluded and need to be re-created. */ ValidateXLOGDirectoryStructure(); @@ -5437,6 +5439,7 @@ StartupXLOG(void) bool recoveryApply = true; bool reachedMinRecoveryPoint = false; ErrorContextCallback errcontext; + /* use volatile pointer to prevent code rearrangement */ volatile XLogCtlData *xlogctl = XLogCtl; @@ -5454,7 +5457,7 @@ StartupXLOG(void) else ereport(LOG, (errmsg("redo starts at %X/%X, consistency will be reached at %X/%X", - ReadRecPtr.xlogid, ReadRecPtr.xrecoff, + ReadRecPtr.xlogid, ReadRecPtr.xrecoff, minRecoveryPoint.xlogid, minRecoveryPoint.xrecoff))); /* @@ -5512,17 +5515,17 @@ StartupXLOG(void) proc_exit(1); /* - * Have we reached our safe starting point? If so, we can - * tell postmaster that the database is consistent now. + * Have we reached our safe starting point? If so, we can tell + * postmaster that the database is consistent now. */ - if (!reachedMinRecoveryPoint && - XLByteLE(minRecoveryPoint, EndRecPtr)) + if (!reachedMinRecoveryPoint && + XLByteLE(minRecoveryPoint, EndRecPtr)) { reachedMinRecoveryPoint = true; if (InArchiveRecovery) { ereport(LOG, - (errmsg("consistent recovery state reached"))); + (errmsg("consistent recovery state reached"))); if (IsUnderPostmaster) SendPostmasterSignal(PMSIGNAL_RECOVERY_CONSISTENT); } @@ -5554,9 +5557,8 @@ StartupXLOG(void) } /* - * Update shared replayEndRecPtr before replaying this - * record, so that XLogFlush will update minRecoveryPoint - * correctly. + * Update shared replayEndRecPtr before replaying this record, + * so that XLogFlush will update minRecoveryPoint correctly. */ SpinLockAcquire(&xlogctl->info_lck); xlogctl->replayEndRecPtr = EndRecPtr; @@ -5819,9 +5821,9 @@ bool RecoveryInProgress(void) { /* - * We check shared state each time only until we leave recovery mode. - * We can't re-enter recovery, so we rely on the local state variable - * after that. + * We check shared state each time only until we leave recovery mode. We + * can't re-enter recovery, so we rely on the local state variable after + * that. */ if (!LocalRecoveryInProgress) return false; @@ -6114,11 +6116,11 @@ ShutdownXLOG(int code, Datum arg) static void LogCheckpointStart(int flags, bool restartpoint) { - char *msg; + char *msg; /* - * XXX: This is hopelessly untranslatable. We could call gettext_noop - * for the main message, but what about all the flags? + * XXX: This is hopelessly untranslatable. We could call gettext_noop for + * the main message, but what about all the flags? */ if (restartpoint) msg = "restartpoint starting:%s%s%s%s%s%s"; @@ -6561,7 +6563,7 @@ CheckPointGuts(XLogRecPtr checkPointRedo, int flags) /* * This is used during WAL recovery to establish a point from which recovery - * can roll forward without replaying the entire recovery log. This function + * can roll forward without replaying the entire recovery log. This function * is called each time a checkpoint record is read from XLOG. It is stored * in shared memory, so that it can be used as a restartpoint later on. */ @@ -6569,6 +6571,7 @@ static void RecoveryRestartPoint(const CheckPoint *checkPoint) { int rmid; + /* use volatile pointer to prevent code rearrangement */ volatile XLogCtlData *xlogctl = XLogCtl; @@ -6592,8 +6595,8 @@ RecoveryRestartPoint(const CheckPoint *checkPoint) } /* - * Copy the checkpoint record to shared memory, so that bgwriter can - * use it the next time it wants to perform a restartpoint. + * Copy the checkpoint record to shared memory, so that bgwriter can use + * it the next time it wants to perform a restartpoint. */ SpinLockAcquire(&xlogctl->info_lck); XLogCtl->lastCheckPointRecPtr = ReadRecPtr; @@ -6613,8 +6616,9 @@ RecoveryRestartPoint(const CheckPoint *checkPoint) bool CreateRestartPoint(int flags) { - XLogRecPtr lastCheckPointRecPtr; - CheckPoint lastCheckPoint; + XLogRecPtr lastCheckPointRecPtr; + CheckPoint lastCheckPoint; + /* use volatile pointer to prevent code rearrangement */ volatile XLogCtlData *xlogctl = XLogCtl; @@ -6630,14 +6634,14 @@ CreateRestartPoint(int flags) memcpy(&lastCheckPoint, &XLogCtl->lastCheckPoint, sizeof(CheckPoint)); SpinLockRelease(&xlogctl->info_lck); - /* + /* * Check that we're still in recovery mode. It's ok if we exit recovery * mode after this check, the restart point is valid anyway. */ if (!RecoveryInProgress()) { ereport(DEBUG2, - (errmsg("skipping restartpoint, recovery has already ended"))); + (errmsg("skipping restartpoint, recovery has already ended"))); LWLockRelease(CheckpointLock); return false; } @@ -6653,16 +6657,17 @@ CreateRestartPoint(int flags) * possible in case of immediate shutdown, though. * * We don't explicitly advance minRecoveryPoint when we do create a - * restartpoint. It's assumed that flushing the buffers will do that - * as a side-effect. + * restartpoint. It's assumed that flushing the buffers will do that as a + * side-effect. */ if (XLogRecPtrIsInvalid(lastCheckPointRecPtr) || XLByteLE(lastCheckPoint.redo, ControlFile->checkPointCopy.redo)) { - XLogRecPtr InvalidXLogRecPtr = {0, 0}; + XLogRecPtr InvalidXLogRecPtr = {0, 0}; + ereport(DEBUG2, (errmsg("skipping restartpoint, already performed at %X/%X", - lastCheckPoint.redo.xlogid, lastCheckPoint.redo.xrecoff))); + lastCheckPoint.redo.xlogid, lastCheckPoint.redo.xrecoff))); UpdateMinRecoveryPoint(InvalidXLogRecPtr, true); LWLockRelease(CheckpointLock); @@ -6694,9 +6699,9 @@ CreateRestartPoint(int flags) LWLockRelease(ControlFileLock); /* - * Currently, there is no need to truncate pg_subtrans during recovery. - * If we did do that, we will need to have called StartupSUBTRANS() - * already and then TruncateSUBTRANS() would go here. + * Currently, there is no need to truncate pg_subtrans during recovery. If + * we did do that, we will need to have called StartupSUBTRANS() already + * and then TruncateSUBTRANS() would go here. */ /* All real work is done, but log before releasing lock. */ @@ -6705,12 +6710,12 @@ CreateRestartPoint(int flags) ereport((log_checkpoints ? LOG : DEBUG2), (errmsg("recovery restart point at %X/%X", - lastCheckPoint.redo.xlogid, lastCheckPoint.redo.xrecoff))); + lastCheckPoint.redo.xlogid, lastCheckPoint.redo.xrecoff))); if (recoveryLastXTime) ereport((log_checkpoints ? LOG : DEBUG2), - (errmsg("last completed transaction was at log time %s", - timestamptz_to_str(recoveryLastXTime)))); + (errmsg("last completed transaction was at log time %s", + timestamptz_to_str(recoveryLastXTime)))); LWLockRelease(CheckpointLock); return true; @@ -6828,9 +6833,9 @@ xlog_redo(XLogRecPtr lsn, XLogRecord *record) (int) checkPoint.ThisTimeLineID)) ereport(PANIC, (errmsg("unexpected timeline ID %u (after %u) in checkpoint record", - checkPoint.ThisTimeLineID, ThisTimeLineID))); - /* Following WAL records should be run with new TLI */ - ThisTimeLineID = checkPoint.ThisTimeLineID; + checkPoint.ThisTimeLineID, ThisTimeLineID))); + /* Following WAL records should be run with new TLI */ + ThisTimeLineID = checkPoint.ThisTimeLineID; } RecoveryRestartPoint(&checkPoint); @@ -6948,12 +6953,12 @@ get_sync_bit(int method) switch (method) { - /* - * enum values for all sync options are defined even if they are not - * supported on the current platform. But if not, they are not - * included in the enum option array, and therefore will never be seen - * here. - */ + /* + * enum values for all sync options are defined even if they are + * not supported on the current platform. But if not, they are + * not included in the enum option array, and therefore will never + * be seen here. + */ case SYNC_METHOD_FSYNC: case SYNC_METHOD_FSYNC_WRITETHROUGH: case SYNC_METHOD_FDATASYNC: @@ -6969,7 +6974,7 @@ get_sync_bit(int method) default: /* can't happen (unless we are out of sync with option array) */ elog(ERROR, "unrecognized wal_sync_method: %d", method); - return 0; /* silence warning */ + return 0; /* silence warning */ } } @@ -7146,8 +7151,8 @@ pg_start_backup(PG_FUNCTION_ARGS) * have different checkpoint positions and hence different history * file names, even if nothing happened in between. * - * We use CHECKPOINT_IMMEDIATE only if requested by user (via - * passing fast = true). Otherwise this can take awhile. + * We use CHECKPOINT_IMMEDIATE only if requested by user (via passing + * fast = true). Otherwise this can take awhile. */ RequestCheckpoint(CHECKPOINT_FORCE | CHECKPOINT_WAIT | (fast ? CHECKPOINT_IMMEDIATE : 0)); @@ -7376,9 +7381,9 @@ pg_stop_backup(PG_FUNCTION_ARGS) * property of the WAL files ensures any earlier WAL files are safely * archived as well. * - * We wait forever, since archive_command is supposed to work and - * we assume the admin wanted his backup to work completely. If you - * don't wish to wait, you can set statement_timeout. + * We wait forever, since archive_command is supposed to work and we + * assume the admin wanted his backup to work completely. If you don't + * wish to wait, you can set statement_timeout. */ XLByteToPrevSeg(stoppoint, _logId, _logSeg); XLogFileName(lastxlogfilename, ThisTimeLineID, _logId, _logSeg); @@ -7399,7 +7404,7 @@ pg_stop_backup(PG_FUNCTION_ARGS) if (++waits >= seconds_before_warning) { - seconds_before_warning *= 2; /* This wraps in >10 years... */ + seconds_before_warning *= 2; /* This wraps in >10 years... */ ereport(WARNING, (errmsg("pg_stop_backup still waiting for archive to complete (%d seconds elapsed)", waits))); @@ -7775,7 +7780,7 @@ CancelBackup(void) ereport(LOG, (errmsg("online backup mode cancelled"), errdetail("\"%s\" was renamed to \"%s\".", - BACKUP_LABEL_FILE, BACKUP_LABEL_OLD))); + BACKUP_LABEL_FILE, BACKUP_LABEL_OLD))); } else { @@ -7783,12 +7788,12 @@ CancelBackup(void) (errcode_for_file_access(), errmsg("online backup mode was not cancelled"), errdetail("Could not rename \"%s\" to \"%s\": %m.", - BACKUP_LABEL_FILE, BACKUP_LABEL_OLD))); + BACKUP_LABEL_FILE, BACKUP_LABEL_OLD))); } } /* ------------------------------------------------------ - * Startup Process main entry point and signal handlers + * Startup Process main entry point and signal handlers * ------------------------------------------------------ */ @@ -7818,8 +7823,8 @@ startupproc_quickdie(SIGNAL_ARGS) * system reset cycle if some idiot DBA sends a manual SIGQUIT to a random * backend. This is necessary precisely because we don't clean up our * shared memory state. (The "dead man switch" mechanism in pmsignal.c - * should ensure the postmaster sees this as a crash, too, but no harm - * in being doubly sure.) + * should ensure the postmaster sees this as a crash, too, but no harm in + * being doubly sure.) */ exit(2); } @@ -7858,10 +7863,10 @@ StartupProcessMain(void) /* * Properly accept or ignore signals the postmaster might send us */ - pqsignal(SIGHUP, StartupProcSigHupHandler); /* reload config file */ - pqsignal(SIGINT, SIG_IGN); /* ignore query cancel */ - pqsignal(SIGTERM, StartupProcShutdownHandler); /* request shutdown */ - pqsignal(SIGQUIT, startupproc_quickdie); /* hard crash time */ + pqsignal(SIGHUP, StartupProcSigHupHandler); /* reload config file */ + pqsignal(SIGINT, SIG_IGN); /* ignore query cancel */ + pqsignal(SIGTERM, StartupProcShutdownHandler); /* request shutdown */ + pqsignal(SIGQUIT, startupproc_quickdie); /* hard crash time */ pqsignal(SIGALRM, SIG_IGN); pqsignal(SIGPIPE, SIG_IGN); pqsignal(SIGUSR1, SIG_IGN); @@ -7881,13 +7886,13 @@ StartupProcessMain(void) */ PG_SETMASK(&UnBlockSig); - StartupXLOG(); + StartupXLOG(); BuildFlatFiles(false); /* - * Exit normally. Exit code 0 tells postmaster that we completed - * recovery successfully. + * Exit normally. Exit code 0 tells postmaster that we completed recovery + * successfully. */ proc_exit(0); } diff --git a/src/backend/access/transam/xlogutils.c b/src/backend/access/transam/xlogutils.c index 458af10ca1..8c6e339bf4 100644 --- a/src/backend/access/transam/xlogutils.c +++ b/src/backend/access/transam/xlogutils.c @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.67 2009/01/20 18:59:37 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.68 2009/06/11 14:48:54 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -68,7 +68,8 @@ log_invalid_page(RelFileNode node, ForkNumber forkno, BlockNumber blkno, */ if (log_min_messages <= DEBUG1 || client_min_messages <= DEBUG1) { - char *path = relpath(node, forkno); + char *path = relpath(node, forkno); + if (present) elog(DEBUG1, "page %u of relation %s is uninitialized", blkno, path); @@ -132,7 +133,8 @@ forget_invalid_pages(RelFileNode node, ForkNumber forkno, BlockNumber minblkno) { if (log_min_messages <= DEBUG2 || client_min_messages <= DEBUG2) { - char *path = relpath(hentry->key.node, forkno); + char *path = relpath(hentry->key.node, forkno); + elog(DEBUG2, "page %u of relation %s has been dropped", hentry->key.blkno, path); pfree(path); @@ -164,7 +166,8 @@ forget_invalid_pages_db(Oid dbid) { if (log_min_messages <= DEBUG2 || client_min_messages <= DEBUG2) { - char *path = relpath(hentry->key.node, hentry->key.forkno); + char *path = relpath(hentry->key.node, hentry->key.forkno); + elog(DEBUG2, "page %u of relation %s has been dropped", hentry->key.blkno, path); pfree(path); @@ -197,7 +200,8 @@ XLogCheckInvalidPages(void) */ while ((hentry = (xl_invalid_page *) hash_seq_search(&status)) != NULL) { - char *path = relpath(hentry->key.node, hentry->key.forkno); + char *path = relpath(hentry->key.node, hentry->key.forkno); + if (hentry->present) elog(WARNING, "page %u of relation %s was uninitialized", hentry->key.blkno, path); @@ -237,7 +241,8 @@ XLogCheckInvalidPages(void) Buffer XLogReadBuffer(RelFileNode rnode, BlockNumber blkno, bool init) { - Buffer buf; + Buffer buf; + buf = XLogReadBufferExtended(rnode, MAIN_FORKNUM, blkno, init ? RBM_ZERO : RBM_NORMAL); if (BufferIsValid(buf)) @@ -344,8 +349,8 @@ XLogReadBufferExtended(RelFileNode rnode, ForkNumber forknum, */ typedef struct { - RelationData reldata; /* Note: this must be first */ - FormData_pg_class pgc; + RelationData reldata; /* Note: this must be first */ + FormData_pg_class pgc; } FakeRelCacheEntryData; typedef FakeRelCacheEntryData *FakeRelCacheEntry; @@ -354,10 +359,10 @@ typedef FakeRelCacheEntryData *FakeRelCacheEntry; * Create a fake relation cache entry for a physical relation * * It's often convenient to use the same functions in XLOG replay as in the - * main codepath, but those functions typically work with a relcache entry. - * We don't have a working relation cache during XLOG replay, but this - * function can be used to create a fake relcache entry instead. Only the - * fields related to physical storage, like rd_rel, are initialized, so the + * main codepath, but those functions typically work with a relcache entry. + * We don't have a working relation cache during XLOG replay, but this + * function can be used to create a fake relcache entry instead. Only the + * fields related to physical storage, like rd_rel, are initialized, so the * fake entry is only usable in low-level operations like ReadBuffer(). * * Caller must free the returned entry with FreeFakeRelcacheEntry(). @@ -366,7 +371,7 @@ Relation CreateFakeRelcacheEntry(RelFileNode rnode) { FakeRelCacheEntry fakeentry; - Relation rel; + Relation rel; /* Allocate the Relation struct and all related space in one block. */ fakeentry = palloc0(sizeof(FakeRelCacheEntryData)); @@ -381,9 +386,9 @@ CreateFakeRelcacheEntry(RelFileNode rnode) /* * We set up the lockRelId in case anything tries to lock the dummy * relation. Note that this is fairly bogus since relNode may be - * different from the relation's OID. It shouldn't really matter - * though, since we are presumably running by ourselves and can't have - * any lock conflicts ... + * different from the relation's OID. It shouldn't really matter though, + * since we are presumably running by ourselves and can't have any lock + * conflicts ... */ rel->rd_lockInfo.lockRelId.dbId = rnode.dbNode; rel->rd_lockInfo.lockRelId.relId = rnode.relNode; @@ -427,10 +432,9 @@ XLogDropDatabase(Oid dbid) { /* * This is unnecessarily heavy-handed, as it will close SMgrRelation - * objects for other databases as well. DROP DATABASE occurs seldom - * enough that it's not worth introducing a variant of smgrclose for - * just this purpose. XXX: Or should we rather leave the smgr entries - * dangling? + * objects for other databases as well. DROP DATABASE occurs seldom enough + * that it's not worth introducing a variant of smgrclose for just this + * purpose. XXX: Or should we rather leave the smgr entries dangling? */ smgrcloseall(); diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c index 2924dddf62..bb15e78d1c 100644 --- a/src/backend/catalog/aclchk.c +++ b/src/backend/catalog/aclchk.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.153 2009/02/06 21:15:11 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.154 2009/06/11 14:48:54 momjian Exp $ * * NOTES * See acl.h. @@ -62,13 +62,13 @@ static void ExecGrant_Tablespace(InternalGrant *grantStmt); static List *objectNamesToOids(GrantObjectType objtype, List *objnames); static void expand_col_privileges(List *colnames, Oid table_oid, - AclMode this_privileges, - AclMode *col_privileges, - int num_col_privileges); + AclMode this_privileges, + AclMode *col_privileges, + int num_col_privileges); static void expand_all_col_privileges(Oid table_oid, Form_pg_class classForm, - AclMode this_privileges, - AclMode *col_privileges, - int num_col_privileges); + AclMode this_privileges, + AclMode *col_privileges, + int num_col_privileges); static AclMode string_to_privilege(const char *privname); static const char *privilege_to_string(AclMode privilege); static AclMode restrict_and_check_grant(bool is_grant, AclMode avail_goptions, @@ -77,7 +77,7 @@ static AclMode restrict_and_check_grant(bool is_grant, AclMode avail_goptions, AclObjectKind objkind, const char *objname, AttrNumber att_number, const char *colname); static AclMode pg_aclmask(AclObjectKind objkind, Oid table_oid, AttrNumber attnum, - Oid roleid, AclMode mask, AclMaskHow how); + Oid roleid, AclMode mask, AclMaskHow how); #ifdef ACLDEBUG @@ -127,7 +127,7 @@ merge_acl_with_grant(Acl *old_acl, bool is_grant, AclItem aclitem; Acl *newer_acl; - aclitem.ai_grantee = lfirst_oid(j); + aclitem. ai_grantee = lfirst_oid(j); /* * Grant options can only be granted to individual roles, not PUBLIC. @@ -140,7 +140,7 @@ merge_acl_with_grant(Acl *old_acl, bool is_grant, (errcode(ERRCODE_INVALID_GRANT_OPERATION), errmsg("grant options can only be granted to roles"))); - aclitem.ai_grantor = grantorId; + aclitem. ai_grantor = grantorId; /* * The asymmetry in the conditions here comes from the spec. In @@ -314,8 +314,8 @@ ExecuteGrantStmt(GrantStmt *stmt) } /* - * Convert stmt->privileges, a list of AccessPriv nodes, into an - * AclMode bitmask. Note: objtype can't be ACL_OBJECT_COLUMN. + * Convert stmt->privileges, a list of AccessPriv nodes, into an AclMode + * bitmask. Note: objtype can't be ACL_OBJECT_COLUMN. */ switch (stmt->objtype) { @@ -389,8 +389,8 @@ ExecuteGrantStmt(GrantStmt *stmt) AclMode priv; /* - * If it's a column-level specification, we just set it aside - * in col_privs for the moment; but insist it's for a relation. + * If it's a column-level specification, we just set it aside in + * col_privs for the moment; but insist it's for a relation. */ if (privnode->cols) { @@ -402,7 +402,7 @@ ExecuteGrantStmt(GrantStmt *stmt) continue; } - if (privnode->priv_name == NULL) /* parser mistake? */ + if (privnode->priv_name == NULL) /* parser mistake? */ elog(ERROR, "AccessPriv node must specify privilege or columns"); priv = string_to_privilege(privnode->priv_name); @@ -421,7 +421,7 @@ ExecuteGrantStmt(GrantStmt *stmt) /* * ExecGrantStmt_oids * - * "Internal" entrypoint for granting and revoking privileges. This is + * "Internal" entrypoint for granting and revoking privileges. This is * exported for pg_shdepend.c to use in revoking privileges when dropping * a role. */ @@ -586,8 +586,8 @@ objectNamesToOids(GrantObjectType objtype, List *objnames) case ACL_OBJECT_FDW: foreach(cell, objnames) { - char *fdwname = strVal(lfirst(cell)); - Oid fdwid = GetForeignDataWrapperOidByName(fdwname, false); + char *fdwname = strVal(lfirst(cell)); + Oid fdwid = GetForeignDataWrapperOidByName(fdwname, false); objects = lappend_oid(objects, fdwid); } @@ -595,8 +595,8 @@ objectNamesToOids(GrantObjectType objtype, List *objnames) case ACL_OBJECT_FOREIGN_SERVER: foreach(cell, objnames) { - char *srvname = strVal(lfirst(cell)); - Oid srvid = GetForeignServerOidByName(srvname, false); + char *srvname = strVal(lfirst(cell)); + Oid srvid = GetForeignServerOidByName(srvname, false); objects = lappend_oid(objects, srvid); } @@ -637,7 +637,7 @@ expand_col_privileges(List *colnames, Oid table_oid, colname, get_rel_name(table_oid)))); attnum -= FirstLowInvalidHeapAttributeNumber; if (attnum <= 0 || attnum >= num_col_privileges) - elog(ERROR, "column number out of range"); /* safety check */ + elog(ERROR, "column number out of range"); /* safety check */ col_privileges[attnum] |= this_privileges; } } @@ -705,24 +705,24 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname, AttrNumber attnum, Oid ownerId, AclMode col_privileges, Relation attRelation, const Acl *old_rel_acl) { - HeapTuple attr_tuple; - Form_pg_attribute pg_attribute_tuple; - Acl *old_acl; - Acl *new_acl; - Acl *merged_acl; - Datum aclDatum; - bool isNull; - Oid grantorId; - AclMode avail_goptions; - bool need_update; - HeapTuple newtuple; - Datum values[Natts_pg_attribute]; - bool nulls[Natts_pg_attribute]; - bool replaces[Natts_pg_attribute]; - int noldmembers; - int nnewmembers; - Oid *oldmembers; - Oid *newmembers; + HeapTuple attr_tuple; + Form_pg_attribute pg_attribute_tuple; + Acl *old_acl; + Acl *new_acl; + Acl *merged_acl; + Datum aclDatum; + bool isNull; + Oid grantorId; + AclMode avail_goptions; + bool need_update; + HeapTuple newtuple; + Datum values[Natts_pg_attribute]; + bool nulls[Natts_pg_attribute]; + bool replaces[Natts_pg_attribute]; + int noldmembers; + int nnewmembers; + Oid *oldmembers; + Oid *newmembers; attr_tuple = SearchSysCache(ATTNUM, ObjectIdGetDatum(relOid), @@ -734,8 +734,8 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname, pg_attribute_tuple = (Form_pg_attribute) GETSTRUCT(attr_tuple); /* - * Get working copy of existing ACL. If there's no ACL, - * substitute the proper default. + * Get working copy of existing ACL. If there's no ACL, substitute the + * proper default. */ aclDatum = SysCacheGetAttr(ATTNUM, attr_tuple, Anum_pg_attribute_attacl, &isNull); @@ -747,8 +747,8 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname, /* * In select_best_grantor we should consider existing table-level ACL bits * as well as the per-column ACL. Build a new ACL that is their - * concatenation. (This is a bit cheap and dirty compared to merging - * them properly with no duplications, but it's all we need here.) + * concatenation. (This is a bit cheap and dirty compared to merging them + * properly with no duplications, but it's all we need here.) */ merged_acl = aclconcat(old_rel_acl, old_acl); @@ -760,12 +760,12 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname, pfree(merged_acl); /* - * Restrict the privileges to what we can actually grant, and emit - * the standards-mandated warning and error messages. Note: we don't - * track whether the user actually used the ALL PRIVILEGES(columns) - * syntax for each column; we just approximate it by whether all the - * possible privileges are specified now. Since the all_privs flag only - * determines whether a warning is issued, this seems close enough. + * Restrict the privileges to what we can actually grant, and emit the + * standards-mandated warning and error messages. Note: we don't track + * whether the user actually used the ALL PRIVILEGES(columns) syntax for + * each column; we just approximate it by whether all the possible + * privileges are specified now. Since the all_privs flag only determines + * whether a warning is issued, this seems close enough. */ col_privileges = restrict_and_check_grant(istmt->is_grant, avail_goptions, @@ -778,8 +778,8 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname, /* * Generate new ACL. * - * We need the members of both old and new ACLs so we can correct - * the shared dependency information. + * We need the members of both old and new ACLs so we can correct the + * shared dependency information. */ noldmembers = aclmembers(old_acl, &oldmembers); @@ -797,11 +797,11 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname, MemSet(replaces, false, sizeof(replaces)); /* - * If the updated ACL is empty, we can set attacl to null, and maybe - * even avoid an update of the pg_attribute row. This is worth testing - * because we'll come through here multiple times for any relation-level - * REVOKE, even if there were never any column GRANTs. Note we are - * assuming that the "default" ACL state for columns is empty. + * If the updated ACL is empty, we can set attacl to null, and maybe even + * avoid an update of the pg_attribute row. This is worth testing because + * we'll come through here multiple times for any relation-level REVOKE, + * even if there were never any column GRANTs. Note we are assuming that + * the "default" ACL state for columns is empty. */ if (ACL_NUM(new_acl) > 0) { @@ -857,7 +857,7 @@ ExecGrant_Relation(InternalGrant *istmt) Form_pg_class pg_class_tuple; bool isNull; AclMode this_privileges; - AclMode *col_privileges; + AclMode *col_privileges; int num_col_privileges; bool have_col_privileges; Acl *old_acl; @@ -954,7 +954,7 @@ ExecGrant_Relation(InternalGrant *istmt) /* * Set up array in which we'll accumulate any column privilege bits - * that need modification. The array is indexed such that entry [0] + * that need modification. The array is indexed such that entry [0] * corresponds to FirstLowInvalidHeapAttributeNumber. */ num_col_privileges = pg_class_tuple->relnatts - FirstLowInvalidHeapAttributeNumber + 1; @@ -1025,7 +1025,7 @@ ExecGrant_Relation(InternalGrant *istmt) restrict_and_check_grant(istmt->is_grant, avail_goptions, istmt->all_privs, this_privileges, relOid, grantorId, - pg_class_tuple->relkind == RELKIND_SEQUENCE + pg_class_tuple->relkind == RELKIND_SEQUENCE ? ACL_KIND_SEQUENCE : ACL_KIND_CLASS, NameStr(pg_class_tuple->relname), 0, NULL); @@ -1081,7 +1081,7 @@ ExecGrant_Relation(InternalGrant *istmt) */ foreach(cell_colprivs, istmt->col_privs) { - AccessPriv *col_privs = (AccessPriv *) lfirst(cell_colprivs); + AccessPriv *col_privs = (AccessPriv *) lfirst(cell_colprivs); if (col_privs->priv_name == NULL) this_privileges = ACL_ALL_RIGHTS_COLUMN; @@ -1099,8 +1099,8 @@ ExecGrant_Relation(InternalGrant *istmt) { /* * The only column privilege allowed on sequences is SELECT. - * This is a warning not error because we do it that way - * for relation-level privileges. + * This is a warning not error because we do it that way for + * relation-level privileges. */ ereport(WARNING, (errcode(ERRCODE_INVALID_GRANT_OPERATION), @@ -1119,7 +1119,7 @@ ExecGrant_Relation(InternalGrant *istmt) if (have_col_privileges) { - AttrNumber i; + AttrNumber i; for (i = 0; i < num_col_privileges; i++) { @@ -1385,7 +1385,8 @@ ExecGrant_Fdw(InternalGrant *istmt) heap_close(relation, RowExclusiveLock); } -static void ExecGrant_ForeignServer(InternalGrant *istmt) +static void +ExecGrant_ForeignServer(InternalGrant *istmt) { Relation relation; ListCell *cell; @@ -1450,7 +1451,7 @@ static void ExecGrant_ForeignServer(InternalGrant *istmt) this_privileges = restrict_and_check_grant(istmt->is_grant, avail_goptions, istmt->all_privs, istmt->privileges, - srvid, grantorId, ACL_KIND_FOREIGN_SERVER, + srvid, grantorId, ACL_KIND_FOREIGN_SERVER, NameStr(pg_server_tuple->srvname), 0, NULL); @@ -2274,7 +2275,7 @@ pg_aclmask(AclObjectKind objkind, Oid table_oid, AttrNumber attnum, Oid roleid, * * Note: this considers only privileges granted specifically on the column. * It is caller's responsibility to take relation-level privileges into account - * as appropriate. (For the same reason, we have no special case for + * as appropriate. (For the same reason, we have no special case for * superuser-ness here.) */ AclMode @@ -2316,9 +2317,9 @@ pg_attribute_aclmask(Oid table_oid, AttrNumber attnum, Oid roleid, &isNull); /* - * Here we hard-wire knowledge that the default ACL for a column - * grants no privileges, so that we can fall out quickly in the - * very common case where attacl is null. + * Here we hard-wire knowledge that the default ACL for a column grants no + * privileges, so that we can fall out quickly in the very common case + * where attacl is null. */ if (isNull) { @@ -2328,11 +2329,11 @@ pg_attribute_aclmask(Oid table_oid, AttrNumber attnum, Oid roleid, /* * Must get the relation's ownerId from pg_class. Since we already found - * a pg_attribute entry, the only likely reason for this to fail is that - * a concurrent DROP of the relation committed since then (which could - * only happen if we don't have lock on the relation). We prefer to - * report "no privileges" rather than failing in such a case, so as to - * avoid unwanted failures in has_column_privilege() tests. + * a pg_attribute entry, the only likely reason for this to fail is that a + * concurrent DROP of the relation committed since then (which could only + * happen if we don't have lock on the relation). We prefer to report "no + * privileges" rather than failing in such a case, so as to avoid unwanted + * failures in has_column_privilege() tests. */ classTuple = SearchSysCache(RELOID, ObjectIdGetDatum(table_oid), @@ -2804,7 +2805,7 @@ pg_foreign_data_wrapper_aclmask(Oid fdw_oid, Oid roleid, 0, 0, 0); if (!HeapTupleIsValid(tuple)) ereport(ERROR, - (errmsg("foreign-data wrapper with OID %u does not exist", + (errmsg("foreign-data wrapper with OID %u does not exist", fdw_oid))); fdwForm = (Form_pg_foreign_data_wrapper) GETSTRUCT(tuple); @@ -2844,7 +2845,7 @@ pg_foreign_data_wrapper_aclmask(Oid fdw_oid, Oid roleid, */ AclMode pg_foreign_server_aclmask(Oid srv_oid, Oid roleid, - AclMode mask, AclMaskHow how) + AclMode mask, AclMaskHow how) { AclMode result; HeapTuple tuple; @@ -2867,7 +2868,7 @@ pg_foreign_server_aclmask(Oid srv_oid, Oid roleid, 0, 0, 0); if (!HeapTupleIsValid(tuple)) ereport(ERROR, - (errmsg("foreign server with OID %u does not exist", + (errmsg("foreign server with OID %u does not exist", srv_oid))); srvForm = (Form_pg_foreign_server) GETSTRUCT(tuple); @@ -2944,16 +2945,16 @@ AclResult pg_attribute_aclcheck_all(Oid table_oid, Oid roleid, AclMode mode, AclMaskHow how) { - AclResult result; - HeapTuple classTuple; - Form_pg_class classForm; - AttrNumber nattrs; - AttrNumber curr_att; + AclResult result; + HeapTuple classTuple; + Form_pg_class classForm; + AttrNumber nattrs; + AttrNumber curr_att; /* * Must fetch pg_class row to check number of attributes. As in - * pg_attribute_aclmask, we prefer to return "no privileges" instead - * of throwing an error if we get any unexpected lookup errors. + * pg_attribute_aclmask, we prefer to return "no privileges" instead of + * throwing an error if we get any unexpected lookup errors. */ classTuple = SearchSysCache(RELOID, ObjectIdGetDatum(table_oid), @@ -2967,8 +2968,8 @@ pg_attribute_aclcheck_all(Oid table_oid, Oid roleid, AclMode mode, ReleaseSysCache(classTuple); /* - * Initialize result in case there are no non-dropped columns. We want - * to report failure in such cases for either value of 'how'. + * Initialize result in case there are no non-dropped columns. We want to + * report failure in such cases for either value of 'how'. */ result = ACLCHECK_NO_PRIV; @@ -2993,8 +2994,8 @@ pg_attribute_aclcheck_all(Oid table_oid, Oid roleid, AclMode mode, /* * Here we hard-wire knowledge that the default ACL for a column - * grants no privileges, so that we can fall out quickly in the - * very common case where attacl is null. + * grants no privileges, so that we can fall out quickly in the very + * common case where attacl is null. */ if (heap_attisnull(attTuple, Anum_pg_attribute_attacl)) attmask = 0; @@ -3466,8 +3467,8 @@ pg_foreign_server_ownercheck(Oid srv_oid, Oid roleid) if (!HeapTupleIsValid(tuple)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("foreign server with OID %u does not exist", - srv_oid))); + errmsg("foreign server with OID %u does not exist", + srv_oid))); ownerId = ((Form_pg_foreign_server) GETSTRUCT(tuple))->srvowner; diff --git a/src/backend/catalog/catalog.c b/src/backend/catalog/catalog.c index a4a527f963..42371d5137 100644 --- a/src/backend/catalog/catalog.c +++ b/src/backend/catalog/catalog.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.82 2009/03/25 14:11:48 petere Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.83 2009/06/11 14:48:54 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -42,8 +42,8 @@ #include "utils/tqual.h" -#define OIDCHARS 10 /* max chars printed by %u */ -#define FORKNAMECHARS 4 /* max chars for a fork name */ +#define OIDCHARS 10 /* max chars printed by %u */ +#define FORKNAMECHARS 4 /* max chars for a fork name */ /* * Lookup table of fork name by fork number. @@ -53,9 +53,9 @@ * up-to-date. */ const char *forkNames[] = { - "main", /* MAIN_FORKNUM */ - "fsm", /* FSM_FORKNUM */ - "vm" /* VISIBILITYMAP_FORKNUM */ + "main", /* MAIN_FORKNUM */ + "fsm", /* FSM_FORKNUM */ + "vm" /* VISIBILITYMAP_FORKNUM */ }; /* @@ -64,7 +64,7 @@ const char *forkNames[] = { ForkNumber forkname_to_number(char *forkName) { - ForkNumber forkNum; + ForkNumber forkNum; for (forkNum = 0; forkNum <= MAX_FORKNUM; forkNum++) if (strcmp(forkNames[forkNum], forkName) == 0) @@ -74,7 +74,7 @@ forkname_to_number(char *forkName) (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("invalid fork name"), errhint("Valid fork names are \"main\", \"fsm\", and \"vm\"."))); - return InvalidForkNumber; /* keep compiler quiet */ + return InvalidForkNumber; /* keep compiler quiet */ } /* @@ -407,7 +407,7 @@ GetNewOidWithIndex(Relation relation, Oid indexId, AttrNumber oidcolumn) { Oid newOid; SnapshotData SnapshotDirty; - SysScanDesc scan; + SysScanDesc scan; ScanKeyData key; bool collides; diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c index 377ae8b712..8181cae64a 100644 --- a/src/backend/catalog/dependency.c +++ b/src/backend/catalog/dependency.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.88 2009/06/04 18:33:06 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.89 2009/06/11 14:48:54 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -94,7 +94,7 @@ typedef struct struct ObjectAddresses { ObjectAddress *refs; /* => palloc'd array */ - ObjectAddressExtra *extras; /* => palloc'd array, or NULL if not used */ + ObjectAddressExtra *extras; /* => palloc'd array, or NULL if not used */ int numrefs; /* current number of references */ int maxrefs; /* current size of palloc'd array(s) */ }; @@ -104,9 +104,9 @@ struct ObjectAddresses /* threaded list of ObjectAddresses, for recursion detection */ typedef struct ObjectAddressStack { - const ObjectAddress *object; /* object being visited */ + const ObjectAddress *object; /* object being visited */ int flags; /* its current flag bits */ - struct ObjectAddressStack *next; /* next outer stack level */ + struct ObjectAddressStack *next; /* next outer stack level */ } ObjectAddressStack; /* for find_expr_references_walker */ @@ -171,8 +171,8 @@ static void add_exact_object_address_extra(const ObjectAddress *object, const ObjectAddressExtra *extra, ObjectAddresses *addrs); static bool object_address_present_add_flags(const ObjectAddress *object, - int flags, - ObjectAddresses *addrs); + int flags, + ObjectAddresses *addrs); static void getRelationDescription(StringInfo buffer, Oid relid); static void getOpFamilyDescription(StringInfo buffer, Oid opfid); @@ -204,7 +204,7 @@ performDeletion(const ObjectAddress *object, depRel = heap_open(DependRelationId, RowExclusiveLock); /* - * Acquire deletion lock on the target object. (Ideally the caller has + * Acquire deletion lock on the target object. (Ideally the caller has * done this already, but many places are sloppy about it.) */ AcquireDeletionLock(object); @@ -276,10 +276,10 @@ performMultipleDeletions(const ObjectAddresses *objects, /* * Construct a list of objects to delete (ie, the given objects plus * everything directly or indirectly dependent on them). Note that - * because we pass the whole objects list as pendingObjects context, - * we won't get a failure from trying to delete an object that is - * internally dependent on another one in the list; we'll just skip - * that object and delete it when we reach its owner. + * because we pass the whole objects list as pendingObjects context, we + * won't get a failure from trying to delete an object that is internally + * dependent on another one in the list; we'll just skip that object and + * delete it when we reach its owner. */ targetObjects = new_object_addresses(); @@ -295,7 +295,7 @@ performMultipleDeletions(const ObjectAddresses *objects, findDependentObjects(thisobj, DEPFLAG_ORIGINAL, - NULL, /* empty stack */ + NULL, /* empty stack */ targetObjects, objects, depRel); @@ -304,8 +304,8 @@ performMultipleDeletions(const ObjectAddresses *objects, /* * Check if deletion is allowed, and report about cascaded deletes. * - * If there's exactly one object being deleted, report it the same - * way as in performDeletion(), else we have to be vaguer. + * If there's exactly one object being deleted, report it the same way as + * in performDeletion(), else we have to be vaguer. */ reportDependentObjects(targetObjects, behavior, @@ -352,7 +352,7 @@ deleteWhatDependsOn(const ObjectAddress *object, depRel = heap_open(DependRelationId, RowExclusiveLock); /* - * Acquire deletion lock on the target object. (Ideally the caller has + * Acquire deletion lock on the target object. (Ideally the caller has * done this already, but many places are sloppy about it.) */ AcquireDeletionLock(object); @@ -404,7 +404,7 @@ deleteWhatDependsOn(const ObjectAddress *object, * * For every object that depends on the starting object, acquire a deletion * lock on the object, add it to targetObjects (if not already there), - * and recursively find objects that depend on it. An object's dependencies + * and recursively find objects that depend on it. An object's dependencies * will be placed into targetObjects before the object itself; this means * that the finished list's order represents a safe deletion order. * @@ -446,8 +446,8 @@ findDependentObjects(const ObjectAddress *object, /* * If the target object is already being visited in an outer recursion - * level, just report the current flags back to that level and exit. - * This is needed to avoid infinite recursion in the face of circular + * level, just report the current flags back to that level and exit. This + * is needed to avoid infinite recursion in the face of circular * dependencies. * * The stack check alone would result in dependency loops being broken at @@ -457,7 +457,7 @@ findDependentObjects(const ObjectAddress *object, * will not break a loop at an internal dependency: if we enter the loop * at an "owned" object we will switch and start at the "owning" object * instead. We could probably hack something up to avoid breaking at an - * auto dependency, too, if we had to. However there are no known cases + * auto dependency, too, if we had to. However there are no known cases * where that would be necessary. */ for (stackptr = stack; stackptr; stackptr = stackptr->next) @@ -470,6 +470,7 @@ findDependentObjects(const ObjectAddress *object, stackptr->flags |= flags; return; } + /* * Could visit column with whole table already on stack; this is * the same case noted in object_address_present_add_flags(). @@ -487,8 +488,8 @@ findDependentObjects(const ObjectAddress *object, * specified flags to its entry and return. * * (Note: in these early-exit cases we could release the caller-taken - * lock, since the object is presumably now locked multiple times; - * but it seems not worth the cycles.) + * lock, since the object is presumably now locked multiple times; but it + * seems not worth the cycles.) */ if (object_address_present_add_flags(object, flags, targetObjects)) return; @@ -499,7 +500,7 @@ findDependentObjects(const ObjectAddress *object, * object, we have to transform this deletion request into a deletion * request of the owning object. (We'll eventually recurse back to this * object, but the owning object has to be visited first so it will be - * deleted after.) The way to find out about this is to scan the + * deleted after.) The way to find out about this is to scan the * pg_depend entries that show what this object depends on. */ ScanKeyInit(&key[0], @@ -546,10 +547,10 @@ findDependentObjects(const ObjectAddress *object, * * 1. At the outermost recursion level, disallow the DROP. (We * just ereport here, rather than proceeding, since no other - * dependencies are likely to be interesting.) However, if + * dependencies are likely to be interesting.) However, if * the other object is listed in pendingObjects, just release - * the caller's lock and return; we'll eventually complete - * the DROP when we reach that entry in the pending list. + * the caller's lock and return; we'll eventually complete the + * DROP when we reach that entry in the pending list. */ if (stack == NULL) { @@ -597,8 +598,8 @@ findDependentObjects(const ObjectAddress *object, AcquireDeletionLock(&otherObject); /* - * The other object might have been deleted while we waited - * to lock it; if so, neither it nor the current object are + * The other object might have been deleted while we waited to + * lock it; if so, neither it nor the current object are * interesting anymore. We test this by checking the * pg_depend entry (see notes below). */ @@ -610,10 +611,10 @@ findDependentObjects(const ObjectAddress *object, } /* - * Okay, recurse to the other object instead of proceeding. - * We treat this exactly as if the original reference had - * linked to that object instead of this one; hence, pass - * through the same flags and stack. + * Okay, recurse to the other object instead of proceeding. We + * treat this exactly as if the original reference had linked + * to that object instead of this one; hence, pass through the + * same flags and stack. */ findDependentObjects(&otherObject, flags, @@ -643,8 +644,8 @@ findDependentObjects(const ObjectAddress *object, systable_endscan(scan); /* - * Now recurse to any dependent objects. We must visit them first - * since they have to be deleted before the current object. + * Now recurse to any dependent objects. We must visit them first since + * they have to be deleted before the current object. */ mystack.object = object; /* set up a new stack level */ mystack.flags = flags; @@ -675,7 +676,7 @@ findDependentObjects(const ObjectAddress *object, while (HeapTupleIsValid(tup = systable_getnext(scan))) { Form_pg_depend foundDep = (Form_pg_depend) GETSTRUCT(tup); - int subflags; + int subflags; otherObject.classId = foundDep->classid; otherObject.objectId = foundDep->objid; @@ -687,11 +688,11 @@ findDependentObjects(const ObjectAddress *object, AcquireDeletionLock(&otherObject); /* - * The dependent object might have been deleted while we waited - * to lock it; if so, we don't need to do anything more with it. - * We can test this cheaply and independently of the object's type - * by seeing if the pg_depend tuple we are looking at is still live. - * (If the object got deleted, the tuple would have been deleted too.) + * The dependent object might have been deleted while we waited to + * lock it; if so, we don't need to do anything more with it. We can + * test this cheaply and independently of the object's type by seeing + * if the pg_depend tuple we are looking at is still live. (If the + * object got deleted, the tuple would have been deleted too.) */ if (!systable_recheck_tuple(scan, tup)) { @@ -743,9 +744,9 @@ findDependentObjects(const ObjectAddress *object, systable_endscan(scan); /* - * Finally, we can add the target object to targetObjects. Be careful - * to include any flags that were passed back down to us from inner - * recursion levels. + * Finally, we can add the target object to targetObjects. Be careful to + * include any flags that were passed back down to us from inner recursion + * levels. */ extra.flags = mystack.flags; if (stack) @@ -782,8 +783,8 @@ reportDependentObjects(const ObjectAddresses *targetObjects, int i; /* - * If no error is to be thrown, and the msglevel is too low to be shown - * to either client or server log, there's no need to do any of the work. + * If no error is to be thrown, and the msglevel is too low to be shown to + * either client or server log, there's no need to do any of the work. * * Note: this code doesn't know all there is to be known about elog * levels, but it works for NOTICE and DEBUG2, which are the only values @@ -822,16 +823,16 @@ reportDependentObjects(const ObjectAddresses *targetObjects, objDesc = getObjectDescription(obj); /* - * If, at any stage of the recursive search, we reached the object - * via an AUTO or INTERNAL dependency, then it's okay to delete it - * even in RESTRICT mode. + * If, at any stage of the recursive search, we reached the object via + * an AUTO or INTERNAL dependency, then it's okay to delete it even in + * RESTRICT mode. */ if (extra->flags & (DEPFLAG_AUTO | DEPFLAG_INTERNAL)) { /* - * auto-cascades are reported at DEBUG2, not msglevel. We - * don't try to combine them with the regular message because - * the results are too confusing when client_min_messages and + * auto-cascades are reported at DEBUG2, not msglevel. We don't + * try to combine them with the regular message because the + * results are too confusing when client_min_messages and * log_min_messages are different. */ ereport(DEBUG2, @@ -840,7 +841,7 @@ reportDependentObjects(const ObjectAddresses *targetObjects, } else if (behavior == DROP_RESTRICT) { - char *otherDesc = getObjectDescription(&extra->dependee); + char *otherDesc = getObjectDescription(&extra->dependee); if (numReportedClient < MAX_REPORTED_DEPS) { @@ -897,8 +898,8 @@ reportDependentObjects(const ObjectAddresses *targetObjects, if (origObject) ereport(ERROR, (errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST), - errmsg("cannot drop %s because other objects depend on it", - getObjectDescription(origObject)), + errmsg("cannot drop %s because other objects depend on it", + getObjectDescription(origObject)), errdetail("%s", clientdetail.data), errdetail_log("%s", logdetail.data), errhint("Use DROP ... CASCADE to drop the dependent objects too."))); @@ -913,7 +914,7 @@ reportDependentObjects(const ObjectAddresses *targetObjects, else if (numReportedClient > 1) { ereport(msglevel, - /* translator: %d always has a value larger than 1 */ + /* translator: %d always has a value larger than 1 */ (errmsg_plural("drop cascades to %d other object", "drop cascades to %d other objects", numReportedClient + numNotReportedClient, @@ -947,7 +948,7 @@ deleteOneObject(const ObjectAddress *object, Relation depRel) /* * First remove any pg_depend records that link from this object to - * others. (Any records linking to this object should be gone already.) + * others. (Any records linking to this object should be gone already.) * * When dropping a whole object (subId = 0), remove all pg_depend records * for its sub-objects too. @@ -982,8 +983,8 @@ deleteOneObject(const ObjectAddress *object, Relation depRel) systable_endscan(scan); /* - * Delete shared dependency references related to this object. Again, - * if subId = 0, remove records for sub-objects too. + * Delete shared dependency references related to this object. Again, if + * subId = 0, remove records for sub-objects too. */ deleteSharedDependencyRecordsFor(object->classId, object->objectId, object->objectSubId); @@ -1651,9 +1652,9 @@ eliminate_duplicate_dependencies(ObjectAddresses *addrs) newrefs; /* - * We can't sort if the array has "extra" data, because there's no way - * to keep it in sync. Fortunately that combination of features is - * not needed. + * We can't sort if the array has "extra" data, because there's no way to + * keep it in sync. Fortunately that combination of features is not + * needed. */ Assert(!addrs->extras); @@ -1828,7 +1829,7 @@ add_exact_object_address_extra(const ObjectAddress *object, addrs->refs = (ObjectAddress *) repalloc(addrs->refs, addrs->maxrefs * sizeof(ObjectAddress)); addrs->extras = (ObjectAddressExtra *) - repalloc(addrs->extras, addrs->maxrefs * sizeof(ObjectAddressExtra)); + repalloc(addrs->extras, addrs->maxrefs * sizeof(ObjectAddressExtra)); } /* record this item */ item = addrs->refs + addrs->numrefs; @@ -1894,7 +1895,7 @@ object_address_present_add_flags(const ObjectAddress *object, { /* * We get here if we find a need to delete a column after - * having already decided to drop its whole table. Obviously + * having already decided to drop its whole table. Obviously * we no longer need to drop the column. But don't plaster * its flags on the table. */ @@ -2136,7 +2137,7 @@ getObjectDescription(const ObjectAddress *object) if (OidIsValid(con->conrelid)) { - StringInfoData rel; + StringInfoData rel; initStringInfo(&rel); getRelationDescription(&rel, con->conrelid); @@ -2304,10 +2305,11 @@ getObjectDescription(const ObjectAddress *object) initStringInfo(&opfam); getOpFamilyDescription(&opfam, amopForm->amopfamily); + /* * translator: %d is the operator strategy (a number), the - * first %s is the textual form of the operator, and the second - * %s is the description of the operator family. + * first %s is the textual form of the operator, and the + * second %s is the description of the operator family. */ appendStringInfo(&buffer, _("operator %d %s of %s"), amopForm->amopstrategy, @@ -2350,6 +2352,7 @@ getObjectDescription(const ObjectAddress *object) initStringInfo(&opfam); getOpFamilyDescription(&opfam, amprocForm->amprocfamily); + /* * translator: %d is the function number, the first %s is the * textual form of the function with arguments, and the second @@ -2563,9 +2566,9 @@ getObjectDescription(const ObjectAddress *object) case OCLASS_USER_MAPPING: { - HeapTuple tup; - Oid useid; - char *usename; + HeapTuple tup; + Oid useid; + char *usename; tup = SearchSysCache(USERMAPPINGOID, ObjectIdGetDatum(object->objectId), diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index bc03ef6033..f4cf829b46 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.353 2009/04/19 19:46:32 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.354 2009/06/11 14:48:54 momjian Exp $ * * * INTERFACE ROUTINES @@ -83,10 +83,10 @@ static Oid AddNewRelationType(const char *typeName, Oid new_array_type); static void RelationRemoveInheritance(Oid relid); static void StoreRelCheck(Relation rel, char *ccname, Node *expr, - bool is_local, int inhcount); + bool is_local, int inhcount); static void StoreConstraints(Relation rel, List *cooked_constraints); static bool MergeWithExistingConstraint(Relation rel, char *ccname, Node *expr, - bool allow_merge, bool is_local); + bool allow_merge, bool is_local); static void SetRelationNumChecks(Relation rel, int numchecks); static Node *cookConstraint(ParseState *pstate, Node *raw_constraint, @@ -113,37 +113,37 @@ static List *insert_ordered_unique_oid(List *list, Oid datum); static FormData_pg_attribute a1 = { 0, {"ctid"}, TIDOID, 0, sizeof(ItemPointerData), SelfItemPointerAttributeNumber, 0, -1, -1, - false, 'p', 's', true, false, false, true, 0, { 0 } + false, 'p', 's', true, false, false, true, 0, {0} }; static FormData_pg_attribute a2 = { 0, {"oid"}, OIDOID, 0, sizeof(Oid), ObjectIdAttributeNumber, 0, -1, -1, - true, 'p', 'i', true, false, false, true, 0, { 0 } + true, 'p', 'i', true, false, false, true, 0, {0} }; static FormData_pg_attribute a3 = { 0, {"xmin"}, XIDOID, 0, sizeof(TransactionId), MinTransactionIdAttributeNumber, 0, -1, -1, - true, 'p', 'i', true, false, false, true, 0, { 0 } + true, 'p', 'i', true, false, false, true, 0, {0} }; static FormData_pg_attribute a4 = { 0, {"cmin"}, CIDOID, 0, sizeof(CommandId), MinCommandIdAttributeNumber, 0, -1, -1, - true, 'p', 'i', true, false, false, true, 0, { 0 } + true, 'p', 'i', true, false, false, true, 0, {0} }; static FormData_pg_attribute a5 = { 0, {"xmax"}, XIDOID, 0, sizeof(TransactionId), MaxTransactionIdAttributeNumber, 0, -1, -1, - true, 'p', 'i', true, false, false, true, 0, { 0 } + true, 'p', 'i', true, false, false, true, 0, {0} }; static FormData_pg_attribute a6 = { 0, {"cmax"}, CIDOID, 0, sizeof(CommandId), MaxCommandIdAttributeNumber, 0, -1, -1, - true, 'p', 'i', true, false, false, true, 0, { 0 } + true, 'p', 'i', true, false, false, true, 0, {0} }; /* @@ -155,7 +155,7 @@ static FormData_pg_attribute a6 = { static FormData_pg_attribute a7 = { 0, {"tableoid"}, OIDOID, 0, sizeof(Oid), TableOidAttributeNumber, 0, -1, -1, - true, 'p', 'i', true, false, false, true, 0, { 0 } + true, 'p', 'i', true, false, false, true, 0, {0} }; static const Form_pg_attribute SysAtt[] = {&a1, &a2, &a3, &a4, &a5, &a6, &a7}; @@ -478,7 +478,7 @@ CheckAttributeType(const char *attname, Oid atttypid) * Caller has already opened and locked pg_attribute. new_attribute is the * attribute to insert (but we ignore its attacl, if indeed it has one). * - * indstate is the index state for CatalogIndexInsert. It can be passed as + * indstate is the index state for CatalogIndexInsert. It can be passed as * NULL, in which case we'll fetch the necessary info. (Don't do this when * inserting multiple attributes, because it's a tad more expensive.) * @@ -530,6 +530,7 @@ InsertPgAttributeTuple(Relation pg_attribute_rel, heap_freetuple(tup); } + /* -------------------------------- * AddNewAttributeTuples * @@ -798,7 +799,7 @@ AddNewRelationType(const char *typeName, ownerid, /* owner's ID */ -1, /* internal size (varlena) */ TYPTYPE_COMPOSITE, /* type-type (composite) */ - TYPCATEGORY_COMPOSITE, /* type-category (ditto) */ + TYPCATEGORY_COMPOSITE, /* type-category (ditto) */ false, /* composite types are never preferred */ DEFAULT_TYPDELIM, /* default array delimiter */ F_RECORD_IN, /* input procedure */ @@ -979,7 +980,7 @@ heap_create_with_catalog(const char *relname, ownerid, /* owner's ID */ -1, /* Internal size (varlena) */ TYPTYPE_BASE, /* Not composite - typelem is */ - TYPCATEGORY_ARRAY, /* type-category (array) */ + TYPCATEGORY_ARRAY, /* type-category (array) */ false, /* array types are never preferred */ DEFAULT_TYPDELIM, /* default array delimiter */ F_ARRAY_IN, /* array input proc */ @@ -1671,8 +1672,8 @@ StoreRelCheck(Relation rel, char *ccname, Node *expr, expr, /* Tree form check constraint */ ccbin, /* Binary form check constraint */ ccsrc, /* Source form check constraint */ - is_local, /* conislocal */ - inhcount); /* coninhcount */ + is_local, /* conislocal */ + inhcount); /* coninhcount */ pfree(ccbin); pfree(ccsrc); @@ -1889,10 +1890,10 @@ AddRelationNewConstraints(Relation rel, checknames = lappend(checknames, ccname); /* - * Check against pre-existing constraints. If we are allowed - * to merge with an existing constraint, there's no more to - * do here. (We omit the duplicate constraint from the result, - * which is what ATAddCheckConstraint wants.) + * Check against pre-existing constraints. If we are allowed to + * merge with an existing constraint, there's no more to do here. + * (We omit the duplicate constraint from the result, which is + * what ATAddCheckConstraint wants.) */ if (MergeWithExistingConstraint(rel, ccname, expr, allow_merge, is_local)) @@ -2010,8 +2011,8 @@ MergeWithExistingConstraint(Relation rel, char *ccname, Node *expr, /* Found it. Conflicts if not identical check constraint */ if (con->contype == CONSTRAINT_CHECK) { - Datum val; - bool isnull; + Datum val; + bool isnull; val = fastgetattr(tup, Anum_pg_constraint_conbin, @@ -2029,8 +2030,8 @@ MergeWithExistingConstraint(Relation rel, char *ccname, Node *expr, ccname, RelationGetRelationName(rel)))); /* OK to update the tuple */ ereport(NOTICE, - (errmsg("merging constraint \"%s\" with inherited definition", - ccname))); + (errmsg("merging constraint \"%s\" with inherited definition", + ccname))); tup = heap_copytuple(tup); con = (Form_pg_constraint) GETSTRUCT(tup); if (is_local) @@ -2152,7 +2153,7 @@ cookDefault(ParseState *pstate, if (pstate->p_hasWindowFuncs) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), - errmsg("cannot use window function in default expression"))); + errmsg("cannot use window function in default expression"))); /* * Coerce the expression to the correct type and typmod, if given. This @@ -2212,8 +2213,8 @@ cookConstraint(ParseState *pstate, if (list_length(pstate->p_rtable) != 1) ereport(ERROR, (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), - errmsg("only table \"%s\" can be referenced in check constraint", - relname))); + errmsg("only table \"%s\" can be referenced in check constraint", + relname))); /* * No subplans or aggregates, either... @@ -2225,7 +2226,7 @@ cookConstraint(ParseState *pstate, if (pstate->p_hasAggs) ereport(ERROR, (errcode(ERRCODE_GROUPING_ERROR), - errmsg("cannot use aggregate function in check constraint"))); + errmsg("cannot use aggregate function in check constraint"))); if (pstate->p_hasWindowFuncs) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1e19cbff31..b75aac04e1 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.317 2009/06/06 22:13:51 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.318 2009/06/11 14:48:55 momjian Exp $ * * * INTERFACE ROUTINES @@ -745,8 +745,8 @@ index_create(Oid heapRelationId, NULL, /* no check constraint */ NULL, NULL, - true, /* islocal */ - 0); /* inhcount */ + true, /* islocal */ + 0); /* inhcount */ referenced.classId = ConstraintRelationId; referenced.objectId = conOid; @@ -1383,8 +1383,8 @@ index_build(Relation heapRelation, Assert(RegProcedureIsValid(procedure)); /* - * Switch to the table owner's userid, so that any index functions are - * run as that user. + * Switch to the table owner's userid, so that any index functions are run + * as that user. */ GetUserIdAndContext(&save_userid, &save_secdefcxt); SetUserIdAndContext(heapRelation->rd_rel->relowner, true); @@ -1544,9 +1544,9 @@ IndexBuildHeapScan(Relation heapRelation, scan = heap_beginscan_strat(heapRelation, /* relation */ snapshot, /* snapshot */ - 0, /* number of keys */ - NULL, /* scan key */ - true, /* buffer access strategy OK */ + 0, /* number of keys */ + NULL, /* scan key */ + true, /* buffer access strategy OK */ allow_sync); /* syncscan OK? */ reltuples = 0; @@ -1926,8 +1926,8 @@ validate_index(Oid heapId, Oid indexId, Snapshot snapshot) indexInfo->ii_Concurrent = true; /* - * Switch to the table owner's userid, so that any index functions are - * run as that user. + * Switch to the table owner's userid, so that any index functions are run + * as that user. */ GetUserIdAndContext(&save_userid, &save_secdefcxt); SetUserIdAndContext(heapRelation->rd_rel->relowner, true); @@ -2050,10 +2050,10 @@ validate_index_heapscan(Relation heapRelation, */ scan = heap_beginscan_strat(heapRelation, /* relation */ snapshot, /* snapshot */ - 0, /* number of keys */ - NULL, /* scan key */ - true, /* buffer access strategy OK */ - false); /* syncscan not OK */ + 0, /* number of keys */ + NULL, /* scan key */ + true, /* buffer access strategy OK */ + false); /* syncscan not OK */ /* * Scan all tuples matching the snapshot. @@ -2267,11 +2267,11 @@ reindex_index(Oid indexId) if (RELATION_IS_OTHER_TEMP(iRel)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot reindex temporary tables of other sessions"))); + errmsg("cannot reindex temporary tables of other sessions"))); /* - * Also check for active uses of the index in the current transaction; - * we don't want to reindex underneath an open indexscan. + * Also check for active uses of the index in the current transaction; we + * don't want to reindex underneath an open indexscan. */ CheckTableNotInUse(iRel, "REINDEX INDEX"); diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c index f38568bed8..12cb1720cd 100644 --- a/src/backend/catalog/namespace.c +++ b/src/backend/catalog/namespace.c @@ -13,7 +13,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.117 2009/03/31 22:12:46 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.118 2009/06/11 14:48:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -573,7 +573,7 @@ TypeIsVisible(Oid typid) * and the returned nvargs will always be zero. * * If expand_defaults is true, functions that could match after insertion of - * default argument values will also be retrieved. In this case the returned + * default argument values will also be retrieved. In this case the returned * structs could have nargs > passed-in nargs, and ndargs is set to the number * of additional args (which can be retrieved from the function's * proargdefaults entry). @@ -726,7 +726,7 @@ FuncnameGetCandidates(List *names, int nargs, pronargs * sizeof(Oid)); if (variadic) { - int i; + int i; newResult->nvargs = effective_nargs - pronargs + 1; /* Expand variadic argument into N copies of element type */ @@ -774,7 +774,7 @@ FuncnameGetCandidates(List *names, int nargs, } else { - int cmp_nargs = newResult->nargs - newResult->ndargs; + int cmp_nargs = newResult->nargs - newResult->ndargs; for (prevResult = resultList; prevResult; @@ -791,13 +791,13 @@ FuncnameGetCandidates(List *names, int nargs, if (prevResult) { /* - * We have a match with a previous result. Decide which one + * We have a match with a previous result. Decide which one * to keep, or mark it ambiguous if we can't decide. The * logic here is preference > 0 means prefer the old result, * preference < 0 means prefer the new, preference = 0 means * ambiguous. */ - int preference; + int preference; if (pathpos != prevResult->pathpos) { @@ -810,9 +810,9 @@ FuncnameGetCandidates(List *names, int nargs, { /* * With variadic functions we could have, for example, - * both foo(numeric) and foo(variadic numeric[]) in - * the same namespace; if so we prefer the - * non-variadic match on efficiency grounds. + * both foo(numeric) and foo(variadic numeric[]) in the + * same namespace; if so we prefer the non-variadic match + * on efficiency grounds. */ preference = 1; } @@ -858,7 +858,7 @@ FuncnameGetCandidates(List *names, int nargs, break; } } - Assert(prevPrevResult); /* assert we found it */ + Assert(prevPrevResult); /* assert we found it */ } pfree(prevResult); /* fall through to add newResult to list */ @@ -2865,8 +2865,8 @@ InitTempTableNamespace(void) } /* - * If the corresponding toast-table namespace doesn't exist yet, create it. - * (We assume there is no need to clean it out if it does exist, since + * If the corresponding toast-table namespace doesn't exist yet, create + * it. (We assume there is no need to clean it out if it does exist, since * dropping a parent table should make its toast table go away.) */ snprintf(namespaceName, sizeof(namespaceName), "pg_toast_temp_%d", @@ -3230,7 +3230,7 @@ fetch_search_path(bool includeImplicit) /* * Fetch the active search path into a caller-allocated array of OIDs. - * Returns the number of path entries. (If this is more than sarray_len, + * Returns the number of path entries. (If this is more than sarray_len, * then the data didn't fit and is not all stored.) * * The returned list always includes the implicitly-prepended namespaces, diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c index 5af71a54ea..8c9f8bce7a 100644 --- a/src/backend/catalog/pg_aggregate.c +++ b/src/backend/catalog/pg_aggregate.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.101 2009/01/01 17:23:37 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.102 2009/06/11 14:48:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -180,9 +180,9 @@ AggregateCreate(const char *aggName, /* * Also, the return type can't be INTERNAL unless there's at least one - * INTERNAL argument. This is the same type-safety restriction we - * enforce for regular functions, but at the level of aggregates. We - * must test this explicitly because we allow INTERNAL as the transtype. + * INTERNAL argument. This is the same type-safety restriction we enforce + * for regular functions, but at the level of aggregates. We must test + * this explicitly because we allow INTERNAL as the transtype. */ if (finaltype == INTERNALOID && !hasInternalArg) ereport(ERROR, @@ -228,7 +228,7 @@ AggregateCreate(const char *aggName, PointerGetDatum(NULL), /* allParamTypes */ PointerGetDatum(NULL), /* parameterModes */ PointerGetDatum(NULL), /* parameterNames */ - NIL, /* parameterDefaults */ + NIL, /* parameterDefaults */ PointerGetDatum(NULL), /* proconfig */ 1, /* procost */ 0); /* prorows */ diff --git a/src/backend/catalog/pg_constraint.c b/src/backend/catalog/pg_constraint.c index e3e46afd40..9e13872fa8 100644 --- a/src/backend/catalog/pg_constraint.c +++ b/src/backend/catalog/pg_constraint.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_constraint.c,v 1.44 2009/01/01 17:23:37 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_constraint.c,v 1.45 2009/06/11 14:48:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -600,8 +600,8 @@ RenameConstraintById(Oid conId, const char *newname) con = (Form_pg_constraint) GETSTRUCT(tuple); /* - * We need to check whether the name is already in use --- note that - * there currently is not a unique index that would catch this. + * We need to check whether the name is already in use --- note that there + * currently is not a unique index that would catch this. */ if (OidIsValid(con->conrelid) && ConstraintNameIsUsed(CONSTRAINT_RELATION, @@ -610,8 +610,8 @@ RenameConstraintById(Oid conId, const char *newname) newname)) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), - errmsg("constraint \"%s\" for relation \"%s\" already exists", - newname, get_rel_name(con->conrelid)))); + errmsg("constraint \"%s\" for relation \"%s\" already exists", + newname, get_rel_name(con->conrelid)))); if (OidIsValid(con->contypid) && ConstraintNameIsUsed(CONSTRAINT_DOMAIN, con->contypid, diff --git a/src/backend/catalog/pg_depend.c b/src/backend/catalog/pg_depend.c index 1508243c08..9867cc2c67 100644 --- a/src/backend/catalog/pg_depend.c +++ b/src/backend/catalog/pg_depend.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_depend.c,v 1.31 2009/01/01 17:23:37 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_depend.c,v 1.32 2009/06/11 14:48:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -427,8 +427,8 @@ getOwnedSequences(Oid relid) { List *result = NIL; Relation depRel; - ScanKeyData key[2]; - SysScanDesc scan; + ScanKeyData key[2]; + SysScanDesc scan; HeapTuple tup; depRel = heap_open(DependRelationId, AccessShareLock); @@ -571,8 +571,8 @@ get_index_constraint(Oid indexId) Form_pg_depend deprec = (Form_pg_depend) GETSTRUCT(tup); /* - * We assume any internal dependency on a constraint - * must be what we are looking for. + * We assume any internal dependency on a constraint must be what we + * are looking for. */ if (deprec->refclassid == ConstraintRelationId && deprec->refobjsubid == 0 && diff --git a/src/backend/catalog/pg_inherits.c b/src/backend/catalog/pg_inherits.c index 49342dc345..8ae368b741 100644 --- a/src/backend/catalog/pg_inherits.c +++ b/src/backend/catalog/pg_inherits.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_inherits.c,v 1.2 2009/05/12 03:11:01 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_inherits.c,v 1.3 2009/06/11 14:48:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -82,8 +82,8 @@ find_inheritance_children(Oid parentrelId, LOCKMODE lockmode) /* * Now that we have the lock, double-check to see if the relation - * really exists or not. If not, assume it was dropped while - * we waited to acquire lock, and ignore it. + * really exists or not. If not, assume it was dropped while we + * waited to acquire lock, and ignore it. */ if (!SearchSysCacheExists(RELOID, ObjectIdGetDatum(inhrelid), @@ -235,10 +235,10 @@ typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId) HeapTuple inhtup; /* - * If we've seen this relid already, skip it. This avoids extra - * work in multiple-inheritance scenarios, and also protects us - * from an infinite loop in case there is a cycle in pg_inherits - * (though theoretically that shouldn't happen). + * If we've seen this relid already, skip it. This avoids extra work + * in multiple-inheritance scenarios, and also protects us from an + * infinite loop in case there is a cycle in pg_inherits (though + * theoretically that shouldn't happen). */ if (list_member_oid(visited, this_relid)) continue; diff --git a/src/backend/catalog/pg_operator.c b/src/backend/catalog/pg_operator.c index 12ffd74256..90c4acc9b2 100644 --- a/src/backend/catalog/pg_operator.c +++ b/src/backend/catalog/pg_operator.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_operator.c,v 1.108 2009/01/22 20:16:01 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_operator.c,v 1.109 2009/06/11 14:48:55 momjian Exp $ * * NOTES * these routines moved here from commands/define.c and somewhat cleaned up. @@ -391,11 +391,11 @@ OperatorCreate(const char *operatorName, if (OidIsValid(restrictionId)) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("only boolean operators can have restriction selectivity"))); + errmsg("only boolean operators can have restriction selectivity"))); if (OidIsValid(joinId)) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("only boolean operators can have join selectivity"))); + errmsg("only boolean operators can have join selectivity"))); if (canMerge) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), @@ -420,8 +420,8 @@ OperatorCreate(const char *operatorName, /* * At this point, if operatorObjectId is not InvalidOid then we are - * filling in a previously-created shell. Insist that the user own - * any such shell. + * filling in a previously-created shell. Insist that the user own any + * such shell. */ if (OidIsValid(operatorObjectId) && !pg_oper_ownercheck(operatorObjectId, GetUserId())) @@ -499,10 +499,10 @@ OperatorCreate(const char *operatorName, values[i++] = ObjectIdGetDatum(rightTypeId); /* oprright */ values[i++] = ObjectIdGetDatum(operResultType); /* oprresult */ values[i++] = ObjectIdGetDatum(commutatorId); /* oprcom */ - values[i++] = ObjectIdGetDatum(negatorId); /* oprnegate */ - values[i++] = ObjectIdGetDatum(procedureId); /* oprcode */ - values[i++] = ObjectIdGetDatum(restrictionId); /* oprrest */ - values[i++] = ObjectIdGetDatum(joinId); /* oprjoin */ + values[i++] = ObjectIdGetDatum(negatorId); /* oprnegate */ + values[i++] = ObjectIdGetDatum(procedureId); /* oprcode */ + values[i++] = ObjectIdGetDatum(restrictionId); /* oprrest */ + values[i++] = ObjectIdGetDatum(joinId); /* oprjoin */ pg_operator_desc = heap_open(OperatorRelationId, RowExclusiveLock); @@ -519,10 +519,10 @@ OperatorCreate(const char *operatorName, operatorObjectId); tup = heap_modify_tuple(tup, - RelationGetDescr(pg_operator_desc), - values, - nulls, - replaces); + RelationGetDescr(pg_operator_desc), + values, + nulls, + replaces); simple_heap_update(pg_operator_desc, &tup->t_self, tup); } @@ -690,10 +690,10 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId) } tup = heap_modify_tuple(tup, - RelationGetDescr(pg_operator_desc), - values, - nulls, - replaces); + RelationGetDescr(pg_operator_desc), + values, + nulls, + replaces); simple_heap_update(pg_operator_desc, &tup->t_self, tup); @@ -715,10 +715,10 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId) replaces[Anum_pg_operator_oprcom - 1] = true; tup = heap_modify_tuple(tup, - RelationGetDescr(pg_operator_desc), - values, - nulls, - replaces); + RelationGetDescr(pg_operator_desc), + values, + nulls, + replaces); simple_heap_update(pg_operator_desc, &tup->t_self, tup); @@ -741,10 +741,10 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId) replaces[Anum_pg_operator_oprnegate - 1] = true; tup = heap_modify_tuple(tup, - RelationGetDescr(pg_operator_desc), - values, - nulls, - replaces); + RelationGetDescr(pg_operator_desc), + values, + nulls, + replaces); simple_heap_update(pg_operator_desc, &tup->t_self, tup); diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c index ce42910e78..64920f5d2a 100644 --- a/src/backend/catalog/pg_proc.c +++ b/src/backend/catalog/pg_proc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.163 2009/06/04 18:33:06 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.164 2009/06/11 14:48:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -232,10 +232,11 @@ ProcedureCreate(const char *procedureName, ARR_ELEMTYPE(modesArray) != CHAROID) elog(ERROR, "parameterModes is not a 1-D char array"); modes = (char *) ARR_DATA_PTR(modesArray); + /* - * Only the last input parameter can be variadic; if it is, save - * its element type. Errors here are just elog since caller should - * have checked this already. + * Only the last input parameter can be variadic; if it is, save its + * element type. Errors here are just elog since caller should have + * checked this already. */ for (i = 0; i < allParamCount; i++) { @@ -393,11 +394,11 @@ ProcedureCreate(const char *procedureName, /* * If there are existing defaults, check compatibility: redefinition - * must not remove any defaults nor change their types. (Removing - * a default might cause a function to fail to satisfy an existing - * call. Changing type would only be possible if the associated - * parameter is polymorphic, and in such cases a change of default - * type might alter the resolved output type of existing calls.) + * must not remove any defaults nor change their types. (Removing a + * default might cause a function to fail to satisfy an existing call. + * Changing type would only be possible if the associated parameter is + * polymorphic, and in such cases a change of default type might alter + * the resolved output type of existing calls.) */ if (oldproc->pronargdefaults != 0) { @@ -430,8 +431,8 @@ ProcedureCreate(const char *procedureName, foreach(oldlc, oldDefaults) { - Node *oldDef = (Node *) lfirst(oldlc); - Node *newDef = (Node *) lfirst(newlc); + Node *oldDef = (Node *) lfirst(oldlc); + Node *newDef = (Node *) lfirst(newlc); if (exprType(oldDef) != exprType(newDef)) ereport(ERROR, @@ -453,8 +454,8 @@ ProcedureCreate(const char *procedureName, else ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("function \"%s\" is not an aggregate function", - procedureName))); + errmsg("function \"%s\" is not an aggregate function", + procedureName))); } if (oldproc->proiswindow != isWindowFunc) { diff --git a/src/backend/catalog/pg_shdepend.c b/src/backend/catalog/pg_shdepend.c index 19cfe08f4f..08977c3863 100644 --- a/src/backend/catalog/pg_shdepend.c +++ b/src/backend/catalog/pg_shdepend.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.33 2009/06/04 18:33:06 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.34 2009/06/11 14:48:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -56,18 +56,18 @@ static int getOidListDiff(Oid *list1, int nlist1, Oid *list2, int nlist2, static Oid classIdGetDbId(Oid classId); static void shdepLockAndCheckObject(Oid classId, Oid objectId); static void shdepChangeDep(Relation sdepRel, - Oid classid, Oid objid, int32 objsubid, - Oid refclassid, Oid refobjid, - SharedDependencyType deptype); + Oid classid, Oid objid, int32 objsubid, + Oid refclassid, Oid refobjid, + SharedDependencyType deptype); static void shdepAddDependency(Relation sdepRel, - Oid classId, Oid objectId, int32 objsubId, - Oid refclassId, Oid refobjId, - SharedDependencyType deptype); + Oid classId, Oid objectId, int32 objsubId, + Oid refclassId, Oid refobjId, + SharedDependencyType deptype); static void shdepDropDependency(Relation sdepRel, - Oid classId, Oid objectId, int32 objsubId, - bool drop_subobjects, - Oid refclassId, Oid refobjId, - SharedDependencyType deptype); + Oid classId, Oid objectId, int32 objsubId, + bool drop_subobjects, + Oid refclassId, Oid refobjId, + SharedDependencyType deptype); static void storeObjectDescription(StringInfo descs, objectType type, ObjectAddress *object, SharedDependencyType deptype, @@ -216,7 +216,7 @@ shdepChangeDep(Relation sdepRel, /* Caller screwed up if multiple matches */ if (oldtup) elog(ERROR, - "multiple pg_shdepend entries for object %u/%u/%d deptype %c", + "multiple pg_shdepend entries for object %u/%u/%d deptype %c", classid, objid, objsubid, deptype); oldtup = heap_copytuple(scantup); } @@ -450,7 +450,7 @@ updateAclDependencies(Oid classId, Oid objectId, int32 objsubId, SHARED_DEPENDENCY_ACL); else shdepDropDependency(sdepRel, classId, objectId, objsubId, - false, /* exact match on objsubId */ + false, /* exact match on objsubId */ AuthIdRelationId, roleid, SHARED_DEPENDENCY_ACL); } @@ -664,7 +664,7 @@ checkSharedDependencies(Oid classId, Oid objectId, if (numNotReportedDbs > 0) appendStringInfo(&descs, ngettext("\nand objects in %d other database " "(see server log for list)", - "\nand objects in %d other databases " + "\nand objects in %d other databases " "(see server log for list)", numNotReportedDbs), numNotReportedDbs); diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c index c7daed4e32..4c7e3f5078 100644 --- a/src/backend/catalog/pg_type.c +++ b/src/backend/catalog/pg_type.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_type.c,v 1.125 2009/02/24 01:38:09 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_type.c,v 1.126 2009/06/11 14:48:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -278,14 +278,14 @@ TypeCreate(Oid newTypeOid, if (internalSize == -1 && !(alignment == 'i' || alignment == 'd')) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("alignment \"%c\" is invalid for variable-length type", - alignment))); + errmsg("alignment \"%c\" is invalid for variable-length type", + alignment))); /* cstring must have char alignment */ if (internalSize == -2 && !(alignment == 'c')) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("alignment \"%c\" is invalid for variable-length type", - alignment))); + errmsg("alignment \"%c\" is invalid for variable-length type", + alignment))); } /* Only varlena types can be toasted */ @@ -392,10 +392,10 @@ TypeCreate(Oid newTypeOid, * Okay to update existing shell type tuple */ tup = heap_modify_tuple(tup, - RelationGetDescr(pg_type_desc), - values, - nulls, - replaces); + RelationGetDescr(pg_type_desc), + values, + nulls, + replaces); simple_heap_update(pg_type_desc, &tup->t_self, tup); @@ -406,8 +406,8 @@ TypeCreate(Oid newTypeOid, else { tup = heap_form_tuple(RelationGetDescr(pg_type_desc), - values, - nulls); + values, + nulls); /* Force the OID if requested by caller, else heap_insert does it */ if (OidIsValid(newTypeOid)) diff --git a/src/backend/catalog/storage.c b/src/backend/catalog/storage.c index e1a0f6254c..8f4612dda4 100644 --- a/src/backend/catalog/storage.c +++ b/src/backend/catalog/storage.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/storage.c,v 1.5 2009/01/20 18:59:37 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/storage.c,v 1.6 2009/06/11 14:48:55 momjian Exp $ * * NOTES * Some of this code used to be in storage/smgr/smgr.c, and the @@ -109,8 +109,8 @@ RelationCreateStorage(RelFileNode rnode, bool istemp) if (!istemp) { /* - * Make an XLOG entry showing the file creation. If we abort, the file - * will be dropped at abort time. + * Make an XLOG entry showing the file creation. If we abort, the + * file will be dropped at abort time. */ xlrec.rnode = rnode; @@ -175,8 +175,8 @@ RelationDropStorage(Relation rel) void RelationTruncate(Relation rel, BlockNumber nblocks) { - bool fsm; - bool vm; + bool fsm; + bool vm; /* Open it at the smgr level if not already done */ RelationOpenSmgr(rel); @@ -195,13 +195,13 @@ RelationTruncate(Relation rel, BlockNumber nblocks) visibilitymap_truncate(rel, nblocks); /* - * We WAL-log the truncation before actually truncating, which - * means trouble if the truncation fails. If we then crash, the WAL - * replay likely isn't going to succeed in the truncation either, and - * cause a PANIC. It's tempting to put a critical section here, but - * that cure would be worse than the disease. It would turn a usually - * harmless failure to truncate, that could spell trouble at WAL replay, - * into a certain PANIC. + * We WAL-log the truncation before actually truncating, which means + * trouble if the truncation fails. If we then crash, the WAL replay + * likely isn't going to succeed in the truncation either, and cause a + * PANIC. It's tempting to put a critical section here, but that cure + * would be worse than the disease. It would turn a usually harmless + * failure to truncate, that could spell trouble at WAL replay, into a + * certain PANIC. */ if (!rel->rd_istemp) { @@ -223,11 +223,11 @@ RelationTruncate(Relation rel, BlockNumber nblocks) lsn = XLogInsert(RM_SMGR_ID, XLOG_SMGR_TRUNCATE, &rdata); /* - * Flush, because otherwise the truncation of the main relation - * might hit the disk before the WAL record, and the truncation of - * the FSM or visibility map. If we crashed during that window, we'd - * be left with a truncated heap, but the FSM or visibility map would - * still contain entries for the non-existent heap pages. + * Flush, because otherwise the truncation of the main relation might + * hit the disk before the WAL record, and the truncation of the FSM + * or visibility map. If we crashed during that window, we'd be left + * with a truncated heap, but the FSM or visibility map would still + * contain entries for the non-existent heap pages. */ if (fsm || vm) XLogFlush(lsn); @@ -270,7 +270,7 @@ smgrDoPendingDeletes(bool isCommit) /* do deletion if called for */ if (pending->atCommit == isCommit) { - int i; + int i; /* schedule unlinking old files */ SMgrRelation srel; @@ -431,11 +431,12 @@ smgr_redo(XLogRecPtr lsn, XLogRecord *record) /* Also tell xlogutils.c about it */ XLogTruncateRelation(xlrec->rnode, MAIN_FORKNUM, xlrec->blkno); - + /* Truncate FSM too */ if (smgrexists(reln, FSM_FORKNUM)) { - Relation rel = CreateFakeRelcacheEntry(xlrec->rnode); + Relation rel = CreateFakeRelcacheEntry(xlrec->rnode); + FreeSpaceMapTruncateRel(rel, xlrec->blkno); FreeFakeRelcacheEntry(rel); } @@ -453,7 +454,7 @@ smgr_desc(StringInfo buf, uint8 xl_info, char *rec) if (info == XLOG_SMGR_CREATE) { xl_smgr_create *xlrec = (xl_smgr_create *) rec; - char *path = relpath(xlrec->rnode, MAIN_FORKNUM); + char *path = relpath(xlrec->rnode, MAIN_FORKNUM); appendStringInfo(buf, "file create: %s", path); pfree(path); @@ -461,7 +462,7 @@ smgr_desc(StringInfo buf, uint8 xl_info, char *rec) else if (info == XLOG_SMGR_TRUNCATE) { xl_smgr_truncate *xlrec = (xl_smgr_truncate *) rec; - char *path = relpath(xlrec->rnode, MAIN_FORKNUM); + char *path = relpath(xlrec->rnode, MAIN_FORKNUM); appendStringInfo(buf, "file truncate: %s to %u blocks", path, xlrec->blkno); diff --git a/src/backend/catalog/toasting.c b/src/backend/catalog/toasting.c index ff9499ca35..510c88ec33 100644 --- a/src/backend/catalog/toasting.c +++ b/src/backend/catalog/toasting.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/toasting.c,v 1.15 2009/05/07 22:58:28 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/toasting.c,v 1.16 2009/06/11 14:48:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -145,8 +145,8 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid, /* * Check to see whether the table actually needs a TOAST table. * - * Caller can optionally override this check. (Note: at present - * no callers in core Postgres do so, but this option is needed by + * Caller can optionally override this check. (Note: at present no + * callers in core Postgres do so, but this option is needed by * pg_migrator.) */ if (!force && !needs_toast_table(rel)) diff --git a/src/backend/commands/aggregatecmds.c b/src/backend/commands/aggregatecmds.c index 7b2d8915df..461f81005c 100644 --- a/src/backend/commands/aggregatecmds.c +++ b/src/backend/commands/aggregatecmds.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/aggregatecmds.c,v 1.48 2009/01/01 17:23:37 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/aggregatecmds.c,v 1.49 2009/06/11 14:48:55 momjian Exp $ * * DESCRIPTION * The "DefineFoo" routines take the parse tree and pick out the @@ -173,18 +173,18 @@ DefineAggregate(List *name, List *args, bool oldstyle, List *parameters) * * transtype can't be a pseudo-type, since we need to be able to store * values of the transtype. However, we can allow polymorphic transtype - * in some cases (AggregateCreate will check). Also, we allow "internal" + * in some cases (AggregateCreate will check). Also, we allow "internal" * for functions that want to pass pointers to private data structures; - * but allow that only to superusers, since you could crash the system - * (or worse) by connecting up incompatible internal-using functions - * in an aggregate. + * but allow that only to superusers, since you could crash the system (or + * worse) by connecting up incompatible internal-using functions in an + * aggregate. */ transTypeId = typenameTypeId(NULL, transType, NULL); if (get_typtype(transTypeId) == TYPTYPE_PSEUDO && !IsPolymorphicType(transTypeId)) { if (transTypeId == INTERNALOID && superuser()) - /* okay */ ; + /* okay */ ; else ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index d549fa3bb9..f5e76e2aed 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.138 2009/06/06 22:13:51 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.139 2009/06/11 14:48:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -177,8 +177,8 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt, { if (onerel->rd_rel->relisshared) ereport(WARNING, - (errmsg("skipping \"%s\" --- only superuser can analyze it", - RelationGetRelationName(onerel)))); + (errmsg("skipping \"%s\" --- only superuser can analyze it", + RelationGetRelationName(onerel)))); else if (onerel->rd_rel->relnamespace == PG_CATALOG_NAMESPACE) ereport(WARNING, (errmsg("skipping \"%s\" --- only superuser or database owner can analyze it", @@ -234,8 +234,8 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt, RelationGetRelationName(onerel)))); /* - * Switch to the table owner's userid, so that any index functions are - * run as that user. + * Switch to the table owner's userid, so that any index functions are run + * as that user. */ GetUserIdAndContext(&save_userid, &save_secdefcxt); SetUserIdAndContext(onerel->rd_rel->relowner, true); @@ -467,7 +467,7 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt, /* * Same for indexes. Vacuum always scans all indexes, so if we're part of - * VACUUM ANALYZE, don't overwrite the accurate count already inserted by + * VACUUM ANALYZE, don't overwrite the accurate count already inserted by * VACUUM. */ if (!vacstmt->vacuum) @@ -719,8 +719,8 @@ examine_attribute(Relation onerel, int attnum) return NULL; /* - * Create the VacAttrStats struct. Note that we only have a copy of - * the fixed fields of the pg_attribute tuple. + * Create the VacAttrStats struct. Note that we only have a copy of the + * fixed fields of the pg_attribute tuple. */ stats = (VacAttrStats *) palloc0(sizeof(VacAttrStats)); stats->attr = (Form_pg_attribute) palloc(ATTRIBUTE_FIXED_PART_SIZE); @@ -737,10 +737,9 @@ examine_attribute(Relation onerel, int attnum) stats->tupattnum = attnum; /* - * The fields describing the stats->stavalues[n] element types default - * to the type of the field being analyzed, but the type-specific - * typanalyze function can change them if it wants to store something - * else. + * The fields describing the stats->stavalues[n] element types default to + * the type of the field being analyzed, but the type-specific typanalyze + * function can change them if it wants to store something else. */ for (i = 0; i < STATISTIC_NUM_SLOTS; i++) { @@ -894,7 +893,7 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows, double *totalrows, double *totaldeadrows) { int numrows = 0; /* # rows now in reservoir */ - double samplerows = 0; /* total # rows collected */ + double samplerows = 0; /* total # rows collected */ double liverows = 0; /* # live rows seen */ double deadrows = 0; /* # dead rows seen */ double rowstoskip = -1; /* -1 means not set yet */ @@ -931,9 +930,9 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows, * the maxoffset value stays good (else concurrent VACUUM might delete * tuples out from under us). Hence, pin the page until we are done * looking at it. We also choose to hold sharelock on the buffer - * throughout --- we could release and re-acquire sharelock for - * each tuple, but since we aren't doing much work per tuple, the - * extra lock traffic is probably better avoided. + * throughout --- we could release and re-acquire sharelock for each + * tuple, but since we aren't doing much work per tuple, the extra + * lock traffic is probably better avoided. */ targbuffer = ReadBufferExtended(onerel, MAIN_FORKNUM, targblock, RBM_NORMAL, vac_strategy); @@ -952,9 +951,9 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows, /* * We ignore unused and redirect line pointers. DEAD line - * pointers should be counted as dead, because we need vacuum - * to run to get rid of them. Note that this rule agrees with - * the way that heap_page_prune() counts things. + * pointers should be counted as dead, because we need vacuum to + * run to get rid of them. Note that this rule agrees with the + * way that heap_page_prune() counts things. */ if (!ItemIdIsNormal(itemid)) { @@ -984,6 +983,7 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows, break; case HEAPTUPLE_INSERT_IN_PROGRESS: + /* * Insert-in-progress rows are not counted. We assume * that when the inserting transaction commits or aborts, @@ -991,17 +991,17 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows, * count. This works right only if that transaction ends * after we finish analyzing the table; if things happen * in the other order, its stats update will be - * overwritten by ours. However, the error will be - * large only if the other transaction runs long enough - * to insert many tuples, so assuming it will finish - * after us is the safer option. + * overwritten by ours. However, the error will be large + * only if the other transaction runs long enough to + * insert many tuples, so assuming it will finish after us + * is the safer option. * * A special case is that the inserting transaction might - * be our own. In this case we should count and sample + * be our own. In this case we should count and sample * the row, to accommodate users who load a table and * analyze it in one transaction. (pgstat_report_analyze - * has to adjust the numbers we send to the stats collector - * to make this come out right.) + * has to adjust the numbers we send to the stats + * collector to make this come out right.) */ if (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmin(targtuple.t_data))) { @@ -1011,6 +1011,7 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows, break; case HEAPTUPLE_DELETE_IN_PROGRESS: + /* * We count delete-in-progress rows as still live, using * the same reasoning given above; but we don't bother to @@ -1019,8 +1020,8 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows, * If the delete was done by our own transaction, however, * we must count the row as dead to make * pgstat_report_analyze's stats adjustments come out - * right. (Note: this works out properly when the row - * was both inserted and deleted in our xact.) + * right. (Note: this works out properly when the row was + * both inserted and deleted in our xact.) */ if (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmax(targtuple.t_data))) deadrows += 1; @@ -1054,8 +1055,8 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows, /* * t in Vitter's paper is the number of records already * processed. If we need to compute a new S value, we - * must use the not-yet-incremented value of samplerows - * as t. + * must use the not-yet-incremented value of samplerows as + * t. */ if (rowstoskip < 0) rowstoskip = get_next_S(samplerows, targrows, &rstate); @@ -1385,10 +1386,10 @@ update_attstats(Oid relid, int natts, VacAttrStats **vacattrstats) { /* Yes, replace it */ stup = heap_modify_tuple(oldtup, - RelationGetDescr(sd), - values, - nulls, - replaces); + RelationGetDescr(sd), + values, + nulls, + replaces); ReleaseSysCache(oldtup); simple_heap_update(sd, &stup->t_self, stup); } @@ -1883,9 +1884,10 @@ compute_minimal_stats(VacAttrStatsP stats, stats->numnumbers[0] = num_mcv; stats->stavalues[0] = mcv_values; stats->numvalues[0] = num_mcv; + /* - * Accept the defaults for stats->statypid and others. - * They have been set before we were called (see vacuum.h) + * Accept the defaults for stats->statypid and others. They have + * been set before we were called (see vacuum.h) */ } } @@ -2232,9 +2234,10 @@ compute_scalar_stats(VacAttrStatsP stats, stats->numnumbers[slot_idx] = num_mcv; stats->stavalues[slot_idx] = mcv_values; stats->numvalues[slot_idx] = num_mcv; + /* - * Accept the defaults for stats->statypid and others. - * They have been set before we were called (see vacuum.h) + * Accept the defaults for stats->statypid and others. They have + * been set before we were called (see vacuum.h) */ slot_idx++; } @@ -2312,7 +2315,7 @@ compute_scalar_stats(VacAttrStatsP stats, /* * The object of this loop is to copy the first and last values[] - * entries along with evenly-spaced values in between. So the + * entries along with evenly-spaced values in between. So the * i'th value is values[(i * (nvals - 1)) / (num_hist - 1)]. But * computing that subscript directly risks integer overflow when * the stats target is more than a couple thousand. Instead we @@ -2344,9 +2347,10 @@ compute_scalar_stats(VacAttrStatsP stats, stats->staop[slot_idx] = mystats->ltopr; stats->stavalues[slot_idx] = hist_values; stats->numvalues[slot_idx] = num_hist; + /* - * Accept the defaults for stats->statypid and others. - * They have been set before we were called (see vacuum.h) + * Accept the defaults for stats->statypid and others. They have + * been set before we were called (see vacuum.h) */ slot_idx++; } diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index 745f455853..9da815d481 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.146 2009/02/13 17:12:04 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.147 2009/06/11 14:48:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -53,7 +53,7 @@ * transaction. * * Like NOTIFY, LISTEN and UNLISTEN just add the desired action to a list - * of pending actions. If we reach transaction commit, the changes are + * of pending actions. If we reach transaction commit, the changes are * applied to pg_listener just before executing any pending NOTIFYs. This * method is necessary because to avoid race conditions, we must hold lock * on pg_listener from when we insert a new listener tuple until we commit. @@ -124,12 +124,12 @@ typedef enum typedef struct { ListenActionKind action; - char condname[1]; /* actually, as long as needed */ + char condname[1]; /* actually, as long as needed */ } ListenAction; -static List *pendingActions = NIL; /* list of ListenAction */ +static List *pendingActions = NIL; /* list of ListenAction */ -static List *upperPendingActions = NIL; /* list of upper-xact lists */ +static List *upperPendingActions = NIL; /* list of upper-xact lists */ /* * State for outbound notifies consists of a list of all relnames NOTIFYed @@ -147,7 +147,7 @@ static List *upperPendingActions = NIL; /* list of upper-xact lists */ * condition name, it will get a self-notify at commit. This is a bit odd * but is consistent with our historical behavior. */ -static List *pendingNotifies = NIL; /* list of C strings */ +static List *pendingNotifies = NIL; /* list of C strings */ static List *upperPendingNotifies = NIL; /* list of upper-xact lists */ @@ -209,10 +209,9 @@ Async_Notify(const char *relname) oldcontext = MemoryContextSwitchTo(CurTransactionContext); /* - * Ordering of the list isn't important. We choose to put new - * entries on the front, as this might make duplicate-elimination - * a tad faster when the same condition is signaled many times in - * a row. + * Ordering of the list isn't important. We choose to put new entries + * on the front, as this might make duplicate-elimination a tad faster + * when the same condition is signaled many times in a row. */ pendingNotifies = lcons(pstrdup(relname), pendingNotifies); @@ -235,10 +234,10 @@ queue_listen(ListenActionKind action, const char *condname) ListenAction *actrec; /* - * Unlike Async_Notify, we don't try to collapse out duplicates. - * It would be too complicated to ensure we get the right interactions - * of conflicting LISTEN/UNLISTEN/UNLISTEN_ALL, and it's unlikely that - * there would be any performance benefit anyway in sane applications. + * Unlike Async_Notify, we don't try to collapse out duplicates. It would + * be too complicated to ensure we get the right interactions of + * conflicting LISTEN/UNLISTEN/UNLISTEN_ALL, and it's unlikely that there + * would be any performance benefit anyway in sane applications. */ oldcontext = MemoryContextSwitchTo(CurTransactionContext); @@ -488,7 +487,7 @@ Exec_Listen(Relation lRel, const char *relname) namestrcpy(&condname, relname); values[Anum_pg_listener_relname - 1] = NameGetDatum(&condname); values[Anum_pg_listener_pid - 1] = Int32GetDatum(MyProcPid); - values[Anum_pg_listener_notify - 1] = Int32GetDatum(0); /* no notifies pending */ + values[Anum_pg_listener_notify - 1] = Int32GetDatum(0); /* no notifies pending */ tuple = heap_form_tuple(RelationGetDescr(lRel), values, nulls); @@ -755,9 +754,9 @@ AtSubAbort_Notify(void) int my_level = GetCurrentTransactionNestLevel(); /* - * All we have to do is pop the stack --- the actions/notifies made in this - * subxact are no longer interesting, and the space will be freed when - * CurTransactionContext is recycled. + * All we have to do is pop the stack --- the actions/notifies made in + * this subxact are no longer interesting, and the space will be freed + * when CurTransactionContext is recycled. * * This routine could be called more than once at a given nesting level if * there is trouble during subxact abort. Avoid dumping core by using diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index 08c09ed435..ca9999d5f4 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.184 2009/05/07 22:58:28 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.185 2009/06/11 14:48:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -631,9 +631,9 @@ rebuild_relation(Relation OldHeap, Oid indexOid) /* * At this point, everything is kosher except that the toast table's name - * corresponds to the temporary table. The name is irrelevant to - * the backend because it's referenced by OID, but users looking at the - * catalogs could be confused. Rename it to prevent this problem. + * corresponds to the temporary table. The name is irrelevant to the + * backend because it's referenced by OID, but users looking at the + * catalogs could be confused. Rename it to prevent this problem. * * Note no lock required on the relation, because we already hold an * exclusive lock on it. @@ -679,10 +679,10 @@ make_new_heap(Oid OIDOldHeap, const char *NewName, Oid NewTableSpace) /* * Need to make a copy of the tuple descriptor, since - * heap_create_with_catalog modifies it. Note that the NewHeap will - * not receive any of the defaults or constraints associated with the - * OldHeap; we don't need 'em, and there's no reason to spend cycles - * inserting them into the catalogs only to delete them. + * heap_create_with_catalog modifies it. Note that the NewHeap will not + * receive any of the defaults or constraints associated with the OldHeap; + * we don't need 'em, and there's no reason to spend cycles inserting them + * into the catalogs only to delete them. */ tupdesc = CreateTupleDescCopy(OldHeapDesc); @@ -811,8 +811,8 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex) &OldestXmin, &FreezeXid, NULL); /* - * FreezeXid will become the table's new relfrozenxid, and that mustn't - * go backwards, so take the max. + * FreezeXid will become the table's new relfrozenxid, and that mustn't go + * backwards, so take the max. */ if (TransactionIdPrecedes(FreezeXid, OldHeap->rd_rel->relfrozenxid)) FreezeXid = OldHeap->rd_rel->relfrozenxid; diff --git a/src/backend/commands/comment.c b/src/backend/commands/comment.c index 5f5da2a895..b6a90a248b 100644 --- a/src/backend/commands/comment.c +++ b/src/backend/commands/comment.c @@ -7,7 +7,7 @@ * Copyright (c) 1996-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.106 2009/01/01 17:23:37 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.107 2009/06/11 14:48:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -249,7 +249,7 @@ CreateComments(Oid oid, Oid classoid, int32 subid, char *comment) else { newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(description), values, - nulls, replaces); + nulls, replaces); simple_heap_update(description, &oldtuple->t_self, newtuple); } @@ -263,7 +263,7 @@ CreateComments(Oid oid, Oid classoid, int32 subid, char *comment) if (newtuple == NULL && comment != NULL) { newtuple = heap_form_tuple(RelationGetDescr(description), - values, nulls); + values, nulls); simple_heap_insert(description, newtuple); } @@ -344,7 +344,7 @@ CreateSharedComments(Oid oid, Oid classoid, char *comment) else { newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(shdescription), - values, nulls, replaces); + values, nulls, replaces); simple_heap_update(shdescription, &oldtuple->t_self, newtuple); } @@ -358,7 +358,7 @@ CreateSharedComments(Oid oid, Oid classoid, char *comment) if (newtuple == NULL && comment != NULL) { newtuple = heap_form_tuple(RelationGetDescr(shdescription), - values, nulls); + values, nulls); simple_heap_insert(shdescription, newtuple); } diff --git a/src/backend/commands/conversioncmds.c b/src/backend/commands/conversioncmds.c index 13c55d51bf..8f5093f808 100644 --- a/src/backend/commands/conversioncmds.c +++ b/src/backend/commands/conversioncmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.38 2009/02/27 16:35:26 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.39 2009/06/11 14:48:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -87,8 +87,8 @@ CreateConversionCommand(CreateConversionStmt *stmt) if (get_func_rettype(funcoid) != VOIDOID) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("encoding conversion function %s must return type \"void\"", - NameListToString(func_name)))); + errmsg("encoding conversion function %s must return type \"void\"", + NameListToString(func_name)))); /* Check we have EXECUTE rights for the function */ aclresult = pg_proc_aclcheck(funcoid, GetUserId(), ACL_EXECUTE); @@ -97,10 +97,10 @@ CreateConversionCommand(CreateConversionStmt *stmt) NameListToString(func_name)); /* - * Check that the conversion function is suitable for the requested - * source and target encodings. We do that by calling the function with - * an empty string; the conversion function should throw an error if it - * can't perform the requested conversion. + * Check that the conversion function is suitable for the requested source + * and target encodings. We do that by calling the function with an empty + * string; the conversion function should throw an error if it can't + * perform the requested conversion. */ OidFunctionCall5(funcoid, Int32GetDatum(from_encoding), @@ -124,19 +124,19 @@ void DropConversionsCommand(DropStmt *drop) { ObjectAddresses *objects; - ListCell *cell; + ListCell *cell; /* * First we identify all the conversions, then we delete them in a single - * performMultipleDeletions() call. This is to avoid unwanted - * DROP RESTRICT errors if one of the conversions depends on another. - * (Not that that is very likely, but we may as well do this consistently.) + * performMultipleDeletions() call. This is to avoid unwanted DROP + * RESTRICT errors if one of the conversions depends on another. (Not that + * that is very likely, but we may as well do this consistently.) */ objects = new_object_addresses(); foreach(cell, drop->objects) { - List *name = (List *) lfirst(cell); + List *name = (List *) lfirst(cell); Oid conversionOid; HeapTuple tuple; Form_pg_conversion con; diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index 7840e7b52c..c464ed7f6c 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.311 2009/06/03 15:06:48 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.312 2009/06/11 14:48:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -178,7 +178,7 @@ typedef struct * function call overhead in tight COPY loops. * * We must use "if (1)" because the usual "do {...} while(0)" wrapper would - * prevent the continue/break processing from working. We end the "if (1)" + * prevent the continue/break processing from working. We end the "if (1)" * with "else ((void) 0)" to ensure the "if" does not unintentionally match * any "else" in the calling code, and to avoid any compiler warnings about * empty statements. See http://www.cit.gu.edu.au/~anthony/info/C/C.macros. @@ -859,7 +859,7 @@ DoCopy(const CopyStmt *stmt, const char *queryString) if (strlen(cstate->delim) != 1) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("COPY delimiter must be a single one-byte character"))); + errmsg("COPY delimiter must be a single one-byte character"))); /* Disallow end-of-line characters */ if (strchr(cstate->delim, '\r') != NULL || @@ -879,8 +879,8 @@ DoCopy(const CopyStmt *stmt, const char *queryString) * backslash because it would be ambiguous. We can't allow the other * cases because data characters matching the delimiter must be * backslashed, and certain backslash combinations are interpreted - * non-literally by COPY IN. Disallowing all lower case ASCII letters - * is more than strictly necessary, but seems best for consistency and + * non-literally by COPY IN. Disallowing all lower case ASCII letters is + * more than strictly necessary, but seems best for consistency and * future-proofing. Likewise we disallow all digits though only octal * digits are actually dangerous. */ @@ -1670,7 +1670,7 @@ CopyFrom(CopyState cstate) MemoryContext oldcontext = CurrentMemoryContext; ErrorContextCallback errcontext; CommandId mycid = GetCurrentCommandId(true); - int hi_options = 0; /* start with default heap_insert options */ + int hi_options = 0; /* start with default heap_insert options */ BulkInsertState bistate; Assert(cstate->rel); @@ -2454,10 +2454,10 @@ CopyReadLineText(CopyState cstate) ereport(ERROR, (errcode(ERRCODE_BAD_COPY_FILE_FORMAT), !cstate->csv_mode ? - errmsg("literal carriage return found in data") : - errmsg("unquoted carriage return found in data"), + errmsg("literal carriage return found in data") : + errmsg("unquoted carriage return found in data"), !cstate->csv_mode ? - errhint("Use \"\\r\" to represent carriage return.") : + errhint("Use \"\\r\" to represent carriage return.") : errhint("Use quoted CSV field to represent carriage return."))); /* @@ -2474,7 +2474,7 @@ CopyReadLineText(CopyState cstate) errmsg("literal carriage return found in data") : errmsg("unquoted carriage return found in data"), !cstate->csv_mode ? - errhint("Use \"\\r\" to represent carriage return.") : + errhint("Use \"\\r\" to represent carriage return.") : errhint("Use quoted CSV field to represent carriage return."))); /* If reach here, we have found the line terminator */ break; @@ -2491,7 +2491,7 @@ CopyReadLineText(CopyState cstate) errmsg("unquoted newline found in data"), !cstate->csv_mode ? errhint("Use \"\\n\" to represent newline.") : - errhint("Use quoted CSV field to represent newline."))); + errhint("Use quoted CSV field to represent newline."))); cstate->eol_type = EOL_NL; /* in case not set yet */ /* If reach here, we have found the line terminator */ break; @@ -2847,9 +2847,9 @@ CopyReadAttributesText(CopyState cstate, int maxfields, char **fieldvals) *output_ptr++ = '\0'; /* - * If we de-escaped a non-7-bit-ASCII char, make sure we still - * have valid data for the db encoding. Avoid calling strlen here for - * the sake of efficiency. + * If we de-escaped a non-7-bit-ASCII char, make sure we still have + * valid data for the db encoding. Avoid calling strlen here for the + * sake of efficiency. */ if (saw_non_ascii) { @@ -2945,12 +2945,12 @@ CopyReadAttributesCSV(CopyState cstate, int maxfields, char **fieldvals) start_ptr = cur_ptr; fieldvals[fieldno] = output_ptr; - /* Scan data for field, + /* + * Scan data for field, * - * The loop starts in "not quote" mode and then toggles between - * that and "in quote" mode. - * The loop exits normally if it is in "not quote" mode and a - * delimiter or line end is seen. + * The loop starts in "not quote" mode and then toggles between that + * and "in quote" mode. The loop exits normally if it is in "not + * quote" mode and a delimiter or line end is seen. */ for (;;) { @@ -2994,8 +2994,8 @@ CopyReadAttributesCSV(CopyState cstate, int maxfields, char **fieldvals) if (c == escapec) { /* - * peek at the next char if available, and escape it if it is - * an escape char or a quote char + * peek at the next char if available, and escape it if it + * is an escape char or a quote char */ if (cur_ptr < line_end_ptr) { @@ -3009,10 +3009,11 @@ CopyReadAttributesCSV(CopyState cstate, int maxfields, char **fieldvals) } } } + /* - * end of quoted field. Must do this test after testing for escape - * in case quote char and escape char are the same (which is the - * common case). + * end of quoted field. Must do this test after testing for + * escape in case quote char and escape char are the same + * (which is the common case). */ if (c == quotec) break; @@ -3021,7 +3022,7 @@ CopyReadAttributesCSV(CopyState cstate, int maxfields, char **fieldvals) *output_ptr++ = c; } } - endfield: +endfield: /* Terminate attribute value in output area */ *output_ptr++ = '\0'; @@ -3144,11 +3145,11 @@ CopyAttributeOutText(CopyState cstate, char *string) if ((unsigned char) c < (unsigned char) 0x20) { /* - * \r and \n must be escaped, the others are traditional. - * We prefer to dump these using the C-like notation, rather - * than a backslash and the literal character, because it - * makes the dump file a bit more proof against Microsoftish - * data mangling. + * \r and \n must be escaped, the others are traditional. We + * prefer to dump these using the C-like notation, rather than + * a backslash and the literal character, because it makes the + * dump file a bit more proof against Microsoftish data + * mangling. */ switch (c) { @@ -3182,7 +3183,7 @@ CopyAttributeOutText(CopyState cstate, char *string) DUMPSOFAR(); CopySendChar(cstate, '\\'); CopySendChar(cstate, c); - start = ++ptr; /* do not include char in next run */ + start = ++ptr; /* do not include char in next run */ } else if (c == '\\' || c == delimc) { @@ -3204,11 +3205,11 @@ CopyAttributeOutText(CopyState cstate, char *string) if ((unsigned char) c < (unsigned char) 0x20) { /* - * \r and \n must be escaped, the others are traditional. - * We prefer to dump these using the C-like notation, rather - * than a backslash and the literal character, because it - * makes the dump file a bit more proof against Microsoftish - * data mangling. + * \r and \n must be escaped, the others are traditional. We + * prefer to dump these using the C-like notation, rather than + * a backslash and the literal character, because it makes the + * dump file a bit more proof against Microsoftish data + * mangling. */ switch (c) { @@ -3242,7 +3243,7 @@ CopyAttributeOutText(CopyState cstate, char *string) DUMPSOFAR(); CopySendChar(cstate, '\\'); CopySendChar(cstate, c); - start = ++ptr; /* do not include char in next run */ + start = ++ptr; /* do not include char in next run */ } else if (c == '\\' || c == delimc) { diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 8d5972dfa5..1ea84fdbb2 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.224 2009/05/06 16:15:21 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.225 2009/06/11 14:48:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -334,8 +334,8 @@ createdb(const CreatedbStmt *stmt) /* * Check whether chosen encoding matches chosen locale settings. This * restriction is necessary because libc's locale-specific code usually - * fails when presented with data in an encoding it's not expecting. - * We allow mismatch in three cases: + * fails when presented with data in an encoding it's not expecting. We + * allow mismatch in three cases: * * 1. locale encoding = SQL_ASCII, which means either that the locale is * C/POSIX which works with any encoding, or that we couldn't determine @@ -365,8 +365,8 @@ createdb(const CreatedbStmt *stmt) errmsg("encoding %s does not match locale %s", pg_encoding_to_char(encoding), dbctype), - errdetail("The chosen LC_CTYPE setting requires encoding %s.", - pg_encoding_to_char(ctype_encoding)))); + errdetail("The chosen LC_CTYPE setting requires encoding %s.", + pg_encoding_to_char(ctype_encoding)))); if (!(collate_encoding == encoding || collate_encoding == PG_SQL_ASCII || @@ -554,7 +554,7 @@ createdb(const CreatedbStmt *stmt) new_record_nulls[Anum_pg_database_datacl - 1] = true; tuple = heap_form_tuple(RelationGetDescr(pg_database_rel), - new_record, new_record_nulls); + new_record, new_record_nulls); HeapTupleSetOid(tuple, dboid); @@ -716,9 +716,9 @@ createdb_failure_callback(int code, Datum arg) createdb_failure_params *fparms = (createdb_failure_params *) DatumGetPointer(arg); /* - * Release lock on source database before doing recursive remove. - * This is not essential but it seems desirable to release the lock - * as soon as possible. + * Release lock on source database before doing recursive remove. This is + * not essential but it seems desirable to release the lock as soon as + * possible. */ UnlockSharedObject(DatabaseRelationId, fparms->src_dboid, 0, ShareLock); @@ -842,9 +842,9 @@ dropdb(const char *dbname, bool missing_ok) /* * Tell bgwriter to forget any pending fsync and unlink requests for files - * in the database; else the fsyncs will fail at next checkpoint, or worse, - * it will delete files that belong to a newly created database with the - * same OID. + * in the database; else the fsyncs will fail at next checkpoint, or + * worse, it will delete files that belong to a newly created database + * with the same OID. */ ForgetDatabaseFsyncRequests(db_id); @@ -975,21 +975,23 @@ RenameDatabase(const char *oldname, const char *newname) static void movedb(const char *dbname, const char *tblspcname) { - Oid db_id; - Relation pgdbrel; - int notherbackends; - int npreparedxacts; - HeapTuple oldtuple, newtuple; - Oid src_tblspcoid, dst_tblspcoid; - Datum new_record[Natts_pg_database]; - bool new_record_nulls[Natts_pg_database]; - bool new_record_repl[Natts_pg_database]; - ScanKeyData scankey; - SysScanDesc sysscan; - AclResult aclresult; - char *src_dbpath; - char *dst_dbpath; - DIR *dstdir; + Oid db_id; + Relation pgdbrel; + int notherbackends; + int npreparedxacts; + HeapTuple oldtuple, + newtuple; + Oid src_tblspcoid, + dst_tblspcoid; + Datum new_record[Natts_pg_database]; + bool new_record_nulls[Natts_pg_database]; + bool new_record_repl[Natts_pg_database]; + ScanKeyData scankey; + SysScanDesc sysscan; + AclResult aclresult; + char *src_dbpath; + char *dst_dbpath; + DIR *dstdir; struct dirent *xlde; movedb_failure_params fparms; @@ -1089,13 +1091,13 @@ movedb(const char *dbname, const char *tblspcname) /* * Force a checkpoint before proceeding. This will force dirty buffers out - * to disk, to ensure source database is up-to-date on disk for the - * copy. FlushDatabaseBuffers() would suffice for that, but we also want - * to process any pending unlink requests. Otherwise, the check for - * existing files in the target directory might fail unnecessarily, not to - * mention that the copy might fail due to source files getting deleted - * under it. On Windows, this also ensures that the bgwriter doesn't hold - * any open files, which would cause rmdir() to fail. + * to disk, to ensure source database is up-to-date on disk for the copy. + * FlushDatabaseBuffers() would suffice for that, but we also want to + * process any pending unlink requests. Otherwise, the check for existing + * files in the target directory might fail unnecessarily, not to mention + * that the copy might fail due to source files getting deleted under it. + * On Windows, this also ensures that the bgwriter doesn't hold any open + * files, which would cause rmdir() to fail. */ RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT); @@ -1125,8 +1127,8 @@ movedb(const char *dbname, const char *tblspcname) FreeDir(dstdir); /* - * The directory exists but is empty. - * We must remove it before using the copydir function. + * The directory exists but is empty. We must remove it before using + * the copydir function. */ if (rmdir(dst_dbpath) != 0) elog(ERROR, "could not remove directory \"%s\": %m", @@ -1135,7 +1137,7 @@ movedb(const char *dbname, const char *tblspcname) /* * Use an ENSURE block to make sure we remove the debris if the copy fails - * (eg, due to out-of-disk-space). This is not a 100% solution, because + * (eg, due to out-of-disk-space). This is not a 100% solution, because * of the possibility of failure during transaction commit, but it should * handle most scenarios. */ @@ -1179,7 +1181,7 @@ movedb(const char *dbname, const char *tblspcname) sysscan = systable_beginscan(pgdbrel, DatabaseNameIndexId, true, SnapshotNow, 1, &scankey); oldtuple = systable_getnext(sysscan); - if (!HeapTupleIsValid(oldtuple)) /* shouldn't happen... */ + if (!HeapTupleIsValid(oldtuple)) /* shouldn't happen... */ ereport(ERROR, (errcode(ERRCODE_UNDEFINED_DATABASE), errmsg("database \"%s\" does not exist", dbname))); @@ -1228,13 +1230,13 @@ movedb(const char *dbname, const char *tblspcname) PointerGetDatum(&fparms)); /* - * Commit the transaction so that the pg_database update is committed. - * If we crash while removing files, the database won't be corrupt, - * we'll just leave some orphaned files in the old directory. + * Commit the transaction so that the pg_database update is committed. If + * we crash while removing files, the database won't be corrupt, we'll + * just leave some orphaned files in the old directory. * * (This is OK because we know we aren't inside a transaction block.) * - * XXX would it be safe/better to do this inside the ensure block? Not + * XXX would it be safe/better to do this inside the ensure block? Not * convinced it's a good idea; consider elog just after the transaction * really commits. */ @@ -1389,7 +1391,7 @@ AlterDatabase(AlterDatabaseStmt *stmt, bool isTopLevel) } newtuple = heap_modify_tuple(tuple, RelationGetDescr(rel), new_record, - new_record_nulls, new_record_repl); + new_record_nulls, new_record_repl); simple_heap_update(rel, &tuple->t_self, newtuple); /* Update indexes */ @@ -1482,7 +1484,7 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt) } newtuple = heap_modify_tuple(tuple, RelationGetDescr(rel), - repl_val, repl_null, repl_repl); + repl_val, repl_null, repl_repl); simple_heap_update(rel, &tuple->t_self, newtuple); /* Update indexes */ @@ -1720,11 +1722,11 @@ get_db_info(const char *name, LOCKMODE lockmode, /* default tablespace for this database */ if (dbTablespace) *dbTablespace = dbform->dattablespace; - /* default locale settings for this database */ - if (dbCollate) - *dbCollate = pstrdup(NameStr(dbform->datcollate)); - if (dbCtype) - *dbCtype = pstrdup(NameStr(dbform->datctype)); + /* default locale settings for this database */ + if (dbCollate) + *dbCollate = pstrdup(NameStr(dbform->datcollate)); + if (dbCtype) + *dbCtype = pstrdup(NameStr(dbform->datctype)); ReleaseSysCache(tuple); result = true; break; diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index d8f27a1175..45e8edf595 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994-5, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.185 2009/04/05 19:59:39 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.186 2009/06/11 14:48:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -61,7 +61,7 @@ static void explain_outNode(StringInfo str, Plan *outer_plan, int indent, ExplainState *es); static void show_plan_tlist(Plan *plan, - StringInfo str, int indent, ExplainState *es); + StringInfo str, int indent, ExplainState *es); static void show_scan_qual(List *qual, const char *qlabel, int scanrelid, Plan *scan_plan, Plan *outer_plan, StringInfo str, int indent, ExplainState *es); @@ -342,7 +342,7 @@ void ExplainPrintPlan(StringInfo str, QueryDesc *queryDesc, bool analyze, bool verbose) { - ExplainState es; + ExplainState es; Assert(queryDesc->plannedstmt != NULL); diff --git a/src/backend/commands/foreigncmds.c b/src/backend/commands/foreigncmds.c index 74021efdae..79706b0837 100644 --- a/src/backend/commands/foreigncmds.c +++ b/src/backend/commands/foreigncmds.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/foreigncmds.c,v 1.7 2009/04/04 21:12:31 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/foreigncmds.c,v 1.8 2009/06/11 14:48:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -47,8 +47,8 @@ static Datum optionListToArray(List *options) { - ArrayBuildState *astate = NULL; - ListCell *cell; + ArrayBuildState *astate = NULL; + ListCell *cell; foreach(cell, options) { @@ -76,7 +76,7 @@ optionListToArray(List *options) /* - * Transform a list of DefElem into text array format. This is substantially + * Transform a list of DefElem into text array format. This is substantially * the same thing as optionListToArray(), except we recognize SET/ADD/DROP * actions for modifying an existing list of options, which is passed in * Datum form as oldOptions. Also, if fdwvalidator isn't InvalidOid @@ -92,23 +92,23 @@ transformGenericOptions(Datum oldOptions, List *options, Oid fdwvalidator) { - List *resultOptions = untransformRelOptions(oldOptions); - ListCell *optcell; - Datum result; + List *resultOptions = untransformRelOptions(oldOptions); + ListCell *optcell; + Datum result; foreach(optcell, options) { - DefElem *od = lfirst(optcell); + DefElem *od = lfirst(optcell); ListCell *cell; ListCell *prev = NULL; /* - * Find the element in resultOptions. We need this for - * validation in all cases. Also identify the previous element. + * Find the element in resultOptions. We need this for validation in + * all cases. Also identify the previous element. */ - foreach (cell, resultOptions) + foreach(cell, resultOptions) { - DefElem *def = lfirst(cell); + DefElem *def = lfirst(cell); if (strcmp(def->defname, od->defname) == 0) break; @@ -117,10 +117,10 @@ transformGenericOptions(Datum oldOptions, } /* - * It is possible to perform multiple SET/DROP actions on the - * same option. The standard permits this, as long as the - * options to be added are unique. Note that an unspecified - * action is taken to be ADD. + * It is possible to perform multiple SET/DROP actions on the same + * option. The standard permits this, as long as the options to be + * added are unique. Note that an unspecified action is taken to be + * ADD. */ switch (od->defaction) { @@ -174,16 +174,16 @@ transformGenericOptions(Datum oldOptions, static Oid GetUserOidFromMapping(const char *username, bool missing_ok) { - if (!username) - /* PUBLIC user mapping */ - return InvalidOid; + if (!username) + /* PUBLIC user mapping */ + return InvalidOid; - if (strcmp(username, "current_user") == 0) - /* map to the owner */ - return GetUserId(); + if (strcmp(username, "current_user") == 0) + /* map to the owner */ + return GetUserId(); - /* map to provided user */ - return missing_ok ? get_roleid(username) : get_roleid_checked(username); + /* map to provided user */ + return missing_ok ? get_roleid(username) : get_roleid_checked(username); } @@ -201,7 +201,7 @@ AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId) Oid fdwId; Form_pg_foreign_data_wrapper form; - /* Must be a superuser to change a FDW owner */ + /* Must be a superuser to change a FDW owner */ if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), @@ -209,13 +209,13 @@ AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId) name), errhint("Must be superuser to change owner of a foreign-data wrapper."))); - /* New owner must also be a superuser */ + /* New owner must also be a superuser */ if (!superuser_arg(newOwnerId)) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("permission denied to change owner of foreign-data wrapper \"%s\"", name), - errhint("The owner of a foreign-data wrapper must be a superuser."))); + errhint("The owner of a foreign-data wrapper must be a superuser."))); rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock); @@ -226,7 +226,7 @@ AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId) if (!HeapTupleIsValid(tup)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("foreign-data wrapper \"%s\" does not exist", name))); + errmsg("foreign-data wrapper \"%s\" does not exist", name))); fdwId = HeapTupleGetOid(tup); form = (Form_pg_foreign_data_wrapper) GETSTRUCT(tup); @@ -268,9 +268,9 @@ AlterForeignServerOwner(const char *name, Oid newOwnerId) 0, 0, 0); if (!HeapTupleIsValid(tup)) - ereport(ERROR, - (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("server \"%s\" does not exist", name))); + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("server \"%s\" does not exist", name))); srvId = HeapTupleGetOid(tup); form = (Form_pg_foreign_server) GETSTRUCT(tup); @@ -334,22 +334,22 @@ lookup_fdw_validator_func(List *validator) void CreateForeignDataWrapper(CreateFdwStmt *stmt) { - Relation rel; - Datum values[Natts_pg_foreign_data_wrapper]; - bool nulls[Natts_pg_foreign_data_wrapper]; - HeapTuple tuple; - Oid fdwId; - Oid fdwvalidator; - Datum fdwoptions; - Oid ownerId; + Relation rel; + Datum values[Natts_pg_foreign_data_wrapper]; + bool nulls[Natts_pg_foreign_data_wrapper]; + HeapTuple tuple; + Oid fdwId; + Oid fdwvalidator; + Datum fdwoptions; + Oid ownerId; /* Must be super user */ if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("permission denied to create foreign-data wrapper \"%s\"", - stmt->fdwname), - errhint("Must be superuser to create a foreign-data wrapper."))); + errmsg("permission denied to create foreign-data wrapper \"%s\"", + stmt->fdwname), + errhint("Must be superuser to create a foreign-data wrapper."))); /* For now the owner cannot be specified on create. Use effective user ID. */ ownerId = GetUserId(); @@ -440,9 +440,9 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt) if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("permission denied to alter foreign-data wrapper \"%s\"", - stmt->fdwname), - errhint("Must be superuser to alter a foreign-data wrapper."))); + errmsg("permission denied to alter foreign-data wrapper \"%s\"", + stmt->fdwname), + errhint("Must be superuser to alter a foreign-data wrapper."))); tp = SearchSysCacheCopy(FOREIGNDATAWRAPPERNAME, CStringGetDatum(stmt->fdwname), @@ -451,7 +451,7 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt) if (!HeapTupleIsValid(tp)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("foreign-data wrapper \"%s\" does not exist", stmt->fdwname))); + errmsg("foreign-data wrapper \"%s\" does not exist", stmt->fdwname))); fdwId = HeapTupleGetOid(tp); @@ -467,18 +467,17 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt) /* * It could be that the options for the FDW, SERVER and USER MAPPING - * are no longer valid with the new validator. Warn about this. + * are no longer valid with the new validator. Warn about this. */ if (stmt->validator) ereport(WARNING, - (errmsg("changing the foreign-data wrapper validator can cause " - "the options for dependent objects to become invalid"))); + (errmsg("changing the foreign-data wrapper validator can cause " + "the options for dependent objects to become invalid"))); } else { /* - * Validator is not changed, but we need it for validating - * options. + * Validator is not changed, but we need it for validating options. */ datum = SysCacheGetAttr(FOREIGNDATAWRAPPEROID, tp, @@ -517,7 +516,7 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt) rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock); tp = heap_modify_tuple(tp, RelationGetDescr(rel), - repl_val, repl_null, repl_repl); + repl_val, repl_null, repl_repl); simple_heap_update(rel, &tp->t_self, tp); CatalogUpdateIndexes(rel, tp); @@ -533,30 +532,30 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt) void RemoveForeignDataWrapper(DropFdwStmt *stmt) { - Oid fdwId; - ObjectAddress object; + Oid fdwId; + ObjectAddress object; fdwId = GetForeignDataWrapperOidByName(stmt->fdwname, true); if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("permission denied to drop foreign-data wrapper \"%s\"", - stmt->fdwname), - errhint("Must be superuser to drop a foreign-data wrapper."))); + errmsg("permission denied to drop foreign-data wrapper \"%s\"", + stmt->fdwname), + errhint("Must be superuser to drop a foreign-data wrapper."))); if (!OidIsValid(fdwId)) { if (!stmt->missing_ok) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("foreign-data wrapper \"%s\" does not exist", - stmt->fdwname))); + errmsg("foreign-data wrapper \"%s\" does not exist", + stmt->fdwname))); /* IF EXISTS specified, just note it */ ereport(NOTICE, - (errmsg("foreign-data wrapper \"%s\" does not exist, skipping", - stmt->fdwname))); + (errmsg("foreign-data wrapper \"%s\" does not exist, skipping", + stmt->fdwname))); return; } @@ -603,16 +602,16 @@ RemoveForeignDataWrapperById(Oid fdwId) void CreateForeignServer(CreateForeignServerStmt *stmt) { - Relation rel; - Datum srvoptions; - Datum values[Natts_pg_foreign_server]; - bool nulls[Natts_pg_foreign_server]; - HeapTuple tuple; - Oid srvId; - Oid ownerId; - AclResult aclresult; - ObjectAddress myself; - ObjectAddress referenced; + Relation rel; + Datum srvoptions; + Datum values[Natts_pg_foreign_server]; + bool nulls[Natts_pg_foreign_server]; + HeapTuple tuple; + Oid srvId; + Oid ownerId; + AclResult aclresult; + ObjectAddress myself; + ObjectAddress referenced; ForeignDataWrapper *fdw; /* For now the owner cannot be specified on create. Use effective user ID. */ @@ -628,8 +627,8 @@ CreateForeignServer(CreateForeignServerStmt *stmt) stmt->servername))); /* - * Check that the FDW exists and that we have USAGE on it. - * Also get the actual FDW for option validation etc. + * Check that the FDW exists and that we have USAGE on it. Also get the + * actual FDW for option validation etc. */ fdw = GetForeignDataWrapperByName(stmt->fdwname, false); @@ -712,7 +711,7 @@ AlterForeignServer(AlterForeignServerStmt *stmt) bool repl_null[Natts_pg_foreign_server]; bool repl_repl[Natts_pg_foreign_server]; Oid srvId; - Form_pg_foreign_server srvForm; + Form_pg_foreign_server srvForm; tp = SearchSysCacheCopy(FOREIGNSERVERNAME, CStringGetDatum(stmt->servername), @@ -721,7 +720,7 @@ AlterForeignServer(AlterForeignServerStmt *stmt) if (!HeapTupleIsValid(tp)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("server \"%s\" does not exist", stmt->servername))); + errmsg("server \"%s\" does not exist", stmt->servername))); srvId = HeapTupleGetOid(tp); srvForm = (Form_pg_foreign_server) GETSTRUCT(tp); @@ -754,8 +753,8 @@ AlterForeignServer(AlterForeignServerStmt *stmt) if (stmt->options) { ForeignDataWrapper *fdw = GetForeignDataWrapper(srvForm->srvfdw); - Datum datum; - bool isnull; + Datum datum; + bool isnull; /* Extract the current srvoptions */ datum = SysCacheGetAttr(FOREIGNSERVEROID, @@ -782,7 +781,7 @@ AlterForeignServer(AlterForeignServerStmt *stmt) rel = heap_open(ForeignServerRelationId, RowExclusiveLock); tp = heap_modify_tuple(tp, RelationGetDescr(rel), - repl_val, repl_null, repl_repl); + repl_val, repl_null, repl_repl); simple_heap_update(rel, &tp->t_self, tp); CatalogUpdateIndexes(rel, tp); @@ -798,8 +797,8 @@ AlterForeignServer(AlterForeignServerStmt *stmt) void RemoveForeignServer(DropForeignServerStmt *stmt) { - Oid srvId; - ObjectAddress object; + Oid srvId; + ObjectAddress object; srvId = GetForeignServerOidByName(stmt->servername, true); @@ -809,7 +808,7 @@ RemoveForeignServer(DropForeignServerStmt *stmt) if (!stmt->missing_ok) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("server \"%s\" does not exist", stmt->servername))); + errmsg("server \"%s\" does not exist", stmt->servername))); /* IF EXISTS specified, just note it */ ereport(NOTICE, @@ -871,7 +870,7 @@ user_mapping_ddl_aclcheck(Oid umuserid, Oid serverid, const char *servername) { if (umuserid == curuserid) { - AclResult aclresult; + AclResult aclresult; aclresult = pg_foreign_server_aclcheck(serverid, curuserid, ACL_USAGE); if (aclresult != ACLCHECK_OK) @@ -890,16 +889,16 @@ user_mapping_ddl_aclcheck(Oid umuserid, Oid serverid, const char *servername) void CreateUserMapping(CreateUserMappingStmt *stmt) { - Relation rel; - Datum useoptions; - Datum values[Natts_pg_user_mapping]; - bool nulls[Natts_pg_user_mapping]; - HeapTuple tuple; - Oid useId; - Oid umId; - ObjectAddress myself; - ObjectAddress referenced; - ForeignServer *srv; + Relation rel; + Datum useoptions; + Datum values[Natts_pg_user_mapping]; + bool nulls[Natts_pg_user_mapping]; + HeapTuple tuple; + Oid useId; + Oid umId; + ObjectAddress myself; + ObjectAddress referenced; + ForeignServer *srv; ForeignDataWrapper *fdw; useId = GetUserOidFromMapping(stmt->username, false); @@ -913,9 +912,9 @@ CreateUserMapping(CreateUserMappingStmt *stmt) * Check that the user mapping is unique within server. */ umId = GetSysCacheOid(USERMAPPINGUSERSERVER, - ObjectIdGetDatum(useId), - ObjectIdGetDatum(srv->serverid), - 0, 0); + ObjectIdGetDatum(useId), + ObjectIdGetDatum(srv->serverid), + 0, 0); if (OidIsValid(umId)) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), @@ -984,7 +983,7 @@ AlterUserMapping(AlterUserMappingStmt *stmt) bool repl_repl[Natts_pg_user_mapping]; Oid useId; Oid umId; - ForeignServer *srv; + ForeignServer *srv; useId = GetUserOidFromMapping(stmt->username, false); srv = GetForeignServerByName(stmt->servername, false); @@ -996,8 +995,8 @@ AlterUserMapping(AlterUserMappingStmt *stmt) if (!OidIsValid(umId)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("user mapping \"%s\" does not exist for the server", - MappingUserName(useId)))); + errmsg("user mapping \"%s\" does not exist for the server", + MappingUserName(useId)))); user_mapping_ddl_aclcheck(useId, srv->serverid, stmt->servername); @@ -1014,9 +1013,9 @@ AlterUserMapping(AlterUserMappingStmt *stmt) if (stmt->options) { - ForeignDataWrapper *fdw; - Datum datum; - bool isnull; + ForeignDataWrapper *fdw; + Datum datum; + bool isnull; /* * Process the options. @@ -1048,7 +1047,7 @@ AlterUserMapping(AlterUserMappingStmt *stmt) rel = heap_open(UserMappingRelationId, RowExclusiveLock); tp = heap_modify_tuple(tp, RelationGetDescr(rel), - repl_val, repl_null, repl_repl); + repl_val, repl_null, repl_repl); simple_heap_update(rel, &tp->t_self, tp); CatalogUpdateIndexes(rel, tp); @@ -1064,10 +1063,10 @@ AlterUserMapping(AlterUserMappingStmt *stmt) void RemoveUserMapping(DropUserMappingStmt *stmt) { - ObjectAddress object; - Oid useId; - Oid umId; - ForeignServer *srv; + ObjectAddress object; + Oid useId; + Oid umId; + ForeignServer *srv; useId = GetUserOidFromMapping(stmt->username, stmt->missing_ok); srv = GetForeignServerByName(stmt->servername, true); @@ -1075,8 +1074,8 @@ RemoveUserMapping(DropUserMappingStmt *stmt) if (stmt->username && !OidIsValid(useId)) { /* - * IF EXISTS specified, role not found and not public. - * Notice this and leave. + * IF EXISTS specified, role not found and not public. Notice this and + * leave. */ elog(NOTICE, "role \"%s\" does not exist, skipping", stmt->username); return; @@ -1087,8 +1086,8 @@ RemoveUserMapping(DropUserMappingStmt *stmt) if (!stmt->missing_ok) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("server \"%s\" does not exist", - stmt->servername))); + errmsg("server \"%s\" does not exist", + stmt->servername))); /* IF EXISTS, just note it */ ereport(NOTICE, (errmsg("server does not exist, skipping"))); return; @@ -1104,13 +1103,13 @@ RemoveUserMapping(DropUserMappingStmt *stmt) if (!stmt->missing_ok) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("user mapping \"%s\" does not exist for the server", - MappingUserName(useId)))); + errmsg("user mapping \"%s\" does not exist for the server", + MappingUserName(useId)))); /* IF EXISTS specified, just note it */ ereport(NOTICE, - (errmsg("user mapping \"%s\" does not exist for the server, skipping", - MappingUserName(useId)))); + (errmsg("user mapping \"%s\" does not exist for the server, skipping", + MappingUserName(useId)))); return; } diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c index a6dd2cb6db..2151fd94f0 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.109 2009/03/04 11:53:53 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.110 2009/06/11 14:48:55 momjian Exp $ * * DESCRIPTION * These routines take the parse tree and pick out the @@ -274,7 +274,7 @@ examine_parameter_list(List *parameters, Oid languageOid, if (!OidIsValid(get_element_type(toid))) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("VARIADIC parameter must be an array"))); + errmsg("VARIADIC parameter must be an array"))); break; } } @@ -291,12 +291,12 @@ examine_parameter_list(List *parameters, Oid languageOid, if (fp->defexpr) { - Node *def; + Node *def; if (!isinput) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("only input parameters can have default values"))); + errmsg("only input parameters can have default values"))); def = transformExpr(pstate, fp->defexpr); def = coerce_to_specific_type(pstate, def, toid, "DEFAULT"); @@ -324,7 +324,7 @@ examine_parameter_list(List *parameters, Oid languageOid, if (pstate->p_hasSubLinks) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot use subquery in parameter default value"))); + errmsg("cannot use subquery in parameter default value"))); if (pstate->p_hasAggs) ereport(ERROR, (errcode(ERRCODE_GROUPING_ERROR), @@ -685,7 +685,7 @@ interpret_AS_clause(Oid languageOid, const char *languageName, { /* * For "C" language, store the file name in probin and, when given, - * the link symbol name in prosrc. If link symbol is omitted, + * the link symbol name in prosrc. If link symbol is omitted, * substitute procedure name. We also allow link symbol to be * specified as "-", since that was the habit in PG versions before * 8.4, and there might be dump files out there that don't translate @@ -1243,7 +1243,7 @@ AlterFunctionOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId) } newtuple = heap_modify_tuple(tup, RelationGetDescr(rel), repl_val, - repl_null, repl_repl); + repl_null, repl_repl); simple_heap_update(rel, &newtuple->t_self, newtuple); CatalogUpdateIndexes(rel, newtuple); @@ -1375,7 +1375,7 @@ AlterFunction(AlterFunctionStmt *stmt) } tup = heap_modify_tuple(tup, RelationGetDescr(rel), - repl_val, repl_null, repl_repl); + repl_val, repl_null, repl_repl); } /* Do the update */ @@ -1513,7 +1513,7 @@ CreateCast(CreateCastStmt *stmt) /* Detemine the cast method */ if (stmt->func != NULL) castmethod = COERCION_METHOD_FUNCTION; - else if(stmt->inout) + else if (stmt->inout) castmethod = COERCION_METHOD_INOUT; else castmethod = COERCION_METHOD_BINARY; @@ -1541,7 +1541,7 @@ CreateCast(CreateCastStmt *stmt) if (!IsBinaryCoercible(sourcetypeid, procstruct->proargtypes.values[0])) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("argument of cast function must match or be binary-coercible from source data type"))); + errmsg("argument of cast function must match or be binary-coercible from source data type"))); if (nargs > 1 && procstruct->proargtypes.values[1] != INT4OID) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), @@ -1573,7 +1573,7 @@ CreateCast(CreateCastStmt *stmt) if (procstruct->proiswindow) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("cast function must not be a window function"))); + errmsg("cast function must not be a window function"))); if (procstruct->proretset) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), @@ -1622,7 +1622,7 @@ CreateCast(CreateCastStmt *stmt) /* * We know that composite, enum and array types are never binary- - * compatible with each other. They all have OIDs embedded in them. + * compatible with each other. They all have OIDs embedded in them. * * Theoretically you could build a user-defined base type that is * binary-compatible with a composite, enum, or array type. But we @@ -1633,7 +1633,7 @@ CreateCast(CreateCastStmt *stmt) targettyptype == TYPTYPE_COMPOSITE) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("composite data types are not binary-compatible"))); + errmsg("composite data types are not binary-compatible"))); if (sourcetyptype == TYPTYPE_ENUM || targettyptype == TYPTYPE_ENUM) diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index f2ff5b6da2..c6a01f5b75 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.184 2009/04/04 17:40:36 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.185 2009/06/11 14:48:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -639,25 +639,25 @@ DefineIndex(RangeVar *heapRelation, * We can exclude any running transactions that have xmin > the xmin of * our reference snapshot; their oldest snapshot must be newer than ours. * We can also exclude any transactions that have xmin = zero, since they - * evidently have no live snapshot at all (and any one they might be - * in process of taking is certainly newer than ours). Transactions in - * other DBs can be ignored too, since they'll never even be able to see - * this index. + * evidently have no live snapshot at all (and any one they might be in + * process of taking is certainly newer than ours). Transactions in other + * DBs can be ignored too, since they'll never even be able to see this + * index. * * We can also exclude autovacuum processes and processes running manual * lazy VACUUMs, because they won't be fazed by missing index entries - * either. (Manual ANALYZEs, however, can't be excluded because they + * either. (Manual ANALYZEs, however, can't be excluded because they * might be within transactions that are going to do arbitrary operations * later.) * * Also, GetCurrentVirtualXIDs never reports our own vxid, so we need not * check for that. * - * If a process goes idle-in-transaction with xmin zero, we do not need - * to wait for it anymore, per the above argument. We do not have the - * infrastructure right now to stop waiting if that happens, but we can - * at least avoid the folly of waiting when it is idle at the time we - * would begin to wait. We do this by repeatedly rechecking the output of + * If a process goes idle-in-transaction with xmin zero, we do not need to + * wait for it anymore, per the above argument. We do not have the + * infrastructure right now to stop waiting if that happens, but we can at + * least avoid the folly of waiting when it is idle at the time we would + * begin to wait. We do this by repeatedly rechecking the output of * GetCurrentVirtualXIDs. If, during any iteration, a particular vxid * doesn't show up in the output, we know we can forget about it. */ @@ -680,12 +680,12 @@ DefineIndex(RangeVar *heapRelation, newer_snapshots = GetCurrentVirtualXIDs(snapshot->xmin, true, false, - PROC_IS_AUTOVACUUM | PROC_IN_VACUUM, + PROC_IS_AUTOVACUUM | PROC_IN_VACUUM, &n_newer_snapshots); for (j = i; j < n_old_snapshots; j++) { if (!VirtualTransactionIdIsValid(old_snapshots[j])) - continue; /* found uninteresting in previous cycle */ + continue; /* found uninteresting in previous cycle */ for (k = 0; k < n_newer_snapshots; k++) { if (VirtualTransactionIdEquals(old_snapshots[j], @@ -1058,7 +1058,7 @@ GetDefaultOpClass(Oid type_id, Oid am_id) ScanKeyData skey[1]; SysScanDesc scan; HeapTuple tup; - TYPCATEGORY tcategory; + TYPCATEGORY tcategory; /* If it's a domain, look at the base type instead */ type_id = getBaseType(type_id); diff --git a/src/backend/commands/lockcmds.c b/src/backend/commands/lockcmds.c index 1e9b5dd961..043d68ac7a 100644 --- a/src/backend/commands/lockcmds.c +++ b/src/backend/commands/lockcmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/lockcmds.c,v 1.24 2009/05/12 16:43:32 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/lockcmds.c,v 1.25 2009/06/11 14:48:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -25,7 +25,7 @@ #include "utils/lsyscache.h" static void LockTableRecurse(Oid reloid, RangeVar *rv, - LOCKMODE lockmode, bool nowait, bool recurse); + LOCKMODE lockmode, bool nowait, bool recurse); /* @@ -67,9 +67,9 @@ LockTableRecurse(Oid reloid, RangeVar *rv, AclResult aclresult; /* - * Acquire the lock. We must do this first to protect against - * concurrent drops. Note that a lock against an already-dropped - * relation's OID won't fail. + * Acquire the lock. We must do this first to protect against concurrent + * drops. Note that a lock against an already-dropped relation's OID + * won't fail. */ if (nowait) { @@ -148,8 +148,8 @@ LockTableRecurse(Oid reloid, RangeVar *rv, */ if (recurse) { - List *children = find_inheritance_children(reloid, NoLock); - ListCell *lc; + List *children = find_inheritance_children(reloid, NoLock); + ListCell *lc; foreach(lc, children) { diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c index 0e454f8d02..daa8549e49 100644 --- a/src/backend/commands/operatorcmds.c +++ b/src/backend/commands/operatorcmds.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.42 2009/01/01 17:23:39 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.43 2009/06/11 14:48:56 momjian Exp $ * * DESCRIPTION * The "DefineFoo" routines take the parse tree and pick out the @@ -188,9 +188,9 @@ DefineOperator(List *names, List *parameters) functionOid = LookupFuncName(functionName, nargs, typeId, false); /* - * We require EXECUTE rights for the function. This isn't strictly - * necessary, since EXECUTE will be checked at any attempted use of - * the operator, but it seems like a good idea anyway. + * We require EXECUTE rights for the function. This isn't strictly + * necessary, since EXECUTE will be checked at any attempted use of the + * operator, but it seems like a good idea anyway. */ aclresult = pg_proc_aclcheck(functionOid, GetUserId(), ACL_EXECUTE); if (aclresult != ACLCHECK_OK) @@ -237,9 +237,9 @@ DefineOperator(List *names, List *parameters) typeId[4] = INTERNALOID; /* SpecialJoinInfo */ /* - * As of Postgres 8.4, the preferred signature for join estimators - * has 5 arguments, but we still allow the old 4-argument form. - * Try the preferred form first. + * As of Postgres 8.4, the preferred signature for join estimators has + * 5 arguments, but we still allow the old 4-argument form. Try the + * preferred form first. */ joinOid = LookupFuncName(joinName, 5, typeId, true); if (!OidIsValid(joinOid)) @@ -252,8 +252,8 @@ DefineOperator(List *names, List *parameters) if (get_func_rettype(joinOid) != FLOAT8OID) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("join estimator function %s must return type \"float8\"", - NameListToString(joinName)))); + errmsg("join estimator function %s must return type \"float8\"", + NameListToString(joinName)))); /* Require EXECUTE rights for the estimator */ aclresult = pg_proc_aclcheck(joinOid, GetUserId(), ACL_EXECUTE); @@ -271,7 +271,7 @@ DefineOperator(List *names, List *parameters) oprNamespace, /* namespace */ typeId1, /* left type id */ typeId2, /* right type id */ - functionOid, /* function for operator */ + functionOid, /* function for operator */ commutatorName, /* optional commutator operator name */ negatorName, /* optional negator operator name */ restrictionOid, /* optional restrict. sel. procedure */ diff --git a/src/backend/commands/portalcmds.c b/src/backend/commands/portalcmds.c index 9940b92df5..1719234173 100644 --- a/src/backend/commands/portalcmds.c +++ b/src/backend/commands/portalcmds.c @@ -14,7 +14,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.78 2009/01/01 17:23:39 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.79 2009/06/11 14:48:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -352,8 +352,8 @@ PersistHoldablePortal(Portal portal) ExecutorRewind(queryDesc); /* - * Change the destination to output to the tuplestore. Note we - * tell the tuplestore receiver to detoast all data passed through it. + * Change the destination to output to the tuplestore. Note we tell + * the tuplestore receiver to detoast all data passed through it. */ queryDesc->dest = CreateDestReceiver(DestTuplestore); SetTuplestoreDestReceiverParams(queryDesc->dest, diff --git a/src/backend/commands/prepare.c b/src/backend/commands/prepare.c index e1c0edb8e8..0e948e4b72 100644 --- a/src/backend/commands/prepare.c +++ b/src/backend/commands/prepare.c @@ -10,7 +10,7 @@ * Copyright (c) 2002-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.96 2009/01/02 20:42:00 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.97 2009/06/11 14:48:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -350,7 +350,7 @@ EvaluateParams(PreparedStatement *pstmt, List *params, if (pstate->p_hasWindowFuncs) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), - errmsg("cannot use window function in EXECUTE parameter"))); + errmsg("cannot use window function in EXECUTE parameter"))); given_type_id = exprType(expr); diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c index 9d30d57a57..afb61981ce 100644 --- a/src/backend/commands/proclang.c +++ b/src/backend/commands/proclang.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.84 2009/01/01 17:23:39 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.85 2009/06/11 14:48:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -140,7 +140,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) pltemplate->tmplhandler, pltemplate->tmpllibrary, false, /* isAgg */ - false, /* isWindowFunc */ + false, /* isWindowFunc */ false, /* security_definer */ false, /* isStrict */ PROVOLATILE_VOLATILE, @@ -175,7 +175,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) pltemplate->tmplvalidator, pltemplate->tmpllibrary, false, /* isAgg */ - false, /* isWindowFunc */ + false, /* isWindowFunc */ false, /* security_definer */ false, /* isStrict */ PROVOLATILE_VOLATILE, @@ -635,7 +635,7 @@ AlterLanguageOwner_internal(HeapTuple tup, Relation rel, Oid newOwnerId) } newtuple = heap_modify_tuple(tup, RelationGetDescr(rel), - repl_val, repl_null, repl_repl); + repl_val, repl_null, repl_repl); simple_heap_update(rel, &newtuple->t_self, newtuple); CatalogUpdateIndexes(rel, newtuple); diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c index 5b5c466ea9..5680da3657 100644 --- a/src/backend/commands/schemacmds.c +++ b/src/backend/commands/schemacmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.52 2009/01/01 17:23:39 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.53 2009/06/11 14:48:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -87,8 +87,8 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString) * temporarily set the current user so that the object(s) will be created * with the correct ownership. * - * (The setting will be restored at the end of this routine, or in case - * of error, transaction abort will clean things up.) + * (The setting will be restored at the end of this routine, or in case of + * error, transaction abort will clean things up.) */ if (saved_uid != owner_uid) SetUserIdAndContext(owner_uid, true); @@ -155,12 +155,12 @@ void RemoveSchemas(DropStmt *drop) { ObjectAddresses *objects; - ListCell *cell; + ListCell *cell; /* * First we identify all the schemas, then we delete them in a single - * performMultipleDeletions() call. This is to avoid unwanted - * DROP RESTRICT errors if one of the schemas depends on another. + * performMultipleDeletions() call. This is to avoid unwanted DROP + * RESTRICT errors if one of the schemas depends on another. */ objects = new_object_addresses(); diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c index 4da934970c..e6c75ab014 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.159 2009/04/04 21:12:31 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.160 2009/06/11 14:48:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -1199,8 +1199,8 @@ init_params(List *options, bool isInit, snprintf(bufm, sizeof(bufm), INT64_FORMAT, new->min_value); ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("RESTART value (%s) cannot be less than MINVALUE (%s)", - bufs, bufm))); + errmsg("RESTART value (%s) cannot be less than MINVALUE (%s)", + bufs, bufm))); } if (new->last_value > new->max_value) { @@ -1211,8 +1211,8 @@ init_params(List *options, bool isInit, snprintf(bufm, sizeof(bufm), INT64_FORMAT, new->max_value); ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("RESTART value (%s) cannot be greater than MAXVALUE (%s)", - bufs, bufm))); + errmsg("RESTART value (%s) cannot be greater than MAXVALUE (%s)", + bufs, bufm))); } /* CACHE */ diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index bc077c9d09..56bf67eef4 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.285 2009/05/20 08:48:10 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.286 2009/06/11 14:48:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -137,7 +137,7 @@ typedef struct AlteredTableInfo List *constraints; /* List of NewConstraint */ List *newvals; /* List of NewColumnValue */ bool new_notnull; /* T if we added new NOT NULL constraints */ - bool new_changeoids; /* T if we added/dropped the OID column */ + bool new_changeoids; /* T if we added/dropped the OID column */ Oid newTableSpace; /* new tablespace; 0 means no change */ /* Objects to rebuild after completing ALTER TYPE operations */ List *changedConstraintOids; /* OIDs of constraints to rebuild */ @@ -187,35 +187,35 @@ struct dropmsgstrings static const struct dropmsgstrings dropmsgstringarray[] = { {RELKIND_RELATION, - ERRCODE_UNDEFINED_TABLE, - gettext_noop("table \"%s\" does not exist"), - gettext_noop("table \"%s\" does not exist, skipping"), - gettext_noop("\"%s\" is not a table"), - gettext_noop("Use DROP TABLE to remove a table.")}, + ERRCODE_UNDEFINED_TABLE, + gettext_noop("table \"%s\" does not exist"), + gettext_noop("table \"%s\" does not exist, skipping"), + gettext_noop("\"%s\" is not a table"), + gettext_noop("Use DROP TABLE to remove a table.")}, {RELKIND_SEQUENCE, - ERRCODE_UNDEFINED_TABLE, - gettext_noop("sequence \"%s\" does not exist"), - gettext_noop("sequence \"%s\" does not exist, skipping"), - gettext_noop("\"%s\" is not a sequence"), - gettext_noop("Use DROP SEQUENCE to remove a sequence.")}, + ERRCODE_UNDEFINED_TABLE, + gettext_noop("sequence \"%s\" does not exist"), + gettext_noop("sequence \"%s\" does not exist, skipping"), + gettext_noop("\"%s\" is not a sequence"), + gettext_noop("Use DROP SEQUENCE to remove a sequence.")}, {RELKIND_VIEW, - ERRCODE_UNDEFINED_TABLE, - gettext_noop("view \"%s\" does not exist"), - gettext_noop("view \"%s\" does not exist, skipping"), - gettext_noop("\"%s\" is not a view"), - gettext_noop("Use DROP VIEW to remove a view.")}, + ERRCODE_UNDEFINED_TABLE, + gettext_noop("view \"%s\" does not exist"), + gettext_noop("view \"%s\" does not exist, skipping"), + gettext_noop("\"%s\" is not a view"), + gettext_noop("Use DROP VIEW to remove a view.")}, {RELKIND_INDEX, - ERRCODE_UNDEFINED_OBJECT, - gettext_noop("index \"%s\" does not exist"), - gettext_noop("index \"%s\" does not exist, skipping"), - gettext_noop("\"%s\" is not an index"), - gettext_noop("Use DROP INDEX to remove an index.")}, + ERRCODE_UNDEFINED_OBJECT, + gettext_noop("index \"%s\" does not exist"), + gettext_noop("index \"%s\" does not exist, skipping"), + gettext_noop("\"%s\" is not an index"), + gettext_noop("Use DROP INDEX to remove an index.")}, {RELKIND_COMPOSITE_TYPE, - ERRCODE_UNDEFINED_OBJECT, - gettext_noop("type \"%s\" does not exist"), - gettext_noop("type \"%s\" does not exist, skipping"), - gettext_noop("\"%s\" is not a type"), - gettext_noop("Use DROP TYPE to remove a type.")}, + ERRCODE_UNDEFINED_OBJECT, + gettext_noop("type \"%s\" does not exist"), + gettext_noop("type \"%s\" does not exist, skipping"), + gettext_noop("\"%s\" is not a type"), + gettext_noop("Use DROP TYPE to remove a type.")}, {'\0', 0, NULL, NULL, NULL, NULL} }; @@ -256,7 +256,7 @@ static void ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd, bool recurse, bool recursing); static void ATRewriteCatalogs(List **wqueue); static void ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel, - AlterTableCmd *cmd); + AlterTableCmd *cmd); static void ATRewriteTables(List **wqueue); static void ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap); static AlteredTableInfo *ATGetQueueEntry(List **wqueue, Relation rel); @@ -272,7 +272,7 @@ static void ATExecAddColumn(AlteredTableInfo *tab, Relation rel, ColumnDef *colDef, bool isOid); static void add_column_datatype_dependency(Oid relid, int32 attnum, Oid typid); static void ATPrepAddOids(List **wqueue, Relation rel, bool recurse, - AlterTableCmd *cmd); + AlterTableCmd *cmd); static void ATExecDropNotNull(Relation rel, const char *colName); static void ATExecSetNotNull(AlteredTableInfo *tab, Relation rel, const char *colName); @@ -290,17 +290,17 @@ static void ATExecDropColumn(List **wqueue, Relation rel, const char *colName, static void ATExecAddIndex(AlteredTableInfo *tab, Relation rel, IndexStmt *stmt, bool is_rebuild); static void ATExecAddConstraint(List **wqueue, - AlteredTableInfo *tab, Relation rel, - Node *newConstraint, bool recurse); + AlteredTableInfo *tab, Relation rel, + Node *newConstraint, bool recurse); static void ATAddCheckConstraint(List **wqueue, - AlteredTableInfo *tab, Relation rel, - Constraint *constr, - bool recurse, bool recursing); + AlteredTableInfo *tab, Relation rel, + Constraint *constr, + bool recurse, bool recursing); static void ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel, FkConstraint *fkconstraint); static void ATExecDropConstraint(Relation rel, const char *constrName, - DropBehavior behavior, - bool recurse, bool recursing); + DropBehavior behavior, + bool recurse, bool recursing); static void ATPrepAlterColumnType(List **wqueue, AlteredTableInfo *tab, Relation rel, bool recurse, bool recursing, @@ -324,7 +324,7 @@ static void ATExecEnableDisableRule(Relation rel, char *rulename, static void ATExecAddInherit(Relation rel, RangeVar *parent); static void ATExecDropInherit(Relation rel, RangeVar *parent); static void copy_relation_data(SMgrRelation rel, SMgrRelation dst, - ForkNumber forkNum, bool istemp); + ForkNumber forkNum, bool istemp); /* ---------------------------------------------------------------- @@ -353,7 +353,7 @@ DefineRelation(CreateStmt *stmt, char relkind) Datum reloptions; ListCell *listptr; AttrNumber attnum; - static char *validnsps[] = HEAP_RELOPT_NAMESPACES; + static char *validnsps[] = HEAP_RELOPT_NAMESPACES; /* * Truncate relname to appropriate length (probably a waste of time, as @@ -435,7 +435,7 @@ DefineRelation(CreateStmt *stmt, char relkind) &inheritOids, &old_constraints, &parentOidCount); /* - * Create a tuple descriptor from the relation schema. Note that this + * Create a tuple descriptor from the relation schema. Note that this * deals with column names, types, and NOT NULL constraints, but not * default values or CHECK constraints; we handle those below. */ @@ -448,9 +448,9 @@ DefineRelation(CreateStmt *stmt, char relkind) * Find columns with default values and prepare for insertion of the * defaults. Pre-cooked (that is, inherited) defaults go into a list of * CookedConstraint structs that we'll pass to heap_create_with_catalog, - * while raw defaults go into a list of RawColumnDefault structs that - * will be processed by AddRelationNewConstraints. (We can't deal with - * raw expressions until we can do transformExpr.) + * while raw defaults go into a list of RawColumnDefault structs that will + * be processed by AddRelationNewConstraints. (We can't deal with raw + * expressions until we can do transformExpr.) * * We can set the atthasdef flags now in the tuple descriptor; this just * saves StoreAttrDefault from having to do an immediate update of the @@ -495,9 +495,9 @@ DefineRelation(CreateStmt *stmt, char relkind) } /* - * Create the relation. Inherited defaults and constraints are passed - * in for immediate handling --- since they don't need parsing, they - * can be stored immediately. + * Create the relation. Inherited defaults and constraints are passed in + * for immediate handling --- since they don't need parsing, they can be + * stored immediately. */ relationId = heap_create_with_catalog(relname, namespaceId, @@ -606,7 +606,7 @@ DropErrorMsgWrongType(const char *relname, char wrongkind, char rightkind) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg(rentry->nota_msg, relname), - (wentry->kind != '\0') ? errhint("%s", _(wentry->drophint_msg)) : 0)); + (wentry->kind != '\0') ? errhint("%s", _(wentry->drophint_msg)) : 0)); } /* @@ -622,8 +622,8 @@ RemoveRelations(DropStmt *drop) /* * First we identify all the relations, then we delete them in a single - * performMultipleDeletions() call. This is to avoid unwanted - * DROP RESTRICT errors if one of the relations depends on another. + * performMultipleDeletions() call. This is to avoid unwanted DROP + * RESTRICT errors if one of the relations depends on another. */ /* Determine required relkind */ @@ -648,7 +648,7 @@ RemoveRelations(DropStmt *drop) default: elog(ERROR, "unrecognized drop object type: %d", (int) drop->removeType); - relkind = 0; /* keep compiler quiet */ + relkind = 0; /* keep compiler quiet */ break; } @@ -862,11 +862,11 @@ ExecuteTruncate(TruncateStmt *stmt) #endif /* - * If we are asked to restart sequences, find all the sequences, - * lock them (we only need AccessShareLock because that's all that - * ALTER SEQUENCE takes), and check permissions. We want to do this - * early since it's pointless to do all the truncation work only to fail - * on sequence permissions. + * If we are asked to restart sequences, find all the sequences, lock them + * (we only need AccessShareLock because that's all that ALTER SEQUENCE + * takes), and check permissions. We want to do this early since it's + * pointless to do all the truncation work only to fail on sequence + * permissions. */ if (stmt->restart_seqs) { @@ -878,8 +878,8 @@ ExecuteTruncate(TruncateStmt *stmt) foreach(seqcell, seqlist) { - Oid seq_relid = lfirst_oid(seqcell); - Relation seq_rel; + Oid seq_relid = lfirst_oid(seqcell); + Relation seq_rel; seq_rel = relation_open(seq_relid, AccessShareLock); @@ -899,8 +899,8 @@ ExecuteTruncate(TruncateStmt *stmt) AfterTriggerBeginQuery(); /* - * To fire triggers, we'll need an EState as well as a ResultRelInfo - * for each relation. + * To fire triggers, we'll need an EState as well as a ResultRelInfo for + * each relation. */ estate = CreateExecutorState(); resultRelInfos = (ResultRelInfo *) @@ -912,7 +912,7 @@ ExecuteTruncate(TruncateStmt *stmt) InitResultRelInfo(resultRelInfo, rel, - 0, /* dummy rangetable index */ + 0, /* dummy rangetable index */ CMD_DELETE, /* don't need any index info */ false); resultRelInfo++; @@ -922,9 +922,9 @@ ExecuteTruncate(TruncateStmt *stmt) /* * Process all BEFORE STATEMENT TRUNCATE triggers before we begin - * truncating (this is because one of them might throw an error). - * Also, if we were to allow them to prevent statement execution, - * that would need to be handled here. + * truncating (this is because one of them might throw an error). Also, if + * we were to allow them to prevent statement execution, that would need + * to be handled here. */ resultRelInfo = resultRelInfos; foreach(cell, rels) @@ -996,18 +996,18 @@ ExecuteTruncate(TruncateStmt *stmt) /* * Lastly, restart any owned sequences if we were asked to. This is done - * last because it's nontransactional: restarts will not roll back if - * we abort later. Hence it's important to postpone them as long as + * last because it's nontransactional: restarts will not roll back if we + * abort later. Hence it's important to postpone them as long as * possible. (This is also a big reason why we locked and * permission-checked the sequences beforehand.) */ if (stmt->restart_seqs) { - List *options = list_make1(makeDefElem("restart", NULL)); + List *options = list_make1(makeDefElem("restart", NULL)); foreach(cell, seq_relids) { - Oid seq_relid = lfirst_oid(cell); + Oid seq_relid = lfirst_oid(cell); AlterSequenceInternal(seq_relid, options); } @@ -1361,7 +1361,7 @@ MergeAttributes(List *schema, List *supers, bool istemp, /* * Now copy the CHECK constraints of this parent, adjusting attnos - * using the completed newattno[] map. Identically named constraints + * using the completed newattno[] map. Identically named constraints * are merged if possible, else we throw error. */ if (constr && constr->num_check > 0) @@ -1387,7 +1387,7 @@ MergeAttributes(List *schema, List *supers, bool istemp, cooked = (CookedConstraint *) palloc(sizeof(CookedConstraint)); cooked->contype = CONSTR_CHECK; cooked->name = pstrdup(name); - cooked->attnum = 0; /* not used for constraints */ + cooked->attnum = 0; /* not used for constraints */ cooked->expr = expr; cooked->is_local = false; cooked->inhcount = 1; @@ -2052,8 +2052,8 @@ RenameRelation(Oid myrelid, const char *newrelname, ObjectType reltype) RelationGetRelationName(targetrelation)))); /* - * Don't allow ALTER TABLE on composite types. - * We want people to use ALTER TYPE for that. + * Don't allow ALTER TABLE on composite types. We want people to use ALTER + * TYPE for that. */ if (relkind == RELKIND_COMPOSITE_TYPE) ereport(ERROR, @@ -2089,8 +2089,8 @@ RenameRelationInternal(Oid myrelid, const char *newrelname, Oid namespaceId) Form_pg_class relform; /* - * Grab an exclusive lock on the target table, index, sequence or - * view, which we will NOT release until end of transaction. + * Grab an exclusive lock on the target table, index, sequence or view, + * which we will NOT release until end of transaction. */ targetrelation = relation_open(myrelid, AccessExclusiveLock); @@ -2166,7 +2166,7 @@ RenameRelationInternal(Oid myrelid, const char *newrelname, Oid namespaceId) * We also reject these commands if there are any pending AFTER trigger events * for the rel. This is certainly necessary for the rewriting variants of * ALTER TABLE, because they don't preserve tuple TIDs and so the pending - * events would try to fetch the wrong tuples. It might be overly cautious + * events would try to fetch the wrong tuples. It might be overly cautious * in other cases, but again it seems better to err on the side of paranoia. * * REINDEX calls this with "rel" referencing the index to be rebuilt; here @@ -2184,7 +2184,7 @@ CheckTableNotInUse(Relation rel, const char *stmt) if (rel->rd_refcnt != expected_refcnt) ereport(ERROR, (errcode(ERRCODE_OBJECT_IN_USE), - /* translator: first %s is a SQL command, eg ALTER TABLE */ + /* translator: first %s is a SQL command, eg ALTER TABLE */ errmsg("cannot %s \"%s\" because " "it is being used by active queries in this session", stmt, RelationGetRelationName(rel)))); @@ -2193,7 +2193,7 @@ CheckTableNotInUse(Relation rel, const char *stmt) AfterTriggerPendingOnRel(RelationGetRelid(rel))) ereport(ERROR, (errcode(ERRCODE_OBJECT_IN_USE), - /* translator: first %s is a SQL command, eg ALTER TABLE */ + /* translator: first %s is a SQL command, eg ALTER TABLE */ errmsg("cannot %s \"%s\" because " "it has pending trigger events", stmt, RelationGetRelationName(rel)))); @@ -2220,7 +2220,7 @@ CheckTableNotInUse(Relation rel, const char *stmt) * expressions that need to be evaluated with respect to the old table * schema. * - * ATRewriteCatalogs performs phase 2 for each affected table. (Note that + * ATRewriteCatalogs performs phase 2 for each affected table. (Note that * phases 2 and 3 normally do no explicit recursion, since phase 1 already * did it --- although some subcommands have to recurse in phase 2 instead.) * Certain subcommands need to be performed before others to avoid @@ -2244,9 +2244,10 @@ AlterTable(AlterTableStmt *stmt) switch (stmt->relkind) { case OBJECT_TABLE: + /* - * For mostly-historical reasons, we allow ALTER TABLE to apply - * to all relation types. + * For mostly-historical reasons, we allow ALTER TABLE to apply to + * all relation types. */ break; @@ -2363,7 +2364,8 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd, ATPrepAddColumn(wqueue, rel, recurse, cmd); pass = AT_PASS_ADD_COL; break; - case AT_AddColumnToView: /* add column via CREATE OR REPLACE VIEW */ + case AT_AddColumnToView: /* add column via CREATE OR REPLACE + * VIEW */ ATSimplePermissions(rel, true); /* Performs own recursion */ ATPrepAddColumn(wqueue, rel, recurse, cmd); @@ -2597,7 +2599,8 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel, switch (cmd->subtype) { case AT_AddColumn: /* ADD COLUMN */ - case AT_AddColumnToView: /* add column via CREATE OR REPLACE VIEW */ + case AT_AddColumnToView: /* add column via CREATE OR REPLACE + * VIEW */ ATExecAddColumn(tab, rel, (ColumnDef *) cmd->def, false); break; case AT_ColumnDefault: /* ALTER COLUMN DEFAULT */ @@ -3539,8 +3542,8 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, if (isOid && childatt->attnum != ObjectIdAttributeNumber) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("child table \"%s\" has a conflicting \"%s\" column", - RelationGetRelationName(rel), colDef->colname))); + errmsg("child table \"%s\" has a conflicting \"%s\" column", + RelationGetRelationName(rel), colDef->colname))); /* Bump the existing child att's inhcount */ childatt->attinhcount++; @@ -3690,10 +3693,10 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, * returned by AddRelationNewConstraints, so that the right thing happens * when a datatype's default applies. * - * We skip this step completely for views. For a view, we can only get + * We skip this step completely for views. For a view, we can only get * here from CREATE OR REPLACE VIEW, which historically doesn't set up - * defaults, not even for domain-typed columns. And in any case we mustn't - * invoke Phase 3 on a view, since it has no storage. + * defaults, not even for domain-typed columns. And in any case we + * mustn't invoke Phase 3 on a view, since it has no storage. */ if (relkind != RELKIND_VIEW && attribute.attnum > 0) { @@ -3715,7 +3718,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, COERCION_ASSIGNMENT, COERCE_IMPLICIT_CAST, -1); - if (defval == NULL) /* should not happen */ + if (defval == NULL) /* should not happen */ elog(ERROR, "failed to coerce base type to domain"); } @@ -3740,8 +3743,8 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, } /* - * If we are adding an OID column, we have to tell Phase 3 to rewrite - * the table to fix that. + * If we are adding an OID column, we have to tell Phase 3 to rewrite the + * table to fix that. */ if (isOid) tab->new_changeoids = true; @@ -3773,7 +3776,7 @@ add_column_datatype_dependency(Oid relid, int32 attnum, Oid typid) /* * ALTER TABLE SET WITH OIDS * - * Basically this is an ADD COLUMN for the special OID column. We have + * Basically this is an ADD COLUMN for the special OID column. We have * to cons up a ColumnDef node because the ADD COLUMN code needs one. */ static void @@ -4295,8 +4298,8 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName, performDeletion(&object, behavior); /* - * If we dropped the OID column, must adjust pg_class.relhasoids and - * tell Phase 3 to physically get rid of the column. + * If we dropped the OID column, must adjust pg_class.relhasoids and tell + * Phase 3 to physically get rid of the column. */ if (attnum == ObjectIdAttributeNumber) { @@ -4410,8 +4413,8 @@ ATExecAddConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel, FkConstraint *fkconstraint = (FkConstraint *) newConstraint; /* - * Note that we currently never recurse for FK constraints, - * so the "recurse" flag is silently ignored. + * Note that we currently never recurse for FK constraints, so + * the "recurse" flag is silently ignored. * * Assign or validate constraint name */ @@ -4473,8 +4476,8 @@ ATAddCheckConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel, /* * Call AddRelationNewConstraints to do the work, making sure it works on - * a copy of the Constraint so transformExpr can't modify the original. - * It returns a list of cooked constraints. + * a copy of the Constraint so transformExpr can't modify the original. It + * returns a list of cooked constraints. * * If the constraint ends up getting merged with a pre-existing one, it's * omitted from the returned list, which is what we want: we do not need @@ -4584,7 +4587,8 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel, pkrel = heap_openrv(fkconstraint->pktable, AccessExclusiveLock); /* - * Validity checks (permission checks wait till we have the column numbers) + * Validity checks (permission checks wait till we have the column + * numbers) */ if (pkrel->rd_rel->relkind != RELKIND_RELATION) ereport(ERROR, @@ -4810,8 +4814,8 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel, NULL, /* no check constraint */ NULL, NULL, - true, /* islocal */ - 0); /* inhcount */ + true, /* islocal */ + 0); /* inhcount */ /* * Create the triggers that will enforce the constraint. @@ -5400,9 +5404,9 @@ ATExecDropConstraint(Relation rel, const char *constrName, /* Don't drop inherited constraints */ if (con->coninhcount > 0 && !recursing) ereport(ERROR, - (errcode(ERRCODE_INVALID_TABLE_DEFINITION), - errmsg("cannot drop inherited constraint \"%s\" of relation \"%s\"", - constrName, RelationGetRelationName(rel)))); + (errcode(ERRCODE_INVALID_TABLE_DEFINITION), + errmsg("cannot drop inherited constraint \"%s\" of relation \"%s\"", + constrName, RelationGetRelationName(rel)))); /* Right now only CHECK constraints can be inherited */ if (con->contype == CONSTRAINT_CHECK) @@ -5459,7 +5463,7 @@ ATExecDropConstraint(Relation rel, const char *constrName, while (HeapTupleIsValid(tuple = systable_getnext(scan))) { - HeapTuple copy_tuple; + HeapTuple copy_tuple; con = (Form_pg_constraint) GETSTRUCT(tuple); @@ -5472,7 +5476,7 @@ ATExecDropConstraint(Relation rel, const char *constrName, found = true; - if (con->coninhcount <= 0) /* shouldn't happen */ + if (con->coninhcount <= 0) /* shouldn't happen */ elog(ERROR, "relation %u has non-inherited constraint \"%s\"", childrelid, constrName); @@ -5482,9 +5486,9 @@ ATExecDropConstraint(Relation rel, const char *constrName, if (recurse) { /* - * If the child constraint has other definition sources, - * just decrement its inheritance count; if not, recurse - * to delete it. + * If the child constraint has other definition sources, just + * decrement its inheritance count; if not, recurse to delete + * it. */ if (con->coninhcount == 1 && !con->conislocal) { @@ -5506,9 +5510,9 @@ ATExecDropConstraint(Relation rel, const char *constrName, else { /* - * If we were told to drop ONLY in this table (no - * recursion), we need to mark the inheritors' constraints - * as locally defined rather than inherited. + * If we were told to drop ONLY in this table (no recursion), + * we need to mark the inheritors' constraints as locally + * defined rather than inherited. */ con->coninhcount--; con->conislocal = true; @@ -5528,9 +5532,9 @@ ATExecDropConstraint(Relation rel, const char *constrName, if (!found) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("constraint \"%s\" of relation \"%s\" does not exist", - constrName, - RelationGetRelationName(childrel)))); + errmsg("constraint \"%s\" of relation \"%s\" does not exist", + constrName, + RelationGetRelationName(childrel)))); heap_close(childrel, NoLock); } @@ -5628,7 +5632,7 @@ ATPrepAlterColumnType(List **wqueue, if (pstate->p_hasWindowFuncs) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), - errmsg("cannot use window function in transform expression"))); + errmsg("cannot use window function in transform expression"))); } else { @@ -5745,8 +5749,8 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, if (defaultexpr == NULL) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("default for column \"%s\" cannot be cast to type %s", - colName, format_type_be(targettype)))); + errmsg("default for column \"%s\" cannot be cast to type %s", + colName, format_type_be(targettype)))); } else defaultexpr = NULL; @@ -6536,7 +6540,7 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset) Datum repl_val[Natts_pg_class]; bool repl_null[Natts_pg_class]; bool repl_repl[Natts_pg_class]; - static char *validnsps[] = HEAP_RELOPT_NAMESPACES; + static char *validnsps[] = HEAP_RELOPT_NAMESPACES; if (defList == NIL) return; /* nothing to do */ @@ -6555,7 +6559,7 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset) /* Generate new proposed reloptions (text array) */ newOptions = transformRelOptions(isnull ? (Datum) 0 : datum, - defList, NULL, validnsps, false, isReset); + defList, NULL, validnsps, false, isReset); /* Validate */ switch (rel->rd_rel->relkind) @@ -6591,7 +6595,7 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset) repl_repl[Anum_pg_class_reloptions - 1] = true; newtuple = heap_modify_tuple(tuple, RelationGetDescr(pgclass), - repl_val, repl_null, repl_repl); + repl_val, repl_null, repl_repl); simple_heap_update(pgclass, &newtuple->t_self, newtuple); @@ -6619,7 +6623,7 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset) datum = SysCacheGetAttr(RELOID, tuple, Anum_pg_class_reloptions, &isnull); newOptions = transformRelOptions(isnull ? (Datum) 0 : datum, - defList, "toast", validnsps, false, isReset); + defList, "toast", validnsps, false, isReset); (void) heap_reloptions(RELKIND_TOASTVALUE, newOptions, true); @@ -6749,11 +6753,11 @@ ATExecSetTableSpace(Oid tableOid, Oid newTableSpace) RelationOpenSmgr(rel); /* - * Create and copy all forks of the relation, and schedule unlinking - * of old physical files. + * Create and copy all forks of the relation, and schedule unlinking of + * old physical files. * * NOTE: any conflict in relfilenode value will be caught in - * RelationCreateStorage(). + * RelationCreateStorage(). */ RelationCreateStorage(newrnode, rel->rd_istemp); @@ -7163,11 +7167,11 @@ MergeConstraintsIntoExisting(Relation child_rel, Relation parent_rel) while (HeapTupleIsValid(parent_tuple = systable_getnext(parent_scan))) { - Form_pg_constraint parent_con = (Form_pg_constraint) GETSTRUCT(parent_tuple); - SysScanDesc child_scan; - ScanKeyData child_key; - HeapTuple child_tuple; - bool found = false; + Form_pg_constraint parent_con = (Form_pg_constraint) GETSTRUCT(parent_tuple); + SysScanDesc child_scan; + ScanKeyData child_key; + HeapTuple child_tuple; + bool found = false; if (parent_con->contype != CONSTRAINT_CHECK) continue; @@ -7182,8 +7186,8 @@ MergeConstraintsIntoExisting(Relation child_rel, Relation parent_rel) while (HeapTupleIsValid(child_tuple = systable_getnext(child_scan))) { - Form_pg_constraint child_con = (Form_pg_constraint) GETSTRUCT(child_tuple); - HeapTuple child_copy; + Form_pg_constraint child_con = (Form_pg_constraint) GETSTRUCT(child_tuple); + HeapTuple child_copy; if (child_con->contype != CONSTRAINT_CHECK) continue; @@ -7344,8 +7348,8 @@ ATExecDropInherit(Relation rel, RangeVar *parent) heap_close(catalogRelation, RowExclusiveLock); /* - * Likewise, find inherited check constraints and disinherit them. - * To do this, we first need a list of the names of the parent's check + * Likewise, find inherited check constraints and disinherit them. To do + * this, we first need a list of the names of the parent's check * constraints. (We cheat a bit by only checking for name matches, * assuming that the expressions will match.) */ @@ -7380,14 +7384,14 @@ ATExecDropInherit(Relation rel, RangeVar *parent) while (HeapTupleIsValid(constraintTuple = systable_getnext(scan))) { Form_pg_constraint con = (Form_pg_constraint) GETSTRUCT(constraintTuple); - bool match; - ListCell *lc; + bool match; + ListCell *lc; if (con->contype != CONSTRAINT_CHECK) continue; match = false; - foreach (lc, connames) + foreach(lc, connames) { if (strcmp(NameStr(con->conname), (char *) lfirst(lc)) == 0) { @@ -7401,6 +7405,7 @@ ATExecDropInherit(Relation rel, RangeVar *parent) /* Decrement inhcount and possibly set islocal to true */ HeapTuple copyTuple = heap_copytuple(constraintTuple); Form_pg_constraint copy_con = (Form_pg_constraint) GETSTRUCT(copyTuple); + if (copy_con->coninhcount <= 0) /* shouldn't happen */ elog(ERROR, "relation %u has non-inherited constraint \"%s\"", RelationGetRelid(rel), NameStr(copy_con->conname)); @@ -7484,9 +7489,10 @@ AlterTableNamespace(RangeVar *relation, const char *newschema, switch (stmttype) { case OBJECT_TABLE: + /* - * For mostly-historical reasons, we allow ALTER TABLE to apply - * to all relation types. + * For mostly-historical reasons, we allow ALTER TABLE to apply to + * all relation types. */ break; diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index ce276e5fe5..08d9593de9 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.246 2009/01/22 20:16:02 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.247 2009/06/11 14:48:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -274,8 +274,8 @@ CreateTrigger(CreateTrigStmt *stmt, Oid constraintOid, bool checkPermissions) } /* - * Scan pg_trigger for existing triggers on relation. We do this only - * to give a nice error message if there's already a trigger of the same + * Scan pg_trigger for existing triggers on relation. We do this only to + * give a nice error message if there's already a trigger of the same * name. (The unique index on tgrelid/tgname would complain anyway.) * * NOTE that this is cool only because we have AccessExclusiveLock on the @@ -857,12 +857,12 @@ RemoveTriggerById(Oid trigOid) /* * We do not bother to try to determine whether any other triggers remain, - * which would be needed in order to decide whether it's safe to clear - * the relation's relhastriggers. (In any case, there might be a - * concurrent process adding new triggers.) Instead, just force a - * relcache inval to make other backends (and this one too!) rebuild - * their relcache entries. There's no great harm in leaving relhastriggers - * true even if there are no triggers left. + * which would be needed in order to decide whether it's safe to clear the + * relation's relhastriggers. (In any case, there might be a concurrent + * process adding new triggers.) Instead, just force a relcache inval to + * make other backends (and this one too!) rebuild their relcache entries. + * There's no great harm in leaving relhastriggers true even if there are + * no triggers left. */ CacheInvalidateRelcache(rel); @@ -1118,8 +1118,8 @@ RelationBuildTriggers(Relation relation) int i; /* - * Allocate a working array to hold the triggers (the array is extended - * if necessary) + * Allocate a working array to hold the triggers (the array is extended if + * necessary) */ maxtrigs = 16; triggers = (Trigger *) palloc(maxtrigs * sizeof(Trigger)); @@ -2095,8 +2095,8 @@ ExecBSTruncateTriggers(EState *estate, ResultRelInfo *relinfo) if (newtuple) ereport(ERROR, - (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED), - errmsg("BEFORE STATEMENT trigger cannot return a value"))); + (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED), + errmsg("BEFORE STATEMENT trigger cannot return a value"))); } } @@ -2264,7 +2264,7 @@ typedef SetConstraintStateData *SetConstraintState; * Per-trigger-event data * * The actual per-event data, AfterTriggerEventData, includes DONE/IN_PROGRESS - * status bits and one or two tuple CTIDs. Each event record also has an + * status bits and one or two tuple CTIDs. Each event record also has an * associated AfterTriggerSharedData that is shared across all instances * of similar events within a "chunk". * @@ -2278,12 +2278,13 @@ typedef SetConstraintStateData *SetConstraintState; * Although this is mutable state, we can keep it in AfterTriggerSharedData * because all instances of the same type of event in a given event list will * be fired at the same time, if they were queued between the same firing - * cycles. So we need only ensure that ats_firing_id is zero when attaching + * cycles. So we need only ensure that ats_firing_id is zero when attaching * a new event to an existing AfterTriggerSharedData record. */ typedef uint32 TriggerFlags; -#define AFTER_TRIGGER_OFFSET 0x0FFFFFFF /* must be low-order bits */ +#define AFTER_TRIGGER_OFFSET 0x0FFFFFFF /* must be low-order + * bits */ #define AFTER_TRIGGER_2CTIDS 0x10000000 #define AFTER_TRIGGER_DONE 0x20000000 #define AFTER_TRIGGER_IN_PROGRESS 0x40000000 @@ -2324,13 +2325,13 @@ typedef struct AfterTriggerEventDataOneCtid /* * To avoid palloc overhead, we keep trigger events in arrays in successively- * larger chunks (a slightly more sophisticated version of an expansible - * array). The space between CHUNK_DATA_START and freeptr is occupied by + * array). The space between CHUNK_DATA_START and freeptr is occupied by * AfterTriggerEventData records; the space between endfree and endptr is * occupied by AfterTriggerSharedData records. */ typedef struct AfterTriggerEventChunk { - struct AfterTriggerEventChunk *next; /* list link */ + struct AfterTriggerEventChunk *next; /* list link */ char *freeptr; /* start of free space in chunk */ char *endfree; /* end of free space in chunk */ char *endptr; /* end of chunk */ @@ -2555,9 +2556,9 @@ afterTriggerAddEvent(AfterTriggerEventList *events, /* check number of shared records in preceding chunk */ if ((chunk->endptr - chunk->endfree) <= (100 * sizeof(AfterTriggerSharedData))) - chunksize *= 2; /* okay, double it */ + chunksize *= 2; /* okay, double it */ else - chunksize /= 2; /* too many shared records */ + chunksize /= 2; /* too many shared records */ chunksize = Min(chunksize, MAX_CHUNK_SIZE); } chunk = MemoryContextAlloc(afterTriggers->event_cxt, chunksize); @@ -2574,8 +2575,8 @@ afterTriggerAddEvent(AfterTriggerEventList *events, } /* - * Try to locate a matching shared-data record already in the chunk. - * If none, make a new one. + * Try to locate a matching shared-data record already in the chunk. If + * none, make a new one. */ for (newshared = ((AfterTriggerShared) chunk->endptr) - 1; (char *) newshared >= chunk->endfree; @@ -2590,7 +2591,7 @@ afterTriggerAddEvent(AfterTriggerEventList *events, if ((char *) newshared < chunk->endfree) { *newshared = *evtshared; - newshared->ats_firing_id = 0; /* just to be sure */ + newshared->ats_firing_id = 0; /* just to be sure */ chunk->endfree = (char *) newshared; } @@ -2658,6 +2659,7 @@ afterTriggerRestoreEventList(AfterTriggerEventList *events, /* and clean up the tail chunk to be the right length */ events->tail->next = NULL; events->tail->freeptr = events->tailfree; + /* * We don't make any effort to remove now-unused shared data records. * They might still be useful, anyway. @@ -2940,7 +2942,7 @@ afterTriggerInvokeEvents(AfterTriggerEventList *events, trigdesc = rInfo->ri_TrigDesc; finfo = rInfo->ri_TrigFunctions; instr = rInfo->ri_TrigInstrument; - if (trigdesc == NULL) /* should not happen */ + if (trigdesc == NULL) /* should not happen */ elog(ERROR, "relation %u has no triggers", evtshared->ats_relid); } @@ -3015,7 +3017,7 @@ AfterTriggerBeginXact(void) MemoryContextAlloc(TopTransactionContext, sizeof(AfterTriggersData)); - afterTriggers->firing_counter = (CommandId) 1; /* mustn't be 0 */ + afterTriggers->firing_counter = (CommandId) 1; /* mustn't be 0 */ afterTriggers->state = SetConstraintStateCreate(8); afterTriggers->events.head = NULL; afterTriggers->events.tail = NULL; @@ -3348,8 +3350,8 @@ AfterTriggerEndSubXact(bool isCommit) else { /* - * Aborting. Release any event lists from queries being aborted, - * and restore query_depth to its pre-subxact value. + * Aborting. Release any event lists from queries being aborted, and + * restore query_depth to its pre-subxact value. */ while (afterTriggers->query_depth > afterTriggers->depth_stack[my_level]) { @@ -3721,7 +3723,7 @@ AfterTriggerSetState(ConstraintsSetStmt *stmt) /* * Make sure a snapshot has been established in case trigger - * functions need one. Note that we avoid setting a snapshot if + * functions need one. Note that we avoid setting a snapshot if * we don't find at least one trigger that has to be fired now. * This is so that BEGIN; SET CONSTRAINTS ...; SET TRANSACTION * ISOLATION LEVEL SERIALIZABLE; ... works properly. (If we are diff --git a/src/backend/commands/tsearchcmds.c b/src/backend/commands/tsearchcmds.c index 7276cd50d4..5339e1783c 100644 --- a/src/backend/commands/tsearchcmds.c +++ b/src/backend/commands/tsearchcmds.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/tsearchcmds.c,v 1.16 2009/01/22 20:16:02 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/tsearchcmds.c,v 1.17 2009/06/11 14:48:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -275,7 +275,7 @@ void RemoveTSParsers(DropStmt *drop) { ObjectAddresses *objects; - ListCell *cell; + ListCell *cell; if (!superuser()) ereport(ERROR, @@ -284,14 +284,14 @@ RemoveTSParsers(DropStmt *drop) /* * First we identify all the objects, then we delete them in a single - * performMultipleDeletions() call. This is to avoid unwanted - * DROP RESTRICT errors if one of the objects depends on another. + * performMultipleDeletions() call. This is to avoid unwanted DROP + * RESTRICT errors if one of the objects depends on another. */ objects = new_object_addresses(); foreach(cell, drop->objects) { - List *names = (List *) lfirst(cell); + List *names = (List *) lfirst(cell); Oid prsOid; ObjectAddress object; @@ -309,8 +309,8 @@ RemoveTSParsers(DropStmt *drop) else { ereport(NOTICE, - (errmsg("text search parser \"%s\" does not exist, skipping", - NameListToString(names)))); + (errmsg("text search parser \"%s\" does not exist, skipping", + NameListToString(names)))); } continue; } @@ -636,18 +636,18 @@ void RemoveTSDictionaries(DropStmt *drop) { ObjectAddresses *objects; - ListCell *cell; + ListCell *cell; /* * First we identify all the objects, then we delete them in a single - * performMultipleDeletions() call. This is to avoid unwanted - * DROP RESTRICT errors if one of the objects depends on another. + * performMultipleDeletions() call. This is to avoid unwanted DROP + * RESTRICT errors if one of the objects depends on another. */ objects = new_object_addresses(); foreach(cell, drop->objects) { - List *names = (List *) lfirst(cell); + List *names = (List *) lfirst(cell); Oid dictOid; ObjectAddress object; HeapTuple tup; @@ -661,14 +661,14 @@ RemoveTSDictionaries(DropStmt *drop) { ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("text search dictionary \"%s\" does not exist", - NameListToString(names)))); + errmsg("text search dictionary \"%s\" does not exist", + NameListToString(names)))); } else { ereport(NOTICE, - (errmsg("text search dictionary \"%s\" does not exist, skipping", - NameListToString(names)))); + (errmsg("text search dictionary \"%s\" does not exist, skipping", + NameListToString(names)))); } continue; } @@ -676,7 +676,7 @@ RemoveTSDictionaries(DropStmt *drop) tup = SearchSysCache(TSDICTOID, ObjectIdGetDatum(dictOid), 0, 0, 0); - if (!HeapTupleIsValid(tup)) /* should not happen */ + if (!HeapTupleIsValid(tup)) /* should not happen */ elog(ERROR, "cache lookup failed for text search dictionary %u", dictOid); @@ -824,7 +824,7 @@ AlterTSDictionary(AlterTSDictionaryStmt *stmt) repl_repl[Anum_pg_ts_dict_dictinitoption - 1] = true; newtup = heap_modify_tuple(tup, RelationGetDescr(rel), - repl_val, repl_null, repl_repl); + repl_val, repl_null, repl_repl); simple_heap_update(rel, &newtup->t_self, newtup); @@ -1127,7 +1127,7 @@ void RemoveTSTemplates(DropStmt *drop) { ObjectAddresses *objects; - ListCell *cell; + ListCell *cell; if (!superuser()) ereport(ERROR, @@ -1136,14 +1136,14 @@ RemoveTSTemplates(DropStmt *drop) /* * First we identify all the objects, then we delete them in a single - * performMultipleDeletions() call. This is to avoid unwanted - * DROP RESTRICT errors if one of the objects depends on another. + * performMultipleDeletions() call. This is to avoid unwanted DROP + * RESTRICT errors if one of the objects depends on another. */ objects = new_object_addresses(); foreach(cell, drop->objects) { - List *names = (List *) lfirst(cell); + List *names = (List *) lfirst(cell); Oid tmplOid; ObjectAddress object; @@ -1534,18 +1534,18 @@ void RemoveTSConfigurations(DropStmt *drop) { ObjectAddresses *objects; - ListCell *cell; + ListCell *cell; /* * First we identify all the objects, then we delete them in a single - * performMultipleDeletions() call. This is to avoid unwanted - * DROP RESTRICT errors if one of the objects depends on another. + * performMultipleDeletions() call. This is to avoid unwanted DROP + * RESTRICT errors if one of the objects depends on another. */ objects = new_object_addresses(); foreach(cell, drop->objects) { - List *names = (List *) lfirst(cell); + List *names = (List *) lfirst(cell); Oid cfgOid; Oid namespaceId; ObjectAddress object; @@ -1559,8 +1559,8 @@ RemoveTSConfigurations(DropStmt *drop) { ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("text search configuration \"%s\" does not exist", - NameListToString(names)))); + errmsg("text search configuration \"%s\" does not exist", + NameListToString(names)))); } else { @@ -1923,8 +1923,8 @@ MakeConfigurationMapping(AlterTSConfigurationStmt *stmt, repl_repl[Anum_pg_ts_config_map_mapdict - 1] = true; newtup = heap_modify_tuple(maptup, - RelationGetDescr(relMap), - repl_val, repl_null, repl_repl); + RelationGetDescr(relMap), + repl_val, repl_null, repl_repl); simple_heap_update(relMap, &newtup->t_self, newtup); CatalogUpdateIndexes(relMap, newtup); diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c index cfbc2a75ae..f791c53fe4 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.133 2009/04/04 21:12:31 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.134 2009/06/11 14:48:56 momjian Exp $ * * DESCRIPTION * The "DefineFoo" routines take the parse tree and pick out the @@ -115,23 +115,23 @@ DefineType(List *names, List *parameters) bool byValue = false; char alignment = 'i'; /* default alignment */ char storage = 'p'; /* default TOAST storage method */ - DefElem *likeTypeEl = NULL; - DefElem *internalLengthEl = NULL; - DefElem *inputNameEl = NULL; - DefElem *outputNameEl = NULL; - DefElem *receiveNameEl = NULL; - DefElem *sendNameEl = NULL; - DefElem *typmodinNameEl = NULL; - DefElem *typmodoutNameEl = NULL; - DefElem *analyzeNameEl = NULL; - DefElem *categoryEl = NULL; - DefElem *preferredEl = NULL; - DefElem *delimiterEl = NULL; - DefElem *elemTypeEl = NULL; - DefElem *defaultValueEl = NULL; - DefElem *byValueEl = NULL; - DefElem *alignmentEl = NULL; - DefElem *storageEl = NULL; + DefElem *likeTypeEl = NULL; + DefElem *internalLengthEl = NULL; + DefElem *inputNameEl = NULL; + DefElem *outputNameEl = NULL; + DefElem *receiveNameEl = NULL; + DefElem *sendNameEl = NULL; + DefElem *typmodinNameEl = NULL; + DefElem *typmodoutNameEl = NULL; + DefElem *analyzeNameEl = NULL; + DefElem *categoryEl = NULL; + DefElem *preferredEl = NULL; + DefElem *delimiterEl = NULL; + DefElem *elemTypeEl = NULL; + DefElem *defaultValueEl = NULL; + DefElem *byValueEl = NULL; + DefElem *alignmentEl = NULL; + DefElem *storageEl = NULL; Oid inputOid; Oid outputOid; Oid receiveOid = InvalidOid; @@ -150,8 +150,8 @@ DefineType(List *names, List *parameters) * As of Postgres 8.4, we require superuser privilege to create a base * type. This is simple paranoia: there are too many ways to mess up the * system with an incorrect type definition (for instance, representation - * parameters that don't match what the C code expects). In practice - * it takes superuser privilege to create the I/O functions, and so the + * parameters that don't match what the C code expects). In practice it + * takes superuser privilege to create the I/O functions, and so the * former requirement that you own the I/O functions pretty much forced * superuserness anyway. We're just making doubly sure here. * @@ -277,13 +277,13 @@ DefineType(List *names, List *parameters) } /* - * Now interpret the options; we do this separately so that LIKE can - * be overridden by other options regardless of the ordering in the - * parameter list. + * Now interpret the options; we do this separately so that LIKE can be + * overridden by other options regardless of the ordering in the parameter + * list. */ if (likeTypeEl) { - Type likeType; + Type likeType; Form_pg_type likeForm; likeType = typenameType(NULL, defGetTypeName(likeTypeEl), NULL); @@ -319,8 +319,8 @@ DefineType(List *names, List *parameters) if (category < 32 || category > 126) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid type category \"%s\": must be simple ASCII", - p))); + errmsg("invalid type category \"%s\": must be simple ASCII", + p))); } if (preferredEl) preferred = defGetBoolean(preferredEl); @@ -351,8 +351,8 @@ DefineType(List *names, List *parameters) /* * Note: if argument was an unquoted identifier, parser will have - * applied translations to it, so be prepared to recognize - * translated type names as well as the nominal form. + * applied translations to it, so be prepared to recognize translated + * type names as well as the nominal form. */ if (pg_strcasecmp(a, "double") == 0 || pg_strcasecmp(a, "float8") == 0 || @@ -536,7 +536,7 @@ DefineType(List *names, List *parameters) typeNamespace, /* namespace */ InvalidOid, /* relation oid (n/a here) */ 0, /* relation kind (ditto) */ - GetUserId(), /* owner's ID */ + GetUserId(), /* owner's ID */ internalLength, /* internal size */ TYPTYPE_BASE, /* type-type (base type) */ category, /* type-category */ @@ -578,7 +578,7 @@ DefineType(List *names, List *parameters) GetUserId(), /* owner's ID */ -1, /* internal size (always varlena) */ TYPTYPE_BASE, /* type-type (base type) */ - TYPCATEGORY_ARRAY, /* type-category (array) */ + TYPCATEGORY_ARRAY, /* type-category (array) */ false, /* array types are never preferred */ delimiter, /* array element delimiter */ F_ARRAY_IN, /* input procedure */ @@ -616,18 +616,18 @@ void RemoveTypes(DropStmt *drop) { ObjectAddresses *objects; - ListCell *cell; + ListCell *cell; /* * First we identify all the types, then we delete them in a single - * performMultipleDeletions() call. This is to avoid unwanted - * DROP RESTRICT errors if one of the types depends on another. + * performMultipleDeletions() call. This is to avoid unwanted DROP + * RESTRICT errors if one of the types depends on another. */ objects = new_object_addresses(); foreach(cell, drop->objects) { - List *names = (List *) lfirst(cell); + List *names = (List *) lfirst(cell); TypeName *typename; Oid typeoid; HeapTuple tup; @@ -1020,7 +1020,7 @@ DefineDomain(CreateDomainStmt *stmt) domainNamespace, /* namespace */ InvalidOid, /* relation oid (n/a here) */ 0, /* relation kind (ditto) */ - GetUserId(), /* owner's ID */ + GetUserId(), /* owner's ID */ internalLength, /* internal size */ TYPTYPE_DOMAIN, /* type-type (domain type) */ category, /* type-category */ @@ -1134,7 +1134,7 @@ DefineEnum(CreateEnumStmt *stmt) enumNamespace, /* namespace */ InvalidOid, /* relation oid (n/a here) */ 0, /* relation kind (ditto) */ - GetUserId(), /* owner's ID */ + GetUserId(), /* owner's ID */ sizeof(Oid), /* internal size */ TYPTYPE_ENUM, /* type-type (enum type) */ TYPCATEGORY_ENUM, /* type-category (enum type) */ @@ -1176,7 +1176,7 @@ DefineEnum(CreateEnumStmt *stmt) GetUserId(), /* owner's ID */ -1, /* internal size (always varlena) */ TYPTYPE_BASE, /* type-type (base type) */ - TYPCATEGORY_ARRAY, /* type-category (array) */ + TYPCATEGORY_ARRAY, /* type-category (array) */ false, /* array types are never preferred */ DEFAULT_TYPDELIM, /* array element delimiter */ F_ARRAY_IN, /* input procedure */ @@ -1610,8 +1610,8 @@ AlterDomainDefault(List *names, Node *defaultRaw) } newtuple = heap_modify_tuple(tup, RelationGetDescr(rel), - new_record, new_record_nulls, - new_record_repl); + new_record, new_record_nulls, + new_record_repl); simple_heap_update(rel, &tup->t_self, newtuple); @@ -2472,8 +2472,8 @@ RenameType(List *names, const char *newTypeName) /* * If it's a composite type, we need to check that it really is a - * free-standing composite type, and not a table's rowtype. We - * want people to use ALTER TABLE not ALTER TYPE for that case. + * free-standing composite type, and not a table's rowtype. We want people + * to use ALTER TABLE not ALTER TYPE for that case. */ if (typTup->typtype == TYPTYPE_COMPOSITE && get_rel_relkind(typTup->typrelid) != RELKIND_COMPOSITE_TYPE) @@ -2493,7 +2493,7 @@ RenameType(List *names, const char *newTypeName) errhint("You can alter type %s, which will alter the array type as well.", format_type_be(typTup->typelem)))); - /* + /* * If type is composite we need to rename associated pg_class entry too. * RenameRelationInternal will call RenameTypeInternal automatically. */ diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c index 22491cf3f7..6796a1f5e2 100644 --- a/src/backend/commands/user.c +++ b/src/backend/commands/user.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.186 2009/01/30 17:24:47 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.187 2009/06/11 14:48:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -684,7 +684,7 @@ AlterRole(AlterRoleStmt *stmt) } new_tuple = heap_modify_tuple(tuple, pg_authid_dsc, new_record, - new_record_nulls, new_record_repl); + new_record_nulls, new_record_repl); simple_heap_update(pg_authid_rel, &tuple->t_self, new_tuple); /* Update indexes */ @@ -802,7 +802,7 @@ AlterRoleSet(AlterRoleSetStmt *stmt) } newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(rel), - repl_val, repl_null, repl_repl); + repl_val, repl_null, repl_repl); simple_heap_update(rel, &oldtuple->t_self, newtuple); CatalogUpdateIndexes(rel, newtuple); @@ -1143,7 +1143,7 @@ GrantRole(GrantRoleStmt *stmt) if (rolename == NULL || priv->cols != NIL) ereport(ERROR, (errcode(ERRCODE_INVALID_GRANT_OPERATION), - errmsg("column names cannot be included in GRANT/REVOKE ROLE"))); + errmsg("column names cannot be included in GRANT/REVOKE ROLE"))); roleid = get_roleid_checked(rolename); if (stmt->is_grant) @@ -1366,8 +1366,8 @@ AddRoleMems(const char *rolename, Oid roleid, new_record_repl[Anum_pg_auth_members_grantor - 1] = true; new_record_repl[Anum_pg_auth_members_admin_option - 1] = true; tuple = heap_modify_tuple(authmem_tuple, pg_authmem_dsc, - new_record, - new_record_nulls, new_record_repl); + new_record, + new_record_nulls, new_record_repl); simple_heap_update(pg_authmem_rel, &tuple->t_self, tuple); CatalogUpdateIndexes(pg_authmem_rel, tuple); ReleaseSysCache(authmem_tuple); @@ -1375,7 +1375,7 @@ AddRoleMems(const char *rolename, Oid roleid, else { tuple = heap_form_tuple(pg_authmem_dsc, - new_record, new_record_nulls); + new_record, new_record_nulls); simple_heap_insert(pg_authmem_rel, tuple); CatalogUpdateIndexes(pg_authmem_rel, tuple); } @@ -1485,8 +1485,8 @@ DelRoleMems(const char *rolename, Oid roleid, new_record_repl[Anum_pg_auth_members_admin_option - 1] = true; tuple = heap_modify_tuple(authmem_tuple, pg_authmem_dsc, - new_record, - new_record_nulls, new_record_repl); + new_record, + new_record_nulls, new_record_repl); simple_heap_update(pg_authmem_rel, &tuple->t_self, tuple); CatalogUpdateIndexes(pg_authmem_rel, tuple); } diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 4a5ae53d48..732f6d09c3 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.388 2009/06/06 22:13:51 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.389 2009/06/11 14:48:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -655,7 +655,7 @@ vacuum_set_xid_limits(int freeze_min_age, if (freezeTableLimit != NULL) { - int freezetable; + int freezetable; /* * Determine the table freeze age to use: as specified by the caller, @@ -671,8 +671,8 @@ vacuum_set_xid_limits(int freeze_min_age, Assert(freezetable >= 0); /* - * Compute the cutoff XID, being careful not to generate a - * "permanent" XID. + * Compute the cutoff XID, being careful not to generate a "permanent" + * XID. */ limit = ReadNewTransactionId() - freezetable; if (!TransactionIdIsNormal(limit)) @@ -1031,16 +1031,16 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound, StartTransactionCommand(); /* - * Functions in indexes may want a snapshot set. Also, setting - * a snapshot ensures that RecentGlobalXmin is kept truly recent. + * Functions in indexes may want a snapshot set. Also, setting a snapshot + * ensures that RecentGlobalXmin is kept truly recent. */ PushActiveSnapshot(GetTransactionSnapshot()); if (!vacstmt->full) { /* - * In lazy vacuum, we can set the PROC_IN_VACUUM flag, which lets other - * concurrent VACUUMs know that they can ignore this one while + * In lazy vacuum, we can set the PROC_IN_VACUUM flag, which lets + * other concurrent VACUUMs know that they can ignore this one while * determining their OldestXmin. (The reason we don't set it during a * full VACUUM is exactly that we may have to run user- defined * functions for functional indexes, and we want to make sure that if @@ -1049,9 +1049,9 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound, * contents of other tables is arguably broken, but we won't break it * here by violating transaction semantics.) * - * We also set the VACUUM_FOR_WRAPAROUND flag, which is passed down - * by autovacuum; it's used to avoid cancelling a vacuum that was - * invoked in an emergency. + * We also set the VACUUM_FOR_WRAPAROUND flag, which is passed down by + * autovacuum; it's used to avoid cancelling a vacuum that was invoked + * in an emergency. * * Note: these flags remain set until CommitTransaction or * AbortTransaction. We don't want to clear them until we reset @@ -1108,8 +1108,8 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound, { if (onerel->rd_rel->relisshared) ereport(WARNING, - (errmsg("skipping \"%s\" --- only superuser can vacuum it", - RelationGetRelationName(onerel)))); + (errmsg("skipping \"%s\" --- only superuser can vacuum it", + RelationGetRelationName(onerel)))); else if (onerel->rd_rel->relnamespace == PG_CATALOG_NAMESPACE) ereport(WARNING, (errmsg("skipping \"%s\" --- only superuser or database owner can vacuum it", @@ -1125,8 +1125,9 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound, } /* - * Check that it's a vacuumable table; we used to do this in get_rel_oids() - * but seems safer to check after we've locked the relation. + * Check that it's a vacuumable table; we used to do this in + * get_rel_oids() but seems safer to check after we've locked the + * relation. */ if (onerel->rd_rel->relkind != RELKIND_RELATION && onerel->rd_rel->relkind != RELKIND_TOASTVALUE) @@ -1178,9 +1179,8 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound, toast_relid = InvalidOid; /* - * Switch to the table owner's userid, so that any index functions are - * run as that user. (This is unnecessary, but harmless, for lazy - * VACUUM.) + * Switch to the table owner's userid, so that any index functions are run + * as that user. (This is unnecessary, but harmless, for lazy VACUUM.) */ GetUserIdAndContext(&save_userid, &save_secdefcxt); SetUserIdAndContext(onerel->rd_rel->relowner, true); @@ -1740,13 +1740,13 @@ scan_heap(VRelStats *vacrelstats, Relation onerel, /* * Add the page to vacuum_pages if it requires reaping, and add it to * fraged_pages if it has a useful amount of free space. "Useful" - * means enough for a minimal-sized tuple. But we don't know that + * means enough for a minimal-sized tuple. But we don't know that * accurately near the start of the relation, so add pages * unconditionally if they have >= BLCKSZ/10 free space. Also * forcibly add pages with no live tuples, to avoid confusing the * empty_end_pages logic. (In the presence of unreasonably small - * fillfactor, it seems possible that such pages might not pass - * the free-space test, but they had better be in the list anyway.) + * fillfactor, it seems possible that such pages might not pass the + * free-space test, but they had better be in the list anyway.) */ do_frag = (vacpage->free >= min_tlen || vacpage->free >= BLCKSZ / 10 || notup); @@ -2228,7 +2228,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel, /* assume block# is OK (see heap_fetch comments) */ nextBuf = ReadBufferExtended(onerel, MAIN_FORKNUM, ItemPointerGetBlockNumber(&nextTid), - RBM_NORMAL, vac_strategy); + RBM_NORMAL, vac_strategy); nextPage = BufferGetPage(nextBuf); /* If bogus or unused slot, assume tp is end of chain */ nextOffnum = ItemPointerGetOffsetNumber(&nextTid); @@ -2373,7 +2373,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel, tp.t_self = vtlp->this_tid; Pbuf = ReadBufferExtended(onerel, MAIN_FORKNUM, ItemPointerGetBlockNumber(&(tp.t_self)), - RBM_NORMAL, vac_strategy); + RBM_NORMAL, vac_strategy); Ppage = BufferGetPage(Pbuf); Pitemid = PageGetItemId(Ppage, ItemPointerGetOffsetNumber(&(tp.t_self))); @@ -2457,7 +2457,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel, tuple.t_self = vtmove[ti].tid; Cbuf = ReadBufferExtended(onerel, MAIN_FORKNUM, ItemPointerGetBlockNumber(&(tuple.t_self)), - RBM_NORMAL, vac_strategy); + RBM_NORMAL, vac_strategy); /* Get page to move to */ dst_buffer = ReadBufferExtended(onerel, MAIN_FORKNUM, @@ -3400,8 +3400,8 @@ scan_index(Relation indrel, double num_tuples) return; /* - * Now update statistics in pg_class, but only if the index says the - * count is accurate. + * Now update statistics in pg_class, but only if the index says the count + * is accurate. */ if (!stats->estimated_count) vac_update_relstats(indrel, @@ -3477,8 +3477,8 @@ vacuum_index(VacPageList vacpagelist, Relation indrel, return; /* - * Now update statistics in pg_class, but only if the index says the - * count is accurate. + * Now update statistics in pg_class, but only if the index says the count + * is accurate. */ if (!stats->estimated_count) vac_update_relstats(indrel, @@ -3835,7 +3835,7 @@ PageGetFreeSpaceWithFillFactor(Relation relation, Page page) { /* * It is correct to use PageGetExactFreeSpace() here, *not* - * PageGetHeapFreeSpace(). This is because (a) we do our own, exact + * PageGetHeapFreeSpace(). This is because (a) we do our own, exact * accounting for whether line pointers must be added, and (b) we will * recycle any LP_DEAD line pointers before starting to add rows to a * page, but that may not have happened yet at the time this function is diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c index dd0691d0fe..01aa11a6d2 100644 --- a/src/backend/commands/vacuumlazy.c +++ b/src/backend/commands/vacuumlazy.c @@ -29,7 +29,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.120 2009/06/06 22:13:51 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.121 2009/06/11 14:48:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -87,7 +87,7 @@ typedef struct LVRelStats bool scanned_all; /* have we scanned all pages (this far)? */ /* Overall statistics about rel */ BlockNumber rel_pages; - double old_rel_tuples; /* previous value of pg_class.reltuples */ + double old_rel_tuples; /* previous value of pg_class.reltuples */ double rel_tuples; /* counts only tuples on scanned pages */ BlockNumber pages_removed; double tuples_deleted; @@ -175,14 +175,14 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt, vacrelstats = (LVRelStats *) palloc0(sizeof(LVRelStats)); - vacrelstats->scanned_all = true; /* will be cleared if we skip a page */ + vacrelstats->scanned_all = true; /* will be cleared if we skip a page */ vacrelstats->old_rel_tuples = onerel->rd_rel->reltuples; vacrelstats->num_index_scans = 0; /* Open all indexes of the relation */ vac_open_indexes(onerel, RowExclusiveLock, &nindexes, &Irel); vacrelstats->hasindex = (nindexes > 0); - + /* Do the vacuuming */ lazy_scan_heap(onerel, vacrelstats, Irel, nindexes, scan_all); @@ -208,9 +208,9 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt, * Update statistics in pg_class. But only if we didn't skip any pages; * the tuple count only includes tuples from the pages we've visited, and * we haven't frozen tuples in unvisited pages either. The page count is - * accurate in any case, but because we use the reltuples / relpages - * ratio in the planner, it's better to not update relpages either if we - * can't update reltuples. + * accurate in any case, but because we use the reltuples / relpages ratio + * in the planner, it's better to not update relpages either if we can't + * update reltuples. */ if (vacrelstats->scanned_all) vac_update_relstats(onerel, @@ -279,7 +279,7 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats, int i; PGRUsage ru0; Buffer vmbuffer = InvalidBuffer; - BlockNumber all_visible_streak; + BlockNumber all_visible_streak; pg_rusage_init(&ru0); @@ -318,8 +318,8 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats, bool all_visible; /* - * Skip pages that don't require vacuuming according to the - * visibility map. But only if we've seen a streak of at least + * Skip pages that don't require vacuuming according to the visibility + * map. But only if we've seen a streak of at least * SKIP_PAGES_THRESHOLD pages marked as clean. Since we're reading * sequentially, the OS should be doing readahead for us and there's * no gain in skipping a page now and then. You need a longer run of @@ -558,9 +558,10 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats, all_visible = false; break; } + /* - * The inserter definitely committed. But is it - * old enough that everyone sees it as committed? + * The inserter definitely committed. But is it old + * enough that everyone sees it as committed? */ xmin = HeapTupleHeaderGetXmin(tuple.t_data); if (!TransactionIdPrecedes(xmin, OldestXmin)) @@ -922,8 +923,8 @@ lazy_cleanup_index(Relation indrel, return; /* - * Now update statistics in pg_class, but only if the index says the - * count is accurate. + * Now update statistics in pg_class, but only if the index says the count + * is accurate. */ if (!stats->estimated_count) vac_update_relstats(indrel, diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c index c9236f7e80..1374b65122 100644 --- a/src/backend/commands/variable.c +++ b/src/backend/commands/variable.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.129 2009/01/01 17:23:40 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.130 2009/06/11 14:48:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -268,7 +268,7 @@ assign_timezone(const char *value, bool doit, GucSource source) /* * Try to parse it. XXX an invalid interval format will result in - * ereport(ERROR), which is not desirable for GUC. We did what we + * ereport(ERROR), which is not desirable for GUC. We did what we * could to guard against this in flatten_set_variable_args, but a * string coming in from postgresql.conf might contain anything. */ @@ -290,7 +290,7 @@ assign_timezone(const char *value, bool doit, GucSource source) { ereport(GUC_complaint_elevel(source), (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid interval value for time zone: day not allowed"))); + errmsg("invalid interval value for time zone: day not allowed"))); pfree(interval); return NULL; } @@ -843,7 +843,7 @@ assign_role(const char *value, bool doit, GucSource source) /* * Disallow SET ROLE inside a security definer context. We need to do * this because when we exit the context, GUC won't be notified, - * leaving things out of sync. Note that this test is arranged so + * leaving things out of sync. Note that this test is arranged so * that restoring a previously saved setting isn't prevented. * * XXX it would be nice to allow this case in future, with the diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c index ab8e6a78fc..b06a48b7ab 100644 --- a/src/backend/commands/view.c +++ b/src/backend/commands/view.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/view.c,v 1.115 2009/04/04 21:12:31 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/view.c,v 1.116 2009/06/11 14:48:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -185,14 +185,14 @@ DefineVirtualRelation(const RangeVar *relation, List *tlist, bool replace) checkViewTupleDesc(descriptor, rel->rd_att); /* - * If new attributes have been added, we must add pg_attribute entries + * If new attributes have been added, we must add pg_attribute entries * for them. It is convenient (although overkill) to use the ALTER * TABLE ADD COLUMN infrastructure for this. */ if (list_length(attrList) > rel->rd_att->natts) { - List *atcmds = NIL; - ListCell *c; + List *atcmds = NIL; + ListCell *c; int skip = rel->rd_att->natts; foreach(c, attrList) @@ -273,9 +273,9 @@ checkViewTupleDesc(TupleDesc newdesc, TupleDesc olddesc) if (strcmp(NameStr(newattr->attname), NameStr(oldattr->attname)) != 0) ereport(ERROR, (errcode(ERRCODE_INVALID_TABLE_DEFINITION), - errmsg("cannot change name of view column \"%s\" to \"%s\"", - NameStr(oldattr->attname), - NameStr(newattr->attname)))); + errmsg("cannot change name of view column \"%s\" to \"%s\"", + NameStr(oldattr->attname), + NameStr(newattr->attname)))); /* XXX would it be safe to allow atttypmod to change? Not sure */ if (newattr->atttypid != oldattr->atttypid || newattr->atttypmod != oldattr->atttypmod) diff --git a/src/backend/executor/execCurrent.c b/src/backend/executor/execCurrent.c index 2c1a1731db..d9ecc973e1 100644 --- a/src/backend/executor/execCurrent.c +++ b/src/backend/executor/execCurrent.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/executor/execCurrent.c,v 1.9 2009/01/01 17:23:41 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/execCurrent.c,v 1.10 2009/06/11 14:48:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -138,8 +138,8 @@ execCurrentOf(CurrentOfExpr *cexpr, /* * This table didn't produce the cursor's current row; some other - * inheritance child of the same parent must have. Signal caller - * to do nothing on this table. + * inheritance child of the same parent must have. Signal caller to + * do nothing on this table. */ return false; } diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 03461a235a..1c6fd02e1f 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -26,7 +26,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.324 2009/05/07 22:58:28 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.325 2009/06/11 14:48:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -62,9 +62,9 @@ /* Hooks for plugins to get control in ExecutorStart/Run/End() */ -ExecutorStart_hook_type ExecutorStart_hook = NULL; -ExecutorRun_hook_type ExecutorRun_hook = NULL; -ExecutorEnd_hook_type ExecutorEnd_hook = NULL; +ExecutorStart_hook_type ExecutorStart_hook = NULL; +ExecutorRun_hook_type ExecutorRun_hook = NULL; +ExecutorEnd_hook_type ExecutorEnd_hook = NULL; typedef struct evalPlanQual { @@ -552,17 +552,17 @@ ExecCheckRTEPerms(RangeTblEntry *rte) } /* - * Basically the same for the mod columns, with either INSERT or UPDATE - * privilege as specified by remainingPerms. + * Basically the same for the mod columns, with either INSERT or + * UPDATE privilege as specified by remainingPerms. */ remainingPerms &= ~ACL_SELECT; if (remainingPerms != 0) { /* - * When the query doesn't explicitly change any columns, allow - * the query if we have permission on any column of the rel. This - * is to handle SELECT FOR UPDATE as well as possible corner cases - * in INSERT and UPDATE. + * When the query doesn't explicitly change any columns, allow the + * query if we have permission on any column of the rel. This is + * to handle SELECT FOR UPDATE as well as possible corner cases in + * INSERT and UPDATE. */ if (bms_is_empty(rte->modifiedCols)) { @@ -843,9 +843,9 @@ InitPlan(QueryDesc *queryDesc, int eflags) /* * Initialize the junk filter if needed. SELECT and INSERT queries need a - * filter if there are any junk attrs in the tlist. UPDATE and - * DELETE always need a filter, since there's always a junk 'ctid' - * attribute present --- no need to look first. + * filter if there are any junk attrs in the tlist. UPDATE and DELETE + * always need a filter, since there's always a junk 'ctid' attribute + * present --- no need to look first. * * This section of code is also a convenient place to verify that the * output of an INSERT or UPDATE matches the target table(s). @@ -1194,7 +1194,7 @@ ExecCheckPlanOutput(Relation resultRel, List *targetList) errdetail("Table has type %s at ordinal position %d, but query expects %s.", format_type_be(attr->atttypid), attno, - format_type_be(exprType((Node *) tle->expr))))); + format_type_be(exprType((Node *) tle->expr))))); } else { @@ -1215,7 +1215,7 @@ ExecCheckPlanOutput(Relation resultRel, List *targetList) if (attno != resultDesc->natts) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("table row type and query-specified row type do not match"), + errmsg("table row type and query-specified row type do not match"), errdetail("Query has too few columns."))); } @@ -1547,7 +1547,7 @@ lnext: ; /* if child rel, must check whether it produced this row */ if (erm->rti != erm->prti) { - Oid tableoid; + Oid tableoid; datum = ExecGetJunkAttribute(slot, erm->toidAttNo, @@ -1774,8 +1774,8 @@ ExecInsert(TupleTableSlot *slot, * rowtype. * * XXX if we ever wanted to allow users to assign their own OIDs to new - * rows, this'd be the place to do it. For the moment, we make a point - * of doing this before calling triggers, so that a user-supplied trigger + * rows, this'd be the place to do it. For the moment, we make a point of + * doing this before calling triggers, so that a user-supplied trigger * could hack the OID if desired. */ if (resultRelationDesc->rd_rel->relhasoids) @@ -2847,7 +2847,7 @@ OpenIntoRel(QueryDesc *queryDesc) Oid intoRelationId; TupleDesc tupdesc; DR_intorel *myState; - static char *validnsps[] = HEAP_RELOPT_NAMESPACES; + static char *validnsps[] = HEAP_RELOPT_NAMESPACES; Assert(into); @@ -2970,8 +2970,8 @@ OpenIntoRel(QueryDesc *queryDesc) myState->rel = intoRelationDesc; /* - * We can skip WAL-logging the insertions, unless PITR is in use. We - * can skip the FSM in any case. + * We can skip WAL-logging the insertions, unless PITR is in use. We can + * skip the FSM in any case. */ myState->hi_options = HEAP_INSERT_SKIP_FSM | (XLogArchivingActive() ? 0 : HEAP_INSERT_SKIP_WAL); diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c index 65bf01c6a8..a0e4566630 100644 --- a/src/backend/executor/execQual.c +++ b/src/backend/executor/execQual.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.248 2009/06/09 22:00:57 petere Exp $ + * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.249 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -63,8 +63,8 @@ static Datum ExecEvalAggref(AggrefExprState *aggref, ExprContext *econtext, bool *isNull, ExprDoneCond *isDone); static Datum ExecEvalWindowFunc(WindowFuncExprState *wfunc, - ExprContext *econtext, - bool *isNull, ExprDoneCond *isDone); + ExprContext *econtext, + bool *isNull, ExprDoneCond *isDone); static Datum ExecEvalVar(ExprState *exprstate, ExprContext *econtext, bool *isNull, ExprDoneCond *isDone); static Datum ExecEvalScalarVar(ExprState *exprstate, ExprContext *econtext, @@ -78,7 +78,7 @@ static Datum ExecEvalConst(ExprState *exprstate, ExprContext *econtext, static Datum ExecEvalParam(ExprState *exprstate, ExprContext *econtext, bool *isNull, ExprDoneCond *isDone); static void init_fcache(Oid foid, FuncExprState *fcache, - MemoryContext fcacheCxt, bool needDescForSets); + MemoryContext fcacheCxt, bool needDescForSets); static void ShutdownFuncExpr(Datum arg); static TupleDesc get_cached_rowtype(Oid type_id, int32 typmod, TupleDesc *cache_field, ExprContext *econtext); @@ -617,7 +617,7 @@ ExecEvalVar(ExprState *exprstate, ExprContext *econtext, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("table row type and query-specified row type do not match"), errdetail_plural("Table row contains %d attribute, but query expects %d.", - "Table row contains %d attributes, but query expects %d.", + "Table row contains %d attributes, but query expects %d.", slot_tupdesc->natts, slot_tupdesc->natts, var_tupdesc->natts))); @@ -1044,10 +1044,10 @@ init_fcache(Oid foid, FuncExprState *fcache, if (list_length(fcache->args) > FUNC_MAX_ARGS) ereport(ERROR, (errcode(ERRCODE_TOO_MANY_ARGUMENTS), - errmsg_plural("cannot pass more than %d argument to a function", - "cannot pass more than %d arguments to a function", - FUNC_MAX_ARGS, - FUNC_MAX_ARGS))); + errmsg_plural("cannot pass more than %d argument to a function", + "cannot pass more than %d arguments to a function", + FUNC_MAX_ARGS, + FUNC_MAX_ARGS))); /* Set up the primary fmgr lookup information */ fmgr_info_cxt(foid, &(fcache->func), fcacheCxt); @@ -1237,7 +1237,7 @@ ExecEvalFuncArgs(FunctionCallInfo fcinfo, * ExecPrepareTuplestoreResult * * Subroutine for ExecMakeFunctionResult: prepare to extract rows from a - * tuplestore function result. We must set up a funcResultSlot (unless + * tuplestore function result. We must set up a funcResultSlot (unless * already done in a previous call cycle) and verify that the function * returned the expected tuple descriptor. */ @@ -1268,9 +1268,8 @@ ExecPrepareTuplestoreResult(FuncExprState *fcache, } /* - * If function provided a tupdesc, cross-check it. We only really - * need to do this for functions returning RECORD, but might as well - * do it always. + * If function provided a tupdesc, cross-check it. We only really need to + * do this for functions returning RECORD, but might as well do it always. */ if (resultDesc) { @@ -1316,7 +1315,7 @@ tupledesc_match(TupleDesc dst_tupdesc, TupleDesc src_tupdesc) (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("function return row and query-specified return row do not match"), errdetail_plural("Returned row contains %d attribute, but query expects %d.", - "Returned row contains %d attributes, but query expects %d.", + "Returned row contains %d attributes, but query expects %d.", src_tupdesc->natts, src_tupdesc->natts, dst_tupdesc->natts))); @@ -1353,7 +1352,7 @@ tupledesc_match(TupleDesc dst_tupdesc, TupleDesc src_tupdesc) * init_fcache is presumed already run on the FuncExprState. * * This function handles the most general case, wherein the function or - * one of its arguments might (or might not) return a set. If we find + * one of its arguments might (or might not) return a set. If we find * no sets involved, we will change the FuncExprState's function pointer * to use a simpler method on subsequent calls. */ @@ -1379,13 +1378,13 @@ restart: check_stack_depth(); /* - * If a previous call of the function returned a set result in the form - * of a tuplestore, continue reading rows from the tuplestore until it's + * If a previous call of the function returned a set result in the form of + * a tuplestore, continue reading rows from the tuplestore until it's * empty. */ if (fcache->funcResultStore) { - Assert(isDone); /* it was provided before ... */ + Assert(isDone); /* it was provided before ... */ if (tuplestore_gettupleslot(fcache->funcResultStore, true, false, fcache->funcResultSlot)) { @@ -1420,10 +1419,10 @@ restart: * For non-set-returning functions, we just use a local-variable * FunctionCallInfoData. For set-returning functions we keep the callinfo * record in fcache->setArgs so that it can survive across multiple - * value-per-call invocations. (The reason we don't just do the latter - * all the time is that plpgsql expects to be able to use simple expression - * trees re-entrantly. Which might not be a good idea, but the penalty - * for not doing so is high.) + * value-per-call invocations. (The reason we don't just do the latter + * all the time is that plpgsql expects to be able to use simple + * expression trees re-entrantly. Which might not be a good idea, but the + * penalty for not doing so is high.) */ if (fcache->func.fn_retset) fcinfo = &fcache->setArgs; @@ -1534,7 +1533,7 @@ restart: *isDone = rsinfo.isDone; pgstat_end_function_usage(&fcusage, - rsinfo.isDone != ExprMultipleResult); + rsinfo.isDone != ExprMultipleResult); } else { @@ -1564,7 +1563,7 @@ restart: { RegisterExprContextCallback(econtext, ShutdownFuncExpr, - PointerGetDatum(fcache)); + PointerGetDatum(fcache)); fcache->shutdown_reg = true; } } @@ -2043,9 +2042,8 @@ no_function_result: } /* - * If function provided a tupdesc, cross-check it. We only really - * need to do this for functions returning RECORD, but might as well - * do it always. + * If function provided a tupdesc, cross-check it. We only really need to + * do this for functions returning RECORD, but might as well do it always. */ if (rsinfo.setDesc) { @@ -3229,41 +3227,41 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext, break; case IS_XMLFOREST: - { - StringInfoData buf; - - initStringInfo(&buf); - forboth(arg, xmlExpr->named_args, narg, xexpr->arg_names) { - ExprState *e = (ExprState *) lfirst(arg); - char *argname = strVal(lfirst(narg)); + StringInfoData buf; - value = ExecEvalExpr(e, econtext, &isnull, NULL); - if (!isnull) + initStringInfo(&buf); + forboth(arg, xmlExpr->named_args, narg, xexpr->arg_names) { - appendStringInfo(&buf, "<%s>%s</%s>", - argname, - map_sql_value_to_xml_value(value, exprType((Node *) e->expr), true), - argname); - *isNull = false; + ExprState *e = (ExprState *) lfirst(arg); + char *argname = strVal(lfirst(narg)); + + value = ExecEvalExpr(e, econtext, &isnull, NULL); + if (!isnull) + { + appendStringInfo(&buf, "<%s>%s</%s>", + argname, + map_sql_value_to_xml_value(value, exprType((Node *) e->expr), true), + argname); + *isNull = false; + } } - } - if (*isNull) - { - pfree(buf.data); - return (Datum) 0; - } - else - { - text *result; + if (*isNull) + { + pfree(buf.data); + return (Datum) 0; + } + else + { + text *result; - result = cstring_to_text_with_len(buf.data, buf.len); - pfree(buf.data); + result = cstring_to_text_with_len(buf.data, buf.len); + pfree(buf.data); - return PointerGetDatum(result); + return PointerGetDatum(result); + } } - } break; case IS_XMLELEMENT: @@ -4095,9 +4093,9 @@ ExecEvalExprSwitchContext(ExprState *expression, * * Any Aggref, WindowFunc, or SubPlan nodes found in the tree are added to the * lists of such nodes held by the parent PlanState. Otherwise, we do very - * little initialization here other than building the state-node tree. Any + * little initialization here other than building the state-node tree. Any * nontrivial work associated with initializing runtime info for a node should - * happen during the first actual evaluation of that node. (This policy lets + * happen during the first actual evaluation of that node. (This policy lets * us avoid work if the node is never actually evaluated.) * * Note: there is no ExecEndExpr function; we assume that any resource @@ -4209,7 +4207,7 @@ ExecInitExpr(Expr *node, PlanState *parent) if (nfuncs != winstate->numfuncs) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), - errmsg("window function calls cannot be nested"))); + errmsg("window function calls cannot be nested"))); } else { @@ -5156,11 +5154,11 @@ ExecProject(ProjectionInfo *projInfo, ExprDoneCond *isDone) numSimpleVars = projInfo->pi_numSimpleVars; if (numSimpleVars > 0) { - Datum *values = slot->tts_values; - bool *isnull = slot->tts_isnull; - int *varSlotOffsets = projInfo->pi_varSlotOffsets; - int *varNumbers = projInfo->pi_varNumbers; - int i; + Datum *values = slot->tts_values; + bool *isnull = slot->tts_isnull; + int *varSlotOffsets = projInfo->pi_varSlotOffsets; + int *varNumbers = projInfo->pi_varNumbers; + int i; if (projInfo->pi_directMap) { @@ -5178,7 +5176,7 @@ ExecProject(ProjectionInfo *projInfo, ExprDoneCond *isDone) else { /* we have to pay attention to varOutputCols[] */ - int *varOutputCols = projInfo->pi_varOutputCols; + int *varOutputCols = projInfo->pi_varOutputCols; for (i = 0; i < numSimpleVars; i++) { @@ -5195,9 +5193,9 @@ ExecProject(ProjectionInfo *projInfo, ExprDoneCond *isDone) /* * If there are any generic expressions, evaluate them. It's possible - * that there are set-returning functions in such expressions; if so - * and we have reached the end of the set, we return the result slot, - * which we already marked empty. + * that there are set-returning functions in such expressions; if so and + * we have reached the end of the set, we return the result slot, which we + * already marked empty. */ if (projInfo->pi_targetlist) { diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c index 1d0a5854fb..7b5ba41f5f 100644 --- a/src/backend/executor/execTuples.c +++ b/src/backend/executor/execTuples.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.106 2009/03/30 04:08:43 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.107 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -756,9 +756,9 @@ ExecFetchSlotMinimalTuple(TupleTableSlot *slot) /* * Note: we may now have a situation where we have a local minimal tuple - * attached to a virtual or non-local physical tuple. There seems no - * harm in that at the moment, but if any materializes, we should change - * this function to force the slot into minimal-tuple-only state. + * attached to a virtual or non-local physical tuple. There seems no harm + * in that at the moment, but if any materializes, we should change this + * function to force the slot into minimal-tuple-only state. */ return slot->tts_mintuple; @@ -843,9 +843,9 @@ ExecMaterializeSlot(TupleTableSlot *slot) slot->tts_buffer = InvalidBuffer; /* - * Mark extracted state invalid. This is important because the slot - * is not supposed to depend any more on the previous external data; - * we mustn't leave any dangling pass-by-reference datums in tts_values. + * Mark extracted state invalid. This is important because the slot is + * not supposed to depend any more on the previous external data; we + * mustn't leave any dangling pass-by-reference datums in tts_values. * However, we have not actually invalidated any such datums, if there * happen to be any previously fetched from the slot. (Note in particular * that we have not pfree'd tts_mintuple, if there is one.) @@ -854,9 +854,9 @@ ExecMaterializeSlot(TupleTableSlot *slot) /* * On the same principle of not depending on previous remote storage, - * forget the mintuple if it's not local storage. (If it is local storage, - * we must not pfree it now, since callers might have already fetched - * datum pointers referencing it.) + * forget the mintuple if it's not local storage. (If it is local + * storage, we must not pfree it now, since callers might have already + * fetched datum pointers referencing it.) */ if (!slot->tts_shouldFreeMin) slot->tts_mintuple = NULL; diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c index 4b3d92d48b..360ee40858 100644 --- a/src/backend/executor/execUtils.c +++ b/src/backend/executor/execUtils.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.158 2009/04/02 22:39:30 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.159 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -584,8 +584,8 @@ ExecBuildProjectionInfo(List *targetList, /* * We separate the target list elements into simple Var references and - * expressions which require the full ExecTargetList machinery. To be - * a simple Var, a Var has to be a user attribute and not mismatch the + * expressions which require the full ExecTargetList machinery. To be a + * simple Var, a Var has to be a user attribute and not mismatch the * inputDesc. (Note: if there is a type mismatch then ExecEvalVar will * probably throw an error at runtime, but we leave that to it.) */ @@ -621,7 +621,7 @@ ExecBuildProjectionInfo(List *targetList, varNumbers[numSimpleVars] = attnum; varOutputCols[numSimpleVars] = tle->resno; - if (tle->resno != numSimpleVars+1) + if (tle->resno != numSimpleVars + 1) directMap = false; switch (variable->varno) @@ -683,7 +683,7 @@ get_last_attnums(Node *node, ProjectionInfo *projInfo) return false; if (IsA(node, Var)) { - Var *variable = (Var *) node; + Var *variable = (Var *) node; AttrNumber attnum = variable->varattno; switch (variable->varno) @@ -705,9 +705,10 @@ get_last_attnums(Node *node, ProjectionInfo *projInfo) } return false; } + /* - * Don't examine the arguments of Aggrefs or WindowFuncs, because those - * do not represent expressions to be evaluated within the overall + * Don't examine the arguments of Aggrefs or WindowFuncs, because those do + * not represent expressions to be evaluated within the overall * targetlist's econtext. */ if (IsA(node, Aggref)) diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c index f71807835f..b0d8b9008a 100644 --- a/src/backend/executor/functions.c +++ b/src/backend/executor/functions.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.133 2009/03/27 18:30:21 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.134 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -101,8 +101,8 @@ typedef SQLFunctionCache *SQLFunctionCachePtr; /* non-export function prototypes */ static execution_state *init_execution_state(List *queryTree_list, - SQLFunctionCachePtr fcache, - bool lazyEvalOK); + SQLFunctionCachePtr fcache, + bool lazyEvalOK); static void init_sql_fcache(FmgrInfo *finfo, bool lazyEvalOK); static void postquel_start(execution_state *es, SQLFunctionCachePtr fcache); static bool postquel_getnext(execution_state *es, SQLFunctionCachePtr fcache); @@ -168,8 +168,8 @@ init_execution_state(List *queryTree_list, newes->next = NULL; newes->status = F_EXEC_START; - newes->setsResult = false; /* might change below */ - newes->lazyEval = false; /* might change below */ + newes->setsResult = false; /* might change below */ + newes->lazyEval = false; /* might change below */ newes->stmt = stmt; newes->qd = NULL; @@ -180,9 +180,9 @@ init_execution_state(List *queryTree_list, } /* - * Mark the last canSetTag query as delivering the function result; - * then, if it is a plain SELECT, mark it for lazy evaluation. - * If it's not a SELECT we must always run it to completion. + * Mark the last canSetTag query as delivering the function result; then, + * if it is a plain SELECT, mark it for lazy evaluation. If it's not a + * SELECT we must always run it to completion. * * Note: at some point we might add additional criteria for whether to use * lazy eval. However, we should prefer to use it whenever the function @@ -191,8 +191,8 @@ init_execution_state(List *queryTree_list, * * Note: don't set setsResult if the function returns VOID, as evidenced * by not having made a junkfilter. This ensures we'll throw away any - * output from a utility statement that check_sql_fn_retval deemed to - * not have output. + * output from a utility statement that check_sql_fn_retval deemed to not + * have output. */ if (lasttages && fcache->junkFilter) { @@ -326,10 +326,10 @@ init_sql_fcache(FmgrInfo *finfo, bool lazyEvalOK) * Note: we set fcache->returnsTuple according to whether we are returning * the whole tuple result or just a single column. In the latter case we * clear returnsTuple because we need not act different from the scalar - * result case, even if it's a rowtype column. (However, we have to - * force lazy eval mode in that case; otherwise we'd need extra code to - * expand the rowtype column into multiple columns, since we have no - * way to notify the caller that it should do that.) + * result case, even if it's a rowtype column. (However, we have to force + * lazy eval mode in that case; otherwise we'd need extra code to expand + * the rowtype column into multiple columns, since we have no way to + * notify the caller that it should do that.) * * check_sql_fn_retval will also construct a JunkFilter we can use to * coerce the returned rowtype to the desired form (unless the result type @@ -459,7 +459,7 @@ postquel_getnext(execution_state *es, SQLFunctionCachePtr fcache) es->qd->utilitystmt), fcache->src, es->qd->params, - false, /* not top level */ + false, /* not top level */ es->qd->dest, NULL); result = true; /* never stops early */ @@ -566,7 +566,7 @@ postquel_get_single_result(TupleTableSlot *slot, /* * Set up to return the function value. For pass-by-reference datatypes, * be sure to allocate the result in resultcontext, not the current memory - * context (which has query lifespan). We can't leave the data in the + * context (which has query lifespan). We can't leave the data in the * TupleTableSlot because we intend to clear the slot before returning. */ oldcontext = MemoryContextSwitchTo(resultcontext); @@ -670,8 +670,8 @@ fmgr_sql(PG_FUNCTION_ARGS) postquel_sub_params(fcache, fcinfo); /* - * Build tuplestore to hold results, if we don't have one already. - * Note it's in the query-lifespan context. + * Build tuplestore to hold results, if we don't have one already. Note + * it's in the query-lifespan context. */ if (!fcache->tstore) fcache->tstore = tuplestore_begin_heap(randomAccess, false, work_mem); @@ -688,7 +688,7 @@ fmgr_sql(PG_FUNCTION_ARGS) */ while (es) { - bool completed; + bool completed; if (es->status == F_EXEC_START) postquel_start(es, fcache); @@ -696,22 +696,22 @@ fmgr_sql(PG_FUNCTION_ARGS) completed = postquel_getnext(es, fcache); /* - * If we ran the command to completion, we can shut it down now. - * Any row(s) we need to return are safely stashed in the tuplestore, - * and we want to be sure that, for example, AFTER triggers get fired + * If we ran the command to completion, we can shut it down now. Any + * row(s) we need to return are safely stashed in the tuplestore, and + * we want to be sure that, for example, AFTER triggers get fired * before we return anything. Also, if the function doesn't return - * set, we can shut it down anyway because it must be a SELECT and - * we don't care about fetching any more result rows. + * set, we can shut it down anyway because it must be a SELECT and we + * don't care about fetching any more result rows. */ if (completed || !fcache->returnsSet) postquel_end(es); /* * Break from loop if we didn't shut down (implying we got a - * lazily-evaluated row). Otherwise we'll press on till the - * whole function is done, relying on the tuplestore to keep hold - * of the data to eventually be returned. This is necessary since - * an INSERT/UPDATE/DELETE RETURNING that sets the result might be + * lazily-evaluated row). Otherwise we'll press on till the whole + * function is done, relying on the tuplestore to keep hold of the + * data to eventually be returned. This is necessary since an + * INSERT/UPDATE/DELETE RETURNING that sets the result might be * followed by additional rule-inserted commands, and we want to * finish doing all those commands before we return anything. */ @@ -730,7 +730,8 @@ fmgr_sql(PG_FUNCTION_ARGS) if (es) { /* - * If we stopped short of being done, we must have a lazy-eval row. + * If we stopped short of being done, we must have a lazy-eval + * row. */ Assert(es->lazyEval); /* Re-use the junkfilter's output slot to fetch back the tuple */ @@ -765,7 +766,7 @@ fmgr_sql(PG_FUNCTION_ARGS) else if (fcache->lazyEval) { /* - * We are done with a lazy evaluation. Clean up. + * We are done with a lazy evaluation. Clean up. */ tuplestore_clear(fcache->tstore); @@ -789,9 +790,9 @@ fmgr_sql(PG_FUNCTION_ARGS) else { /* - * We are done with a non-lazy evaluation. Return whatever is - * in the tuplestore. (It is now caller's responsibility to - * free the tuplestore when done.) + * We are done with a non-lazy evaluation. Return whatever is in + * the tuplestore. (It is now caller's responsibility to free the + * tuplestore when done.) */ rsi->returnMode = SFRM_Materialize; rsi->setResult = fcache->tstore; @@ -844,8 +845,8 @@ fmgr_sql(PG_FUNCTION_ARGS) } /* - * If we've gone through every command in the function, we are done. - * Reset the execution states to start over again on next call. + * If we've gone through every command in the function, we are done. Reset + * the execution states to start over again on next call. */ if (es == NULL) { @@ -997,7 +998,7 @@ ShutdownSQLFunction(Datum arg) * function definition of a polymorphic function.) * * This function returns true if the sql function returns the entire tuple - * result of its final statement, and false otherwise. Note that because we + * result of its final statement, and false otherwise. Note that because we * allow "SELECT rowtype_expression", this may be false even when the declared * function return type is a rowtype. * @@ -1029,14 +1030,14 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, *junkFilter = NULL; /* initialize in case of VOID result */ /* - * Find the last canSetTag query in the list. This isn't necessarily - * the last parsetree, because rule rewriting can insert queries after - * what the user wrote. + * Find the last canSetTag query in the list. This isn't necessarily the + * last parsetree, because rule rewriting can insert queries after what + * the user wrote. */ parse = NULL; foreach(lc, queryTreeList) { - Query *q = (Query *) lfirst(lc); + Query *q = (Query *) lfirst(lc); if (q->canSetTag) parse = q; @@ -1044,12 +1045,12 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, /* * If it's a plain SELECT, it returns whatever the targetlist says. - * Otherwise, if it's INSERT/UPDATE/DELETE with RETURNING, it returns that. - * Otherwise, the function return type must be VOID. + * Otherwise, if it's INSERT/UPDATE/DELETE with RETURNING, it returns + * that. Otherwise, the function return type must be VOID. * * Note: eventually replace this test with QueryReturnsTuples? We'd need - * a more general method of determining the output type, though. Also, - * it seems too dangerous to consider FETCH or EXECUTE as returning a + * a more general method of determining the output type, though. Also, it + * seems too dangerous to consider FETCH or EXECUTE as returning a * determinable rowtype, since they depend on relatively short-lived * entities. */ @@ -1076,7 +1077,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), errmsg("return type mismatch in function declared to return %s", format_type_be(rettype)), - errdetail("Function's final statement must be SELECT or INSERT/UPDATE/DELETE RETURNING."))); + errdetail("Function's final statement must be SELECT or INSERT/UPDATE/DELETE RETURNING."))); return false; } @@ -1112,7 +1113,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), errmsg("return type mismatch in function declared to return %s", format_type_be(rettype)), - errdetail("Final statement must return exactly one column."))); + errdetail("Final statement must return exactly one column."))); /* We assume here that non-junk TLEs must come first in tlists */ tle = (TargetEntry *) linitial(tlist); @@ -1148,8 +1149,8 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, * If the target list is of length 1, and the type of the varnode in * the target list matches the declared return type, this is okay. * This can happen, for example, where the body of the function is - * 'SELECT func2()', where func2 has the same composite return type - * as the function that's calling it. + * 'SELECT func2()', where func2 has the same composite return type as + * the function that's calling it. */ if (tlistlen == 1) { @@ -1211,7 +1212,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), errmsg("return type mismatch in function declared to return %s", format_type_be(rettype)), - errdetail("Final statement returns too many columns."))); + errdetail("Final statement returns too many columns."))); attr = tupdesc->attrs[colindex - 1]; } while (attr->attisdropped); tuplogcols++; diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c index b2aad2133c..306e7f6e17 100644 --- a/src/backend/executor/nodeBitmapHeapscan.c +++ b/src/backend/executor/nodeBitmapHeapscan.c @@ -21,7 +21,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.34 2009/01/12 16:00:41 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.35 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -114,17 +114,17 @@ BitmapHeapNext(BitmapHeapScanState *node) } /* - * If we haven't yet performed the underlying index scan, do it, and - * begin the iteration over the bitmap. + * If we haven't yet performed the underlying index scan, do it, and begin + * the iteration over the bitmap. * * For prefetching, we use *two* iterators, one for the pages we are * actually scanning and another that runs ahead of the first for - * prefetching. node->prefetch_pages tracks exactly how many pages - * ahead the prefetch iterator is. Also, node->prefetch_target tracks - * the desired prefetch distance, which starts small and increases up - * to the GUC-controlled maximum, target_prefetch_pages. This is to - * avoid doing a lot of prefetching in a scan that stops after a few - * tuples because of a LIMIT. + * prefetching. node->prefetch_pages tracks exactly how many pages ahead + * the prefetch iterator is. Also, node->prefetch_target tracks the + * desired prefetch distance, which starts small and increases up to the + * GUC-controlled maximum, target_prefetch_pages. This is to avoid doing + * a lot of prefetching in a scan that stops after a few tuples because of + * a LIMIT. */ if (tbm == NULL) { @@ -144,7 +144,7 @@ BitmapHeapNext(BitmapHeapScanState *node) node->prefetch_pages = 0; node->prefetch_target = -1; } -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ } for (;;) @@ -178,7 +178,7 @@ BitmapHeapNext(BitmapHeapScanState *node) if (tbmpre == NULL || tbmpre->blockno != tbmres->blockno) elog(ERROR, "prefetch and main iterators are out of sync"); } -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ /* * Ignore any claimed entries past what we think is the end of the @@ -203,21 +203,22 @@ BitmapHeapNext(BitmapHeapScanState *node) scan->rs_cindex = 0; #ifdef USE_PREFETCH + /* - * Increase prefetch target if it's not yet at the max. Note - * that we will increase it to zero after fetching the very - * first page/tuple, then to one after the second tuple is - * fetched, then it doubles as later pages are fetched. + * Increase prefetch target if it's not yet at the max. Note that + * we will increase it to zero after fetching the very first + * page/tuple, then to one after the second tuple is fetched, then + * it doubles as later pages are fetched. */ if (node->prefetch_target >= target_prefetch_pages) - /* don't increase any further */ ; + /* don't increase any further */ ; else if (node->prefetch_target >= target_prefetch_pages / 2) node->prefetch_target = target_prefetch_pages; else if (node->prefetch_target > 0) node->prefetch_target *= 2; else node->prefetch_target++; -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ } else { @@ -227,13 +228,14 @@ BitmapHeapNext(BitmapHeapScanState *node) scan->rs_cindex++; #ifdef USE_PREFETCH + /* * Try to prefetch at least a few pages even before we get to the * second page if we don't stop reading after the first tuple. */ if (node->prefetch_target < target_prefetch_pages) node->prefetch_target++; -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ } /* @@ -246,12 +248,13 @@ BitmapHeapNext(BitmapHeapScanState *node) } #ifdef USE_PREFETCH + /* - * We issue prefetch requests *after* fetching the current page - * to try to avoid having prefetching interfere with the main I/O. - * Also, this should happen only when we have determined there is - * still something to do on the current page, else we may uselessly - * prefetch the same page we are just about to request for real. + * We issue prefetch requests *after* fetching the current page to try + * to avoid having prefetching interfere with the main I/O. Also, this + * should happen only when we have determined there is still something + * to do on the current page, else we may uselessly prefetch the same + * page we are just about to request for real. */ if (prefetch_iterator) { @@ -270,7 +273,7 @@ BitmapHeapNext(BitmapHeapScanState *node) PrefetchBuffer(scan->rs_rd, MAIN_FORKNUM, tbmpre->blockno); } } -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ /* * Okay to fetch the tuple diff --git a/src/backend/executor/nodeBitmapIndexscan.c b/src/backend/executor/nodeBitmapIndexscan.c index 5cae058921..1ef6c988ce 100644 --- a/src/backend/executor/nodeBitmapIndexscan.c +++ b/src/backend/executor/nodeBitmapIndexscan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.29 2009/01/01 17:23:41 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.30 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -94,7 +94,7 @@ MultiExecBitmapIndexScan(BitmapIndexScanState *node) doscan = ExecIndexAdvanceArrayKeys(node->biss_ArrayKeys, node->biss_NumArrayKeys); - if (doscan) /* reset index scan */ + if (doscan) /* reset index scan */ index_rescan(node->biss_ScanDesc, node->biss_ScanKeys); } diff --git a/src/backend/executor/nodeCtescan.c b/src/backend/executor/nodeCtescan.c index 67589908ce..81469c41d7 100644 --- a/src/backend/executor/nodeCtescan.c +++ b/src/backend/executor/nodeCtescan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeCtescan.c,v 1.4 2009/03/27 18:30:21 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeCtescan.c,v 1.5 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -73,8 +73,8 @@ CteScanNext(CteScanState *node) * If we can fetch another tuple from the tuplestore, return it. * * Note: we have to use copy=true in the tuplestore_gettupleslot call, - * because we are sharing the tuplestore with other nodes that might - * write into the tuplestore before we get called again. + * because we are sharing the tuplestore with other nodes that might write + * into the tuplestore before we get called again. */ if (!eof_tuplestore) { @@ -111,16 +111,16 @@ CteScanNext(CteScanState *node) * Append a copy of the returned tuple to tuplestore. NOTE: because * our read pointer is certainly in EOF state, its read position will * move forward over the added tuple. This is what we want. Also, - * any other readers will *not* move past the new tuple, which is - * what they want. + * any other readers will *not* move past the new tuple, which is what + * they want. */ tuplestore_puttupleslot(tuplestorestate, cteslot); /* - * We MUST copy the CTE query's output tuple into our own slot. - * This is because other CteScan nodes might advance the CTE query - * before we are called again, and our output tuple must stay - * stable over that. + * We MUST copy the CTE query's output tuple into our own slot. This + * is because other CteScan nodes might advance the CTE query before + * we are called again, and our output tuple must stay stable over + * that. */ return ExecCopySlot(slot, cteslot); } @@ -193,10 +193,10 @@ ExecInitCteScan(CteScan *node, EState *estate, int eflags) node->ctePlanId - 1); /* - * The Param slot associated with the CTE query is used to hold a - * pointer to the CteState of the first CteScan node that initializes - * for this CTE. This node will be the one that holds the shared - * state for all the CTEs. + * The Param slot associated with the CTE query is used to hold a pointer + * to the CteState of the first CteScan node that initializes for this + * CTE. This node will be the one that holds the shared state for all the + * CTEs. */ prmdata = &(estate->es_param_exec_vals[node->cteParam]); Assert(prmdata->execPlan == NULL); @@ -315,8 +315,8 @@ ExecCteScanReScan(CteScanState *node, ExprContext *exprCtxt) if (node->leader == node) { /* - * The leader is responsible for clearing the tuplestore if a new - * scan of the underlying CTE is required. + * The leader is responsible for clearing the tuplestore if a new scan + * of the underlying CTE is required. */ if (node->cteplanstate->chgParam != NULL) { diff --git a/src/backend/executor/nodeFunctionscan.c b/src/backend/executor/nodeFunctionscan.c index 3f34e7c835..f38199650e 100644 --- a/src/backend/executor/nodeFunctionscan.c +++ b/src/backend/executor/nodeFunctionscan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeFunctionscan.c,v 1.51 2009/03/27 18:30:21 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeFunctionscan.c,v 1.52 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -277,7 +277,7 @@ ExecFunctionReScan(FunctionScanState *node, ExprContext *exprCtxt) /* * Here we have a choice whether to drop the tuplestore (and recompute the * function outputs) or just rescan it. We must recompute if the - * expression contains parameters, else we rescan. XXX maybe we should + * expression contains parameters, else we rescan. XXX maybe we should * recompute if the function is volatile? */ if (node->ss.ps.chgParam != NULL) diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c index 4a85dc97c3..471534538a 100644 --- a/src/backend/executor/nodeHash.c +++ b/src/backend/executor/nodeHash.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.120 2009/04/02 20:59:10 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.121 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -41,11 +41,11 @@ static void ExecHashIncreaseNumBatches(HashJoinTable hashtable); static void ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, - int mcvsToUse); + int mcvsToUse); static void ExecHashSkewTableInsert(HashJoinTable hashtable, - TupleTableSlot *slot, - uint32 hashvalue, - int bucketNumber); + TupleTableSlot *slot, + uint32 hashvalue, + int bucketNumber); static void ExecHashRemoveNextSkewBucket(HashJoinTable hashtable); @@ -108,7 +108,7 @@ MultiExecHash(HashState *node) if (ExecHashGetHashValue(hashtable, econtext, hashkeys, false, false, &hashvalue)) { - int bucketNumber; + int bucketNumber; bucketNumber = ExecHashGetSkewBucket(hashtable, hashvalue); if (bucketNumber != INVALID_SKEW_BUCKET_NO) @@ -373,7 +373,7 @@ ExecHashTableCreate(Hash *node, List *hashOperators) /* * Set up for skew optimization, if possible and there's a need for more - * than one batch. (In a one-batch join, there's no point in it.) + * than one batch. (In a one-batch join, there's no point in it.) */ if (nbatch > 1) ExecHashBuildSkewHash(hashtable, node, num_skew_mcvs); @@ -446,14 +446,14 @@ ExecChooseHashTableSize(double ntuples, int tupwidth, bool useskew, skew_table_bytes = hash_table_bytes * SKEW_WORK_MEM_PERCENT / 100; *num_skew_mcvs = skew_table_bytes / ( - /* size of a hash tuple */ - tupsize + - /* worst-case size of skewBucket[] per MCV */ - (8 * sizeof(HashSkewBucket *)) + - /* size of skewBucketNums[] entry */ - sizeof(int) + - /* size of skew bucket struct itself */ - SKEW_BUCKET_OVERHEAD + /* size of a hash tuple */ + tupsize + + /* worst-case size of skewBucket[] per MCV */ + (8 * sizeof(HashSkewBucket *)) + + /* size of skewBucketNums[] entry */ + sizeof(int) + + /* size of skew bucket struct itself */ + SKEW_BUCKET_OVERHEAD ); if (*num_skew_mcvs > 0) @@ -983,11 +983,11 @@ ExecReScanHash(HashState *node, ExprContext *exprCtxt) static void ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse) { - HeapTupleData *statsTuple; - Datum *values; - int nvalues; - float4 *numbers; - int nnumbers; + HeapTupleData *statsTuple; + Datum *values; + int nvalues; + float4 *numbers; + int nnumbers; /* Do nothing if planner didn't identify the outer relation's join key */ if (!OidIsValid(node->skewTable)) @@ -1040,11 +1040,12 @@ ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse) * * skewBucket[] is an open addressing hashtable with a power of 2 size * that is greater than the number of MCV values. (This ensures there - * will be at least one null entry, so searches will always terminate.) + * will be at least one null entry, so searches will always + * terminate.) * - * Note: this code could fail if mcvsToUse exceeds INT_MAX/8, but - * that is not currently possible since we limit pg_statistic entries - * to much less than that. + * Note: this code could fail if mcvsToUse exceeds INT_MAX/8, but that + * is not currently possible since we limit pg_statistic entries to + * much less than that. */ nbuckets = 2; while (nbuckets <= mcvsToUse) @@ -1056,9 +1057,9 @@ ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse) hashtable->skewBucketLen = nbuckets; /* - * We allocate the bucket memory in the hashtable's batch context. - * It is only needed during the first batch, and this ensures it - * will be automatically removed once the first batch is done. + * We allocate the bucket memory in the hashtable's batch context. It + * is only needed during the first batch, and this ensures it will be + * automatically removed once the first batch is done. */ hashtable->skewBucket = (HashSkewBucket **) MemoryContextAllocZero(hashtable->batchCxt, @@ -1075,18 +1076,18 @@ ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse) /* * Create a skew bucket for each MCV hash value. * - * Note: it is very important that we create the buckets in order - * of decreasing MCV frequency. If we have to remove some buckets, - * they must be removed in reverse order of creation (see notes in - * ExecHashRemoveNextSkewBucket) and we want the least common MCVs - * to be removed first. + * Note: it is very important that we create the buckets in order of + * decreasing MCV frequency. If we have to remove some buckets, they + * must be removed in reverse order of creation (see notes in + * ExecHashRemoveNextSkewBucket) and we want the least common MCVs to + * be removed first. */ hashfunctions = hashtable->outer_hashfunctions; for (i = 0; i < mcvsToUse; i++) { - uint32 hashvalue; - int bucket; + uint32 hashvalue; + int bucket; hashvalue = DatumGetUInt32(FunctionCall1(&hashfunctions[0], values[i])); @@ -1094,7 +1095,7 @@ ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse) /* * While we have not hit a hole in the hashtable and have not hit * the desired bucket, we have collided with some previous hash - * value, so try the next bucket location. NB: this code must + * value, so try the next bucket location. NB: this code must * match ExecHashGetSkewBucket. */ bucket = hashvalue & (nbuckets - 1); @@ -1103,8 +1104,8 @@ ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse) bucket = (bucket + 1) & (nbuckets - 1); /* - * If we found an existing bucket with the same hashvalue, - * leave it alone. It's okay for two MCVs to share a hashvalue. + * If we found an existing bucket with the same hashvalue, leave + * it alone. It's okay for two MCVs to share a hashvalue. */ if (hashtable->skewBucket[bucket] != NULL) continue; @@ -1141,8 +1142,8 @@ ExecHashGetSkewBucket(HashJoinTable hashtable, uint32 hashvalue) int bucket; /* - * Always return INVALID_SKEW_BUCKET_NO if not doing skew optimization - * (in particular, this happens after the initial batch is done). + * Always return INVALID_SKEW_BUCKET_NO if not doing skew optimization (in + * particular, this happens after the initial batch is done). */ if (!hashtable->skewEnabled) return INVALID_SKEW_BUCKET_NO; @@ -1154,8 +1155,8 @@ ExecHashGetSkewBucket(HashJoinTable hashtable, uint32 hashvalue) /* * While we have not hit a hole in the hashtable and have not hit the - * desired bucket, we have collided with some other hash value, so try - * the next bucket location. + * desired bucket, we have collided with some other hash value, so try the + * next bucket location. */ while (hashtable->skewBucket[bucket] != NULL && hashtable->skewBucket[bucket]->hashvalue != hashvalue) @@ -1222,11 +1223,11 @@ ExecHashSkewTableInsert(HashJoinTable hashtable, static void ExecHashRemoveNextSkewBucket(HashJoinTable hashtable) { - int bucketToRemove; + int bucketToRemove; HashSkewBucket *bucket; - uint32 hashvalue; - int bucketno; - int batchno; + uint32 hashvalue; + int bucketno; + int batchno; HashJoinTuple hashTuple; /* Locate the bucket to remove */ @@ -1236,8 +1237,8 @@ ExecHashRemoveNextSkewBucket(HashJoinTable hashtable) /* * Calculate which bucket and batch the tuples belong to in the main * hashtable. They all have the same hash value, so it's the same for all - * of them. Also note that it's not possible for nbatch to increase - * while we are processing the tuples. + * of them. Also note that it's not possible for nbatch to increase while + * we are processing the tuples. */ hashvalue = bucket->hashvalue; ExecHashGetBucketAndBatch(hashtable, hashvalue, &bucketno, &batchno); @@ -1248,7 +1249,7 @@ ExecHashRemoveNextSkewBucket(HashJoinTable hashtable) { HashJoinTuple nextHashTuple = hashTuple->next; MinimalTuple tuple; - Size tupleSize; + Size tupleSize; /* * This code must agree with ExecHashTableInsert. We do not use @@ -1286,12 +1287,12 @@ ExecHashRemoveNextSkewBucket(HashJoinTable hashtable) * * NOTE: this is not nearly as simple as it looks on the surface, because * of the possibility of collisions in the hashtable. Suppose that hash - * values A and B collide at a particular hashtable entry, and that A - * was entered first so B gets shifted to a different table entry. If - * we were to remove A first then ExecHashGetSkewBucket would mistakenly - * start reporting that B is not in the hashtable, because it would hit - * the NULL before finding B. However, we always remove entries in the - * reverse order of creation, so this failure cannot happen. + * values A and B collide at a particular hashtable entry, and that A was + * entered first so B gets shifted to a different table entry. If we were + * to remove A first then ExecHashGetSkewBucket would mistakenly start + * reporting that B is not in the hashtable, because it would hit the NULL + * before finding B. However, we always remove entries in the reverse + * order of creation, so this failure cannot happen. */ hashtable->skewBucket[bucketToRemove] = NULL; hashtable->nSkewBuckets--; diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c index c7a0576291..bfb07472b0 100644 --- a/src/backend/executor/nodeHashjoin.c +++ b/src/backend/executor/nodeHashjoin.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeHashjoin.c,v 1.100 2009/04/02 20:59:10 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeHashjoin.c,v 1.101 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -23,7 +23,7 @@ /* Returns true for JOIN_LEFT and JOIN_ANTI jointypes */ -#define HASHJOIN_IS_OUTER(hjstate) ((hjstate)->hj_NullInnerTupleSlot != NULL) +#define HASHJOIN_IS_OUTER(hjstate) ((hjstate)->hj_NullInnerTupleSlot != NULL) static TupleTableSlot *ExecHashJoinOuterGetTuple(PlanState *outerNode, HashJoinState *hjstate, @@ -210,8 +210,8 @@ ExecHashJoin(HashJoinState *node) /* * Now we've got an outer tuple and the corresponding hash bucket, - * but it might not belong to the current batch, or it might - * match a skew bucket. + * but it might not belong to the current batch, or it might match + * a skew bucket. */ if (batchno != hashtable->curbatch && node->hj_CurSkewBucketNo == INVALID_SKEW_BUCKET_NO) @@ -656,13 +656,13 @@ start_over: BufFileClose(hashtable->outerBatchFile[curbatch]); hashtable->outerBatchFile[curbatch] = NULL; } - else /* we just finished the first batch */ + else /* we just finished the first batch */ { /* - * Reset some of the skew optimization state variables, since we - * no longer need to consider skew tuples after the first batch. - * The memory context reset we are about to do will release the - * skew hashtable itself. + * Reset some of the skew optimization state variables, since we no + * longer need to consider skew tuples after the first batch. The + * memory context reset we are about to do will release the skew + * hashtable itself. */ hashtable->skewEnabled = false; hashtable->skewBucket = NULL; diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c index f440da756a..d0f1899fca 100644 --- a/src/backend/executor/nodeIndexscan.c +++ b/src/backend/executor/nodeIndexscan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.131 2009/01/01 17:23:41 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.132 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -367,8 +367,8 @@ ExecIndexAdvanceArrayKeys(IndexArrayKeyInfo *arrayKeys, int numArrayKeys) /* * Note we advance the rightmost array key most quickly, since it will * correspond to the lowest-order index column among the available - * qualifications. This is hypothesized to result in better locality - * of access in the index. + * qualifications. This is hypothesized to result in better locality of + * access in the index. */ for (j = numArrayKeys - 1; j >= 0; j--) { @@ -716,8 +716,8 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, Index scanrelid, extra_scan_keys = n_scan_keys; /* - * for each opclause in the given qual, convert the opclause into - * a single scan key + * for each opclause in the given qual, convert the opclause into a single + * scan key */ j = 0; foreach(qual_cell, quals) @@ -727,8 +727,8 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, Index scanrelid, Oid opno; /* operator's OID */ RegProcedure opfuncid; /* operator proc id used in scan */ Oid opfamily; /* opfamily of index column */ - int op_strategy; /* operator's strategy number */ - Oid op_lefttype; /* operator's declared input types */ + int op_strategy; /* operator's strategy number */ + Oid op_lefttype; /* operator's declared input types */ Oid op_righttype; Expr *leftop; /* expr on lhs of operator */ Expr *rightop; /* expr on rhs ... */ @@ -805,8 +805,8 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, Index scanrelid, ScanKeyEntryInitialize(this_scan_key, flags, varattno, /* attribute number to scan */ - op_strategy, /* op's strategy */ - op_righttype, /* strategy subtype */ + op_strategy, /* op's strategy */ + op_righttype, /* strategy subtype */ opfuncid, /* reg proc to use */ scanvalue); /* constant */ } @@ -983,8 +983,8 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, Index scanrelid, ScanKeyEntryInitialize(this_scan_key, 0, /* flags */ varattno, /* attribute number to scan */ - op_strategy, /* op's strategy */ - op_righttype, /* strategy subtype */ + op_strategy, /* op's strategy */ + op_righttype, /* strategy subtype */ opfuncid, /* reg proc to use */ (Datum) 0); /* constant */ } @@ -1015,7 +1015,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, Index scanrelid, ScanKeyEntryInitialize(this_scan_key, SK_ISNULL | SK_SEARCHNULL, varattno, /* attribute number to scan */ - InvalidStrategy, /* no strategy */ + InvalidStrategy, /* no strategy */ InvalidOid, /* no strategy subtype */ InvalidOid, /* no reg proc for this */ (Datum) 0); /* constant */ diff --git a/src/backend/executor/nodeLimit.c b/src/backend/executor/nodeLimit.c index f7c1c7acdc..0626b8be37 100644 --- a/src/backend/executor/nodeLimit.c +++ b/src/backend/executor/nodeLimit.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeLimit.c,v 1.38 2009/04/02 20:59:10 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeLimit.c,v 1.39 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -247,8 +247,8 @@ recompute_limits(LimitState *node) node->offset = DatumGetInt64(val); if (node->offset < 0) ereport(ERROR, - (errcode(ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE), - errmsg("OFFSET must not be negative"))); + (errcode(ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE), + errmsg("OFFSET must not be negative"))); } } else diff --git a/src/backend/executor/nodeMaterial.c b/src/backend/executor/nodeMaterial.c index 9282bf130d..817a7e7824 100644 --- a/src/backend/executor/nodeMaterial.c +++ b/src/backend/executor/nodeMaterial.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeMaterial.c,v 1.68 2009/04/02 20:59:10 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeMaterial.c,v 1.69 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -63,10 +63,10 @@ ExecMaterial(MaterialState *node) if (node->eflags & EXEC_FLAG_MARK) { /* - * Allocate a second read pointer to serve as the mark. - * We know it must have index 1, so needn't store that. + * Allocate a second read pointer to serve as the mark. We know it + * must have index 1, so needn't store that. */ - int ptrno; + int ptrno; ptrno = tuplestore_alloc_read_pointer(tuplestorestate, node->eflags); @@ -185,7 +185,7 @@ ExecInitMaterial(Material *node, EState *estate, int eflags) /* * Tuplestore's interpretation of the flag bits is subtly different from * the general executor meaning: it doesn't think BACKWARD necessarily - * means "backwards all the way to start". If told to support BACKWARD we + * means "backwards all the way to start". If told to support BACKWARD we * must include REWIND in the tuplestore eflags, else tuplestore_trim * might throw away too much. */ diff --git a/src/backend/executor/nodeMergejoin.c b/src/backend/executor/nodeMergejoin.c index 52bdf3bfe5..3b9bcb7d56 100644 --- a/src/backend/executor/nodeMergejoin.c +++ b/src/backend/executor/nodeMergejoin.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeMergejoin.c,v 1.96 2009/04/02 20:59:10 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeMergejoin.c,v 1.97 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -774,8 +774,8 @@ ExecMergeJoin(MergeJoinState *node) } /* - * In a semijoin, we'll consider returning the first match, - * but after that we're done with this outer tuple. + * In a semijoin, we'll consider returning the first + * match, but after that we're done with this outer tuple. */ if (node->js.jointype == JOIN_SEMI) node->mj_JoinState = EXEC_MJ_NEXTOUTER; diff --git a/src/backend/executor/nodeNestloop.c b/src/backend/executor/nodeNestloop.c index 93f7e81e67..338ee07e62 100644 --- a/src/backend/executor/nodeNestloop.c +++ b/src/backend/executor/nodeNestloop.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeNestloop.c,v 1.52 2009/04/02 20:59:10 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeNestloop.c,v 1.53 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -225,8 +225,8 @@ ExecNestLoop(NestLoopState *node) } /* - * In a semijoin, we'll consider returning the first match, - * but after that we're done with this outer tuple. + * In a semijoin, we'll consider returning the first match, but + * after that we're done with this outer tuple. */ if (node->js.jointype == JOIN_SEMI) node->nl_NeedNewOuter = true; diff --git a/src/backend/executor/nodeRecursiveunion.c b/src/backend/executor/nodeRecursiveunion.c index 4c674d0315..39b687f221 100644 --- a/src/backend/executor/nodeRecursiveunion.c +++ b/src/backend/executor/nodeRecursiveunion.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeRecursiveunion.c,v 1.3 2009/01/01 17:23:42 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeRecursiveunion.c,v 1.4 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -38,7 +38,7 @@ typedef struct RUHashEntryData static void build_hash_table(RecursiveUnionState *rustate) { - RecursiveUnion *node = (RecursiveUnion *) rustate->ps.plan; + RecursiveUnion *node = (RecursiveUnion *) rustate->ps.plan; Assert(node->numCols > 0); Assert(node->numGroups > 0); @@ -58,7 +58,7 @@ build_hash_table(RecursiveUnionState *rustate) * ExecRecursiveUnion(node) * * Scans the recursive query sequentially and returns the next - * qualifying tuple. + * qualifying tuple. * * 1. evaluate non recursive term and assign the result to RT * @@ -151,8 +151,8 @@ ExecRecursiveUnion(RecursiveUnionState *node) } /* Else, tuple is good; stash it in intermediate table ... */ - node->intermediate_empty = false; - tuplestore_puttupleslot(node->intermediate_table, slot); + node->intermediate_empty = false; + tuplestore_puttupleslot(node->intermediate_table, slot); /* ... and return it */ return slot; } @@ -240,8 +240,8 @@ ExecInitRecursiveUnion(RecursiveUnion *node, EState *estate, int eflags) ExecInitResultTupleSlot(estate, &rustate->ps); /* - * Initialize result tuple type and projection info. (Note: we have - * to set up the result type before initializing child nodes, because + * Initialize result tuple type and projection info. (Note: we have to + * set up the result type before initializing child nodes, because * nodeWorktablescan.c expects it to be valid.) */ ExecAssignResultTypeFromTL(&rustate->ps); @@ -254,8 +254,8 @@ ExecInitRecursiveUnion(RecursiveUnion *node, EState *estate, int eflags) innerPlanState(rustate) = ExecInitNode(innerPlan(node), estate, eflags); /* - * If hashing, precompute fmgr lookup data for inner loop, and create - * the hash table. + * If hashing, precompute fmgr lookup data for inner loop, and create the + * hash table. */ if (node->numCols > 0) { @@ -322,15 +322,15 @@ ExecRecursiveUnionReScan(RecursiveUnionState *node, ExprContext *exprCtxt) RecursiveUnion *plan = (RecursiveUnion *) node->ps.plan; /* - * Set recursive term's chgParam to tell it that we'll modify the - * working table and therefore it has to rescan. + * Set recursive term's chgParam to tell it that we'll modify the working + * table and therefore it has to rescan. */ innerPlan->chgParam = bms_add_member(innerPlan->chgParam, plan->wtParam); /* * if chgParam of subnode is not null then plan will be re-scanned by - * first ExecProcNode. Because of above, we only have to do this to - * the non-recursive term. + * first ExecProcNode. Because of above, we only have to do this to the + * non-recursive term. */ if (outerPlan->chgParam == NULL) ExecReScan(outerPlan, exprCtxt); diff --git a/src/backend/executor/nodeSetOp.c b/src/backend/executor/nodeSetOp.c index 3611ae7ddc..cff155abe6 100644 --- a/src/backend/executor/nodeSetOp.c +++ b/src/backend/executor/nodeSetOp.c @@ -5,7 +5,7 @@ * * The input of a SetOp node consists of tuples from two relations, * which have been combined into one dataset, with a junk attribute added - * that shows which relation each tuple came from. In SETOP_SORTED mode, + * that shows which relation each tuple came from. In SETOP_SORTED mode, * the input has furthermore been sorted according to all the grouping * columns (ie, all the non-junk attributes). The SetOp node scans each * group of identical tuples to determine how many came from each input @@ -18,7 +18,7 @@ * relation is the left-hand one for EXCEPT, and tries to make the smaller * input relation come first for INTERSECT. We build a hash table in memory * with one entry for each group of identical tuples, and count the number of - * tuples in the group from each relation. After seeing all the input, we + * tuples in the group from each relation. After seeing all the input, we * scan the hashtable and generate the correct output using those counts. * We can avoid making hashtable entries for any tuples appearing only in the * second input relation, since they cannot result in any output. @@ -37,7 +37,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeSetOp.c,v 1.30 2009/04/02 20:59:10 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeSetOp.c,v 1.31 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -266,15 +266,15 @@ setop_retrieve_direct(SetOpState *setopstate) } /* - * Store the copied first input tuple in the tuple table slot - * reserved for it. The tuple will be deleted when it is cleared - * from the slot. + * Store the copied first input tuple in the tuple table slot reserved + * for it. The tuple will be deleted when it is cleared from the + * slot. */ ExecStoreTuple(setopstate->grp_firstTuple, resultTupleSlot, InvalidBuffer, true); - setopstate->grp_firstTuple = NULL; /* don't keep two pointers */ + setopstate->grp_firstTuple = NULL; /* don't keep two pointers */ /* Initialize working state for a new input tuple group */ initialize_counts(pergroup); @@ -318,8 +318,8 @@ setop_retrieve_direct(SetOpState *setopstate) } /* - * Done scanning input tuple group. See if we should emit any - * copies of result tuple, and if so return the first copy. + * Done scanning input tuple group. See if we should emit any copies + * of result tuple, and if so return the first copy. */ set_output_count(setopstate, pergroup); @@ -533,8 +533,8 @@ ExecInitSetOp(SetOp *node, EState *estate, int eflags) /* * initialize child nodes * - * If we are hashing then the child plan does not need - * to handle REWIND efficiently; see ExecReScanSetOp. + * If we are hashing then the child plan does not need to handle REWIND + * efficiently; see ExecReScanSetOp. */ if (node->strategy == SETOP_HASHED) eflags &= ~EXEC_FLAG_REWIND; diff --git a/src/backend/executor/nodeSubplan.c b/src/backend/executor/nodeSubplan.c index ed00ba33e7..016dbc378b 100644 --- a/src/backend/executor/nodeSubplan.c +++ b/src/backend/executor/nodeSubplan.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeSubplan.c,v 1.98 2009/04/02 20:59:10 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeSubplan.c,v 1.99 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -34,9 +34,9 @@ static Datum ExecSubPlan(SubPlanState *node, bool *isNull, ExprDoneCond *isDone); static Datum ExecAlternativeSubPlan(AlternativeSubPlanState *node, - ExprContext *econtext, - bool *isNull, - ExprDoneCond *isDone); + ExprContext *econtext, + bool *isNull, + ExprDoneCond *isDone); static Datum ExecHashSubPlan(SubPlanState *node, ExprContext *econtext, bool *isNull); @@ -1073,8 +1073,8 @@ ExecReScanSetParamPlan(SubPlanState *node, PlanState *parent) * * CTE subplans are never executed via parameter recalculation; instead * they get run when called by nodeCtescan.c. So don't mark the output - * parameter of a CTE subplan as dirty, but do set the chgParam bit - * for it so that dependent plan nodes will get told to rescan. + * parameter of a CTE subplan as dirty, but do set the chgParam bit for it + * so that dependent plan nodes will get told to rescan. */ foreach(l, subplan->setParam) { @@ -1099,8 +1099,8 @@ ExecInitAlternativeSubPlan(AlternativeSubPlan *asplan, PlanState *parent) { AlternativeSubPlanState *asstate = makeNode(AlternativeSubPlanState); double num_calls; - SubPlan *subplan1; - SubPlan *subplan2; + SubPlan *subplan1; + SubPlan *subplan2; Cost cost1; Cost cost2; @@ -1108,18 +1108,18 @@ ExecInitAlternativeSubPlan(AlternativeSubPlan *asplan, PlanState *parent) asstate->xprstate.expr = (Expr *) asplan; /* - * Initialize subplans. (Can we get away with only initializing the - * one we're going to use?) + * Initialize subplans. (Can we get away with only initializing the one + * we're going to use?) */ asstate->subplans = (List *) ExecInitExpr((Expr *) asplan->subplans, parent); /* - * Select the one to be used. For this, we need an estimate of the - * number of executions of the subplan. We use the number of output - * rows expected from the parent plan node. This is a good estimate - * if we are in the parent's targetlist, and an underestimate (but - * probably not by more than a factor of 2) if we are in the qual. + * Select the one to be used. For this, we need an estimate of the number + * of executions of the subplan. We use the number of output rows + * expected from the parent plan node. This is a good estimate if we are + * in the parent's targetlist, and an underestimate (but probably not by + * more than a factor of 2) if we are in the qual. */ num_calls = parent->plan->plan_rows; @@ -1157,8 +1157,8 @@ ExecAlternativeSubPlan(AlternativeSubPlanState *node, ExprDoneCond *isDone) { /* Just pass control to the active subplan */ - SubPlanState *activesp = (SubPlanState *) list_nth(node->subplans, - node->active); + SubPlanState *activesp = (SubPlanState *) list_nth(node->subplans, + node->active); Assert(IsA(activesp, SubPlanState)); diff --git a/src/backend/executor/nodeTidscan.c b/src/backend/executor/nodeTidscan.c index c0132c943f..1a7c5a7aa7 100644 --- a/src/backend/executor/nodeTidscan.c +++ b/src/backend/executor/nodeTidscan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeTidscan.c,v 1.61 2009/01/01 17:23:42 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeTidscan.c,v 1.62 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -63,10 +63,10 @@ TidListCreate(TidScanState *tidstate) ListCell *l; /* - * We silently discard any TIDs that are out of range at the time of - * scan start. (Since we hold at least AccessShareLock on the table, - * it won't be possible for someone to truncate away the blocks we - * intend to visit.) + * We silently discard any TIDs that are out of range at the time of scan + * start. (Since we hold at least AccessShareLock on the table, it won't + * be possible for someone to truncate away the blocks we intend to + * visit.) */ nblocks = RelationGetNumberOfBlocks(tidstate->ss.ss_currentRelation); diff --git a/src/backend/executor/nodeUnique.c b/src/backend/executor/nodeUnique.c index b3c256923d..8878e6ede9 100644 --- a/src/backend/executor/nodeUnique.c +++ b/src/backend/executor/nodeUnique.c @@ -4,7 +4,7 @@ * Routines to handle unique'ing of queries where appropriate * * Unique is a very simple node type that just filters out duplicate - * tuples from a stream of sorted tuples from its subplan. It's essentially + * tuples from a stream of sorted tuples from its subplan. It's essentially * a dumbed-down form of Group: the duplicate-removal functionality is * identical. However, Unique doesn't do projection nor qual checking, * so it's marginally more efficient for cases where neither is needed. @@ -16,7 +16,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeUnique.c,v 1.60 2009/04/02 20:59:10 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeUnique.c,v 1.61 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -58,8 +58,8 @@ ExecUnique(UniqueState *node) /* * now loop, returning only non-duplicate tuples. We assume that the - * tuples arrive in sorted order so we can detect duplicates easily. - * The first tuple of each group is returned. + * tuples arrive in sorted order so we can detect duplicates easily. The + * first tuple of each group is returned. */ for (;;) { diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c index 263cb0a78c..0d9eb21a91 100644 --- a/src/backend/executor/nodeWindowAgg.c +++ b/src/backend/executor/nodeWindowAgg.c @@ -4,7 +4,7 @@ * routines to handle WindowAgg nodes. * * A WindowAgg node evaluates "window functions" across suitable partitions - * of the input tuple set. Any one WindowAgg works for just a single window + * of the input tuple set. Any one WindowAgg works for just a single window * specification, though it can evaluate multiple window functions sharing * identical window specifications. The input tuples are required to be * delivered in sorted order, with the PARTITION BY columns (if any) as @@ -14,7 +14,7 @@ * * Since window functions can require access to any or all of the rows in * the current partition, we accumulate rows of the partition into a - * tuplestore. The window functions are called using the WindowObject API + * tuplestore. The window functions are called using the WindowObject API * so that they can access those rows as needed. * * We also support using plain aggregate functions as window functions. @@ -27,7 +27,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeWindowAgg.c,v 1.4 2009/03/27 18:30:21 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeWindowAgg.c,v 1.5 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -75,15 +75,15 @@ typedef struct WindowStatePerFuncData { /* Links to WindowFunc expr and state nodes this working state is for */ WindowFuncExprState *wfuncstate; - WindowFunc *wfunc; + WindowFunc *wfunc; int numArguments; /* number of arguments */ FmgrInfo flinfo; /* fmgr lookup data for window function */ /* - * We need the len and byval info for the result of each function - * in order to know how to copy/delete values. + * We need the len and byval info for the result of each function in order + * to know how to copy/delete values. */ int16 resulttypeLen; bool resulttypeByVal; @@ -91,7 +91,7 @@ typedef struct WindowStatePerFuncData bool plain_agg; /* is it just a plain aggregate function? */ int aggno; /* if so, index of its PerAggData */ - WindowObject winobj; /* object used in window function API */ + WindowObject winobj; /* object used in window function API */ } WindowStatePerFuncData; /* @@ -144,38 +144,38 @@ typedef struct WindowStatePerAggData } WindowStatePerAggData; static void initialize_windowaggregate(WindowAggState *winstate, - WindowStatePerFunc perfuncstate, - WindowStatePerAgg peraggstate); + WindowStatePerFunc perfuncstate, + WindowStatePerAgg peraggstate); static void advance_windowaggregate(WindowAggState *winstate, - WindowStatePerFunc perfuncstate, - WindowStatePerAgg peraggstate); + WindowStatePerFunc perfuncstate, + WindowStatePerAgg peraggstate); static void finalize_windowaggregate(WindowAggState *winstate, - WindowStatePerFunc perfuncstate, - WindowStatePerAgg peraggstate, - Datum *result, bool *isnull); + WindowStatePerFunc perfuncstate, + WindowStatePerAgg peraggstate, + Datum *result, bool *isnull); static void eval_windowaggregates(WindowAggState *winstate); static void eval_windowfunction(WindowAggState *winstate, - WindowStatePerFunc perfuncstate, - Datum *result, bool *isnull); + WindowStatePerFunc perfuncstate, + Datum *result, bool *isnull); static void begin_partition(WindowAggState *winstate); static void spool_tuples(WindowAggState *winstate, int64 pos); static void release_partition(WindowAggState *winstate); static bool row_is_in_frame(WindowAggState *winstate, int64 pos, - TupleTableSlot *slot); + TupleTableSlot *slot); static void update_frametailpos(WindowObject winobj, TupleTableSlot *slot); static WindowStatePerAggData *initialize_peragg(WindowAggState *winstate, - WindowFunc *wfunc, - WindowStatePerAgg peraggstate); + WindowFunc *wfunc, + WindowStatePerAgg peraggstate); static Datum GetAggInitVal(Datum textInitVal, Oid transtype); static bool are_peers(WindowAggState *winstate, TupleTableSlot *slot1, - TupleTableSlot *slot2); + TupleTableSlot *slot2); static bool window_gettupleslot(WindowObject winobj, int64 pos, - TupleTableSlot *slot); + TupleTableSlot *slot); /* @@ -187,7 +187,7 @@ initialize_windowaggregate(WindowAggState *winstate, WindowStatePerFunc perfuncstate, WindowStatePerAgg peraggstate) { - MemoryContext oldContext; + MemoryContext oldContext; if (peraggstate->initValueIsNull) peraggstate->transValue = peraggstate->initValue; @@ -213,14 +213,14 @@ advance_windowaggregate(WindowAggState *winstate, WindowStatePerFunc perfuncstate, WindowStatePerAgg peraggstate) { - WindowFuncExprState *wfuncstate = perfuncstate->wfuncstate; - int numArguments = perfuncstate->numArguments; - FunctionCallInfoData fcinfodata; - FunctionCallInfo fcinfo = &fcinfodata; - Datum newVal; - ListCell *arg; - int i; - MemoryContext oldContext; + WindowFuncExprState *wfuncstate = perfuncstate->wfuncstate; + int numArguments = perfuncstate->numArguments; + FunctionCallInfoData fcinfodata; + FunctionCallInfo fcinfo = &fcinfodata; + Datum newVal; + ListCell *arg; + int i; + MemoryContext oldContext; ExprContext *econtext = winstate->tmpcontext; oldContext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory); @@ -229,7 +229,7 @@ advance_windowaggregate(WindowAggState *winstate, i = 1; foreach(arg, wfuncstate->args) { - ExprState *argstate = (ExprState *) lfirst(arg); + ExprState *argstate = (ExprState *) lfirst(arg); fcinfo->arg[i] = ExecEvalExpr(argstate, econtext, &fcinfo->argnull[i], NULL); @@ -263,8 +263,8 @@ advance_windowaggregate(WindowAggState *winstate, */ MemoryContextSwitchTo(winstate->wincontext); peraggstate->transValue = datumCopy(fcinfo->arg[1], - peraggstate->transtypeByVal, - peraggstate->transtypeLen); + peraggstate->transtypeByVal, + peraggstate->transtypeLen); peraggstate->transValueIsNull = false; peraggstate->noTransValue = false; MemoryContextSwitchTo(oldContext); @@ -327,7 +327,7 @@ finalize_windowaggregate(WindowAggState *winstate, WindowStatePerAgg peraggstate, Datum *result, bool *isnull) { - MemoryContext oldContext; + MemoryContext oldContext; oldContext = MemoryContextSwitchTo(winstate->ss.ps.ps_ExprContext->ecxt_per_tuple_memory); @@ -336,7 +336,7 @@ finalize_windowaggregate(WindowAggState *winstate, */ if (OidIsValid(peraggstate->finalfn_oid)) { - FunctionCallInfoData fcinfo; + FunctionCallInfoData fcinfo; InitFunctionCallInfoData(fcinfo, &(peraggstate->finalfn), 1, (void *) winstate, NULL); @@ -384,12 +384,13 @@ finalize_windowaggregate(WindowAggState *winstate, static void eval_windowaggregates(WindowAggState *winstate) { - WindowStatePerAgg peraggstate; - int wfuncno, numaggs; - int i; - MemoryContext oldContext; - ExprContext *econtext; - TupleTableSlot *agg_row_slot; + WindowStatePerAgg peraggstate; + int wfuncno, + numaggs; + int i; + MemoryContext oldContext; + ExprContext *econtext; + TupleTableSlot *agg_row_slot; numaggs = winstate->numaggs; if (numaggs == 0) @@ -400,44 +401,43 @@ eval_windowaggregates(WindowAggState *winstate) /* * Currently, we support only a subset of the SQL-standard window framing - * rules. In all the supported cases, the window frame always consists - * of a contiguous group of rows extending forward from the start of the - * partition, and rows only enter the frame, never exit it, as the - * current row advances forward. This makes it possible to use an - * incremental strategy for evaluating aggregates: we run the transition - * function for each row added to the frame, and run the final function - * whenever we need the current aggregate value. This is considerably - * more efficient than the naive approach of re-running the entire - * aggregate calculation for each current row. It does assume that the - * final function doesn't damage the running transition value. (Some - * C-coded aggregates do that for efficiency's sake --- but they are - * supposed to do so only when their fcinfo->context is an AggState, not - * a WindowAggState.) + * rules. In all the supported cases, the window frame always consists of + * a contiguous group of rows extending forward from the start of the + * partition, and rows only enter the frame, never exit it, as the current + * row advances forward. This makes it possible to use an incremental + * strategy for evaluating aggregates: we run the transition function for + * each row added to the frame, and run the final function whenever we + * need the current aggregate value. This is considerably more efficient + * than the naive approach of re-running the entire aggregate calculation + * for each current row. It does assume that the final function doesn't + * damage the running transition value. (Some C-coded aggregates do that + * for efficiency's sake --- but they are supposed to do so only when + * their fcinfo->context is an AggState, not a WindowAggState.) * - * In many common cases, multiple rows share the same frame and hence - * the same aggregate value. (In particular, if there's no ORDER BY in - * a RANGE window, then all rows are peers and so they all have window - * frame equal to the whole partition.) We optimize such cases by - * calculating the aggregate value once when we reach the first row of a - * peer group, and then returning the saved value for all subsequent rows. + * In many common cases, multiple rows share the same frame and hence the + * same aggregate value. (In particular, if there's no ORDER BY in a RANGE + * window, then all rows are peers and so they all have window frame equal + * to the whole partition.) We optimize such cases by calculating the + * aggregate value once when we reach the first row of a peer group, and + * then returning the saved value for all subsequent rows. * * 'aggregatedupto' keeps track of the first row that has not yet been * accumulated into the aggregate transition values. Whenever we start a * new peer group, we accumulate forward to the end of the peer group. * - * TODO: In the future, we should implement the full SQL-standard set - * of framing rules. We could implement the other cases by recalculating - * the aggregates whenever a row exits the frame. That would be pretty - * slow, though. For aggregates like SUM and COUNT we could implement a + * TODO: In the future, we should implement the full SQL-standard set of + * framing rules. We could implement the other cases by recalculating the + * aggregates whenever a row exits the frame. That would be pretty slow, + * though. For aggregates like SUM and COUNT we could implement a * "negative transition function" that would be called for each row as it * exits the frame. We'd have to think about avoiding recalculation of * volatile arguments of aggregate functions, too. */ /* - * If we've already aggregated up through current row, reuse the - * saved result values. NOTE: this test works for the currently - * supported framing rules, but will need fixing when more are added. + * If we've already aggregated up through current row, reuse the saved + * result values. NOTE: this test works for the currently supported + * framing rules, but will need fixing when more are added. */ if (winstate->aggregatedupto > winstate->currentpos) { @@ -467,9 +467,9 @@ eval_windowaggregates(WindowAggState *winstate) /* * Advance until we reach a row not in frame (or end of partition). * - * Note the loop invariant: agg_row_slot is either empty or holds the - * row at position aggregatedupto. The agg_ptr read pointer must always - * point to the next row to read into agg_row_slot. + * Note the loop invariant: agg_row_slot is either empty or holds the row + * at position aggregatedupto. The agg_ptr read pointer must always point + * to the next row to read into agg_row_slot. */ agg_row_slot = winstate->agg_row_slot; for (;;) @@ -530,16 +530,16 @@ eval_windowaggregates(WindowAggState *winstate) /* * save the result in case next row shares the same frame. * - * XXX in some framing modes, eg ROWS/END_CURRENT_ROW, we can know - * in advance that the next row can't possibly share the same frame. - * Is it worth detecting that and skipping this code? + * XXX in some framing modes, eg ROWS/END_CURRENT_ROW, we can know in + * advance that the next row can't possibly share the same frame. Is + * it worth detecting that and skipping this code? */ if (!peraggstate->resulttypeByVal) { /* - * clear old resultValue in order not to leak memory. (Note: - * the new result can't possibly be the same datum as old - * resultValue, because we never passed it to the trans function.) + * clear old resultValue in order not to leak memory. (Note: the + * new result can't possibly be the same datum as old resultValue, + * because we never passed it to the trans function.) */ if (!peraggstate->resultValueIsNull) pfree(DatumGetPointer(peraggstate->resultValue)); @@ -579,15 +579,15 @@ eval_windowfunction(WindowAggState *winstate, WindowStatePerFunc perfuncstate, Datum *result, bool *isnull) { FunctionCallInfoData fcinfo; - MemoryContext oldContext; + MemoryContext oldContext; oldContext = MemoryContextSwitchTo(winstate->ss.ps.ps_ExprContext->ecxt_per_tuple_memory); /* - * We don't pass any normal arguments to a window function, but we do - * pass it the number of arguments, in order to permit window function - * implementations to support varying numbers of arguments. The real - * info goes through the WindowObject, which is passed via fcinfo->context. + * We don't pass any normal arguments to a window function, but we do pass + * it the number of arguments, in order to permit window function + * implementations to support varying numbers of arguments. The real info + * goes through the WindowObject, which is passed via fcinfo->context. */ InitFunctionCallInfoData(fcinfo, &(perfuncstate->flinfo), perfuncstate->numArguments, @@ -599,9 +599,9 @@ eval_windowfunction(WindowAggState *winstate, WindowStatePerFunc perfuncstate, *isnull = fcinfo.isnull; /* - * Make sure pass-by-ref data is allocated in the appropriate context. - * (We need this in case the function returns a pointer into some - * short-lived tuple, as is entirely possible.) + * Make sure pass-by-ref data is allocated in the appropriate context. (We + * need this in case the function returns a pointer into some short-lived + * tuple, as is entirely possible.) */ if (!perfuncstate->resulttypeByVal && !fcinfo.isnull && !MemoryContextContains(CurrentMemoryContext, @@ -620,9 +620,9 @@ eval_windowfunction(WindowAggState *winstate, WindowStatePerFunc perfuncstate, static void begin_partition(WindowAggState *winstate) { - PlanState *outerPlan = outerPlanState(winstate); - int numfuncs = winstate->numfuncs; - int i; + PlanState *outerPlan = outerPlanState(winstate); + int numfuncs = winstate->numfuncs; + int i; winstate->partition_spooled = false; winstate->frametail_valid = false; @@ -633,15 +633,15 @@ begin_partition(WindowAggState *winstate) ExecClearTuple(winstate->agg_row_slot); /* - * If this is the very first partition, we need to fetch the first - * input row to store in first_part_slot. + * If this is the very first partition, we need to fetch the first input + * row to store in first_part_slot. */ if (TupIsNull(winstate->first_part_slot)) { TupleTableSlot *outerslot = ExecProcNode(outerPlan); if (!TupIsNull(outerslot)) - ExecCopySlot(winstate->first_part_slot, outerslot); + ExecCopySlot(winstate->first_part_slot, outerslot); else { /* outer plan is empty, so we have nothing to do */ @@ -671,16 +671,16 @@ begin_partition(WindowAggState *winstate) /* create mark and read pointers for each real window function */ for (i = 0; i < numfuncs; i++) { - WindowStatePerFunc perfuncstate = &(winstate->perfunc[i]); + WindowStatePerFunc perfuncstate = &(winstate->perfunc[i]); if (!perfuncstate->plain_agg) { - WindowObject winobj = perfuncstate->winobj; + WindowObject winobj = perfuncstate->winobj; winobj->markptr = tuplestore_alloc_read_pointer(winstate->buffer, 0); winobj->readptr = tuplestore_alloc_read_pointer(winstate->buffer, - EXEC_FLAG_BACKWARD); + EXEC_FLAG_BACKWARD); winobj->markpos = -1; winobj->seekpos = -1; } @@ -701,8 +701,8 @@ begin_partition(WindowAggState *winstate) static void spool_tuples(WindowAggState *winstate, int64 pos) { - WindowAgg *node = (WindowAgg *) winstate->ss.ps.plan; - PlanState *outerPlan; + WindowAgg *node = (WindowAgg *) winstate->ss.ps.plan; + PlanState *outerPlan; TupleTableSlot *outerslot; MemoryContext oldcontext; @@ -713,7 +713,7 @@ spool_tuples(WindowAggState *winstate, int64 pos) /* * If the tuplestore has spilled to disk, alternate reading and writing - * becomes quite expensive due to frequent buffer flushes. It's cheaper + * becomes quite expensive due to frequent buffer flushes. It's cheaper * to force the entire partition to get spooled in one go. * * XXX this is a horrid kluge --- it'd be better to fix the performance @@ -773,11 +773,11 @@ spool_tuples(WindowAggState *winstate, int64 pos) static void release_partition(WindowAggState *winstate) { - int i; + int i; for (i = 0; i < winstate->numfuncs; i++) { - WindowStatePerFunc perfuncstate = &(winstate->perfunc[i]); + WindowStatePerFunc perfuncstate = &(winstate->perfunc[i]); /* Release any partition-local state of this window function */ if (perfuncstate->winobj) @@ -804,7 +804,7 @@ release_partition(WindowAggState *winstate) * to our window framing rule * * The caller must have already determined that the row is in the partition - * and fetched it into a slot. This function just encapsulates the framing + * and fetched it into a slot. This function just encapsulates the framing * rules. */ static bool @@ -895,8 +895,8 @@ update_frametailpos(WindowObject winobj, TupleTableSlot *slot) } /* - * Else we have to search for the first non-peer of the current row. - * We assume the current value of frametailpos is a lower bound on the + * Else we have to search for the first non-peer of the current row. We + * assume the current value of frametailpos is a lower bound on the * possible frame tail location, ie, frame tail never goes backward, and * that currentpos is also a lower bound, ie, current row is always in * frame. @@ -929,18 +929,18 @@ TupleTableSlot * ExecWindowAgg(WindowAggState *winstate) { TupleTableSlot *result; - ExprDoneCond isDone; - ExprContext *econtext; - int i; - int numfuncs; + ExprDoneCond isDone; + ExprContext *econtext; + int i; + int numfuncs; if (winstate->all_done) return NULL; /* - * Check to see if we're still projecting out tuples from a previous output - * tuple (because there is a function-returning-set in the projection - * expressions). If so, try to project another one. + * Check to see if we're still projecting out tuples from a previous + * output tuple (because there is a function-returning-set in the + * projection expressions). If so, try to project another one. */ if (winstate->ss.ps.ps_TupFromTlist) { @@ -1003,8 +1003,8 @@ restart: * Read the current row from the tuplestore, and save in ScanTupleSlot. * (We can't rely on the outerplan's output slot because we may have to * read beyond the current row. Also, we have to actually copy the row - * out of the tuplestore, since window function evaluation might cause - * the tuplestore to dump its state to disk.) + * out of the tuplestore, since window function evaluation might cause the + * tuplestore to dump its state to disk.) * * Current row must be in the tuplestore, since we spooled it above. */ @@ -1019,13 +1019,13 @@ restart: numfuncs = winstate->numfuncs; for (i = 0; i < numfuncs; i++) { - WindowStatePerFunc perfuncstate = &(winstate->perfunc[i]); + WindowStatePerFunc perfuncstate = &(winstate->perfunc[i]); if (perfuncstate->plain_agg) continue; eval_windowfunction(winstate, perfuncstate, - &(econtext->ecxt_aggvalues[perfuncstate->wfuncstate->wfuncno]), - &(econtext->ecxt_aggnulls[perfuncstate->wfuncstate->wfuncno])); + &(econtext->ecxt_aggvalues[perfuncstate->wfuncstate->wfuncno]), + &(econtext->ecxt_aggnulls[perfuncstate->wfuncstate->wfuncno])); } /* @@ -1040,9 +1040,9 @@ restart: tuplestore_trim(winstate->buffer); /* - * Form and return a projection tuple using the windowfunc results - * and the current row. Setting ecxt_outertuple arranges that any - * Vars will be evaluated with respect to that row. + * Form and return a projection tuple using the windowfunc results and the + * current row. Setting ecxt_outertuple arranges that any Vars will be + * evaluated with respect to that row. */ econtext->ecxt_outertuple = winstate->ss.ss_ScanTupleSlot; result = ExecProject(winstate->ss.ps.ps_ProjInfo, &isDone); @@ -1072,8 +1072,8 @@ ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags) Plan *outerPlan; ExprContext *econtext; ExprContext *tmpcontext; - WindowStatePerFunc perfunc; - WindowStatePerAgg peragg; + WindowStatePerFunc perfunc; + WindowStatePerAgg peragg; int numfuncs, wfuncno, numaggs, @@ -1163,7 +1163,7 @@ ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags) /* Set up data for comparing tuples */ if (node->partNumCols > 0) winstate->partEqfunctions = execTuplesMatchPrepare(node->partNumCols, - node->partOperators); + node->partOperators); if (node->ordNumCols > 0) winstate->ordEqfunctions = execTuplesMatchPrepare(node->ordNumCols, node->ordOperators); @@ -1189,13 +1189,13 @@ ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags) aggno = -1; foreach(l, winstate->funcs) { - WindowFuncExprState *wfuncstate = (WindowFuncExprState *) lfirst(l); - WindowFunc *wfunc = (WindowFunc *) wfuncstate->xprstate.expr; + WindowFuncExprState *wfuncstate = (WindowFuncExprState *) lfirst(l); + WindowFunc *wfunc = (WindowFunc *) wfuncstate->xprstate.expr; WindowStatePerFunc perfuncstate; AclResult aclresult; int i; - if (wfunc->winref != node->winref) /* planner screwed up? */ + if (wfunc->winref != node->winref) /* planner screwed up? */ elog(ERROR, "WindowFunc with winref %u assigned to WindowAgg with winref %u", wfunc->winref, node->winref); @@ -1239,13 +1239,13 @@ ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags) &perfuncstate->resulttypeByVal); /* - * If it's really just a plain aggregate function, - * we'll emulate the Agg environment for it. + * If it's really just a plain aggregate function, we'll emulate the + * Agg environment for it. */ perfuncstate->plain_agg = wfunc->winagg; if (wfunc->winagg) { - WindowStatePerAgg peraggstate; + WindowStatePerAgg peraggstate; perfuncstate->aggno = ++aggno; peraggstate = &winstate->peragg[aggno]; @@ -1325,7 +1325,7 @@ ExecEndWindowAgg(WindowAggState *node) void ExecReScanWindowAgg(WindowAggState *node, ExprContext *exprCtxt) { - ExprContext *econtext = node->ss.ps.ps_ExprContext; + ExprContext *econtext = node->ss.ps.ps_ExprContext; node->all_done = false; @@ -1489,11 +1489,10 @@ initialize_peragg(WindowAggState *winstate, WindowFunc *wfunc, aggtranstype); /* - * If the transfn is strict and the initval is NULL, make sure input - * type and transtype are the same (or at least binary-compatible), so - * that it's OK to use the first input value as the initial - * transValue. This should have been checked at agg definition time, - * but just in case... + * If the transfn is strict and the initval is NULL, make sure input type + * and transtype are the same (or at least binary-compatible), so that + * it's OK to use the first input value as the initial transValue. This + * should have been checked at agg definition time, but just in case... */ if (peraggstate->transfn.fn_strict && peraggstate->initValueIsNull) { @@ -1579,10 +1578,10 @@ window_gettupleslot(WindowObject winobj, int64 pos, TupleTableSlot *slot) tuplestore_select_read_pointer(winstate->buffer, winobj->readptr); /* - * There's no API to refetch the tuple at the current position. We - * have to move one tuple forward, and then one backward. (We don't - * do it the other way because we might try to fetch the row before - * our mark, which isn't allowed.) + * There's no API to refetch the tuple at the current position. We have to + * move one tuple forward, and then one backward. (We don't do it the + * other way because we might try to fetch the row before our mark, which + * isn't allowed.) */ if (winobj->seekpos == pos) { @@ -1623,7 +1622,7 @@ window_gettupleslot(WindowObject winobj, int64 pos, TupleTableSlot *slot) * requested amount of space. Subsequent calls just return the same chunk. * * Memory obtained this way is normally used to hold state that should be - * automatically reset for each new partition. If a window function wants + * automatically reset for each new partition. If a window function wants * to hold state across the whole query, fcinfo->fn_extra can be used in the * usual way for that. */ @@ -1710,10 +1709,10 @@ bool WinRowsArePeers(WindowObject winobj, int64 pos1, int64 pos2) { WindowAggState *winstate; - WindowAgg *node; + WindowAgg *node; TupleTableSlot *slot1; TupleTableSlot *slot2; - bool res; + bool res; Assert(WindowObjectIsValid(winobj)); winstate = winobj->winstate; @@ -1789,7 +1788,7 @@ WinGetFuncArgInPartition(WindowObject winobj, int argno, break; default: elog(ERROR, "unrecognized window seek type: %d", seektype); - abs_pos = 0; /* keep compiler quiet */ + abs_pos = 0; /* keep compiler quiet */ break; } @@ -1862,7 +1861,7 @@ WinGetFuncArgInFrame(WindowObject winobj, int argno, break; default: elog(ERROR, "unrecognized window seek type: %d", seektype); - abs_pos = 0; /* keep compiler quiet */ + abs_pos = 0; /* keep compiler quiet */ break; } diff --git a/src/backend/executor/nodeWorktablescan.c b/src/backend/executor/nodeWorktablescan.c index 24fd2c5f73..87a0204525 100644 --- a/src/backend/executor/nodeWorktablescan.c +++ b/src/backend/executor/nodeWorktablescan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeWorktablescan.c,v 1.6 2009/03/27 18:30:21 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeWorktablescan.c,v 1.7 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -73,10 +73,10 @@ TupleTableSlot * ExecWorkTableScan(WorkTableScanState *node) { /* - * On the first call, find the ancestor RecursiveUnion's state - * via the Param slot reserved for it. (We can't do this during node - * init because there are corner cases where we'll get the init call - * before the RecursiveUnion does.) + * On the first call, find the ancestor RecursiveUnion's state via the + * Param slot reserved for it. (We can't do this during node init because + * there are corner cases where we'll get the init call before the + * RecursiveUnion does.) */ if (node->rustate == NULL) { @@ -100,8 +100,8 @@ ExecWorkTableScan(WorkTableScanState *node) ExecGetResultType(&node->rustate->ps)); /* - * Now we can initialize the projection info. This must be - * completed before we can call ExecScan(). + * Now we can initialize the projection info. This must be completed + * before we can call ExecScan(). */ ExecAssignScanProjectionInfo(&node->ss); } diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c index f750560c6f..40f43ee011 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.207 2009/01/21 11:02:40 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.208 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -45,11 +45,11 @@ static int _SPI_connected = -1; static int _SPI_curid = -1; static Portal SPI_cursor_open_internal(const char *name, SPIPlanPtr plan, - Datum *Values, const char *Nulls, - bool read_only, int pflags); + Datum *Values, const char *Nulls, + bool read_only, int pflags); static void _SPI_prepare_plan(const char *src, SPIPlanPtr plan, - ParamListInfo boundParams); + ParamListInfo boundParams); static int _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI, Snapshot snapshot, Snapshot crosscheck_snapshot, @@ -308,7 +308,7 @@ SPI_pop(void) bool SPI_push_conditional(void) { - bool pushed = (_SPI_curid != _SPI_connected); + bool pushed = (_SPI_curid != _SPI_connected); if (pushed) { @@ -962,7 +962,7 @@ SPI_cursor_open(const char *name, SPIPlanPtr plan, /* * SPI_cursor_open_with_args() * - * Parse and plan a query and open it as a portal. Like SPI_execute_with_args, + * Parse and plan a query and open it as a portal. Like SPI_execute_with_args, * we can tell the planner to rely on the parameter values as constants, * because the plan will only be used once. */ @@ -1212,8 +1212,8 @@ SPI_cursor_open_internal(const char *name, SPIPlanPtr plan, } /* - * Set up the snapshot to use. (PortalStart will do PushActiveSnapshot, so - * we skip that here.) + * Set up the snapshot to use. (PortalStart will do PushActiveSnapshot, + * so we skip that here.) */ if (read_only) snapshot = GetActiveSnapshot(); @@ -1767,13 +1767,13 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI, if (read_only && !CommandIsReadOnly(stmt)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - /* translator: %s is a SQL statement name */ - errmsg("%s is not allowed in a non-volatile function", - CreateCommandTag(stmt)))); + /* translator: %s is a SQL statement name */ + errmsg("%s is not allowed in a non-volatile function", + CreateCommandTag(stmt)))); /* - * If not read-only mode, advance the command counter before - * each command. + * If not read-only mode, advance the command counter before each + * command. */ if (!read_only) CommandCounterIncrement(); @@ -1784,7 +1784,8 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI, { /* * Default read_only behavior is to use the entry-time - * ActiveSnapshot, if any; if read-write, grab a full new snap. + * ActiveSnapshot, if any; if read-write, grab a full new + * snap. */ if (read_only) { @@ -1804,8 +1805,8 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI, { /* * We interpret read_only with a specified snapshot to be - * exactly that snapshot, but read-write means use the - * snap with advancing of command ID. + * exactly that snapshot, but read-write means use the snap + * with advancing of command ID. */ if (read_only) PushActiveSnapshot(snapshot); @@ -1839,7 +1840,7 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI, ProcessUtility(stmt, plansource->query_string, paramLI, - false, /* not top level */ + false, /* not top level */ dest, NULL); /* Update "processed" if stmt returned tuples */ @@ -1853,9 +1854,9 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI, PopActiveSnapshot(); /* - * The last canSetTag query sets the status values returned to - * the caller. Be careful to free any tuptables not returned, - * to avoid intratransaction memory leak. + * The last canSetTag query sets the status values returned to the + * caller. Be careful to free any tuptables not returned, to + * avoid intratransaction memory leak. */ if (canSetTag) { @@ -1884,9 +1885,9 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI, cplan = NULL; /* - * If not read-only mode, advance the command counter after the - * last command. This ensures that its effects are visible, in - * case it was DDL that would affect the next CachedPlanSource. + * If not read-only mode, advance the command counter after the last + * command. This ensures that its effects are visible, in case it was + * DDL that would affect the next CachedPlanSource. */ if (!read_only) CommandCounterIncrement(); @@ -1912,9 +1913,9 @@ fail: _SPI_current->tuptable = NULL; /* - * If none of the queries had canSetTag, return SPI_OK_REWRITTEN. Prior - * to 8.4, we used return the last query's result code, but not its - * auxiliary results, but that's confusing. + * If none of the queries had canSetTag, return SPI_OK_REWRITTEN. Prior to + * 8.4, we used return the last query's result code, but not its auxiliary + * results, but that's confusing. */ if (my_res == 0) my_res = SPI_OK_REWRITTEN; @@ -1938,7 +1939,7 @@ _SPI_convert_params(int nargs, Oid *argtypes, /* sizeof(ParamListInfoData) includes the first array element */ paramLI = (ParamListInfo) palloc(sizeof(ParamListInfoData) + - (nargs - 1) *sizeof(ParamExternData)); + (nargs - 1) *sizeof(ParamExternData)); paramLI->numParams = nargs; for (i = 0; i < nargs; i++) diff --git a/src/backend/executor/tstoreReceiver.c b/src/backend/executor/tstoreReceiver.c index a8ad1dc3ff..19f348f13f 100644 --- a/src/backend/executor/tstoreReceiver.c +++ b/src/backend/executor/tstoreReceiver.c @@ -5,7 +5,7 @@ * a Tuplestore. * * Optionally, we can force detoasting (but not decompression) of out-of-line - * toasted values. This is to support cursors WITH HOLD, which must retain + * toasted values. This is to support cursors WITH HOLD, which must retain * data even if the underlying table is dropped. * * @@ -13,7 +13,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/tstoreReceiver.c,v 1.22 2009/01/01 17:23:42 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/tstoreReceiver.c,v 1.23 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -121,8 +121,8 @@ tstoreReceiveSlot_detoast(TupleTableSlot *slot, DestReceiver *self) /* * Fetch back any out-of-line datums. We build the new datums array in - * myState->outvalues[] (but we can re-use the slot's isnull array). - * Also, remember the fetched values to free afterwards. + * myState->outvalues[] (but we can re-use the slot's isnull array). Also, + * remember the fetched values to free afterwards. */ nfree = 0; for (i = 0; i < natts; i++) @@ -136,7 +136,7 @@ tstoreReceiveSlot_detoast(TupleTableSlot *slot, DestReceiver *self) if (VARATT_IS_EXTERNAL(DatumGetPointer(val))) { val = PointerGetDatum(heap_tuple_fetch_attr((struct varlena *) - DatumGetPointer(val))); + DatumGetPointer(val))); myState->tofree[nfree++] = val; } } diff --git a/src/backend/foreign/foreign.c b/src/backend/foreign/foreign.c index 3ec4250677..4fb00328ca 100644 --- a/src/backend/foreign/foreign.c +++ b/src/backend/foreign/foreign.c @@ -1,12 +1,12 @@ /*------------------------------------------------------------------------- * * foreign.c - * support for foreign-data wrappers, servers and user mappings. + * support for foreign-data wrappers, servers and user mappings. * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/foreign/foreign.c,v 1.3 2009/02/24 10:06:32 petere Exp $ + * $PostgreSQL: pgsql/src/backend/foreign/foreign.c,v 1.4 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -36,16 +36,16 @@ extern Datum postgresql_fdw_validator(PG_FUNCTION_ARGS); /* - * GetForeignDataWrapper - look up the foreign-data wrapper by OID. + * GetForeignDataWrapper - look up the foreign-data wrapper by OID. */ ForeignDataWrapper * GetForeignDataWrapper(Oid fdwid) { - Form_pg_foreign_data_wrapper fdwform; - ForeignDataWrapper *fdw; - Datum datum; - HeapTuple tp; - bool isnull; + Form_pg_foreign_data_wrapper fdwform; + ForeignDataWrapper *fdw; + Datum datum; + HeapTuple tp; + bool isnull; tp = SearchSysCache(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdwid), @@ -82,7 +82,7 @@ GetForeignDataWrapper(Oid fdwid) Oid GetForeignDataWrapperOidByName(const char *fdwname, bool missing_ok) { - Oid fdwId; + Oid fdwId; fdwId = GetSysCacheOid(FOREIGNDATAWRAPPERNAME, CStringGetDatum(fdwname), @@ -91,7 +91,7 @@ GetForeignDataWrapperOidByName(const char *fdwname, bool missing_ok) if (!OidIsValid(fdwId) && !missing_ok) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("foreign-data wrapper \"%s\" does not exist", fdwname))); + errmsg("foreign-data wrapper \"%s\" does not exist", fdwname))); return fdwId; } @@ -104,7 +104,7 @@ GetForeignDataWrapperOidByName(const char *fdwname, bool missing_ok) ForeignDataWrapper * GetForeignDataWrapperByName(const char *fdwname, bool missing_ok) { - Oid fdwId = GetForeignDataWrapperOidByName(fdwname, missing_ok); + Oid fdwId = GetForeignDataWrapperOidByName(fdwname, missing_ok); if (!OidIsValid(fdwId) && missing_ok) return NULL; @@ -119,11 +119,11 @@ GetForeignDataWrapperByName(const char *fdwname, bool missing_ok) ForeignServer * GetForeignServer(Oid serverid) { - Form_pg_foreign_server serverform; - ForeignServer *server; - HeapTuple tp; - Datum datum; - bool isnull; + Form_pg_foreign_server serverform; + ForeignServer *server; + HeapTuple tp; + Datum datum; + bool isnull; tp = SearchSysCache(FOREIGNSERVEROID, ObjectIdGetDatum(serverid), @@ -175,7 +175,7 @@ GetForeignServer(Oid serverid) Oid GetForeignServerOidByName(const char *srvname, bool missing_ok) { - Oid serverid; + Oid serverid; serverid = GetSysCacheOid(FOREIGNSERVERNAME, CStringGetDatum(srvname), @@ -184,7 +184,7 @@ GetForeignServerOidByName(const char *srvname, bool missing_ok) if (!OidIsValid(serverid) && !missing_ok) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("server \"%s\" does not exist", srvname))); + errmsg("server \"%s\" does not exist", srvname))); return serverid; } @@ -196,7 +196,7 @@ GetForeignServerOidByName(const char *srvname, bool missing_ok) ForeignServer * GetForeignServerByName(const char *srvname, bool missing_ok) { - Oid serverid = GetForeignServerOidByName(srvname, missing_ok); + Oid serverid = GetForeignServerOidByName(srvname, missing_ok); if (!OidIsValid(serverid) && missing_ok) return NULL; @@ -214,11 +214,11 @@ GetForeignServerByName(const char *srvname, bool missing_ok) UserMapping * GetUserMapping(Oid userid, Oid serverid) { - Form_pg_user_mapping umform; + Form_pg_user_mapping umform; Datum datum; - HeapTuple tp; + HeapTuple tp; bool isnull; - UserMapping *um; + UserMapping *um; tp = SearchSysCache(USERMAPPINGUSERSERVER, ObjectIdGetDatum(userid), @@ -237,8 +237,8 @@ GetUserMapping(Oid userid, Oid serverid) if (!HeapTupleIsValid(tp)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("user mapping not found for \"%s\"", - MappingUserName(userid)))); + errmsg("user mapping not found for \"%s\"", + MappingUserName(userid)))); umform = (Form_pg_user_mapping) GETSTRUCT(tp); @@ -270,7 +270,7 @@ deflist_to_tuplestore(ReturnSetInfo *rsinfo, List *options) TupleDesc tupdesc; Tuplestorestate *tupstore; Datum values[2]; - bool nulls[2] = { 0 }; + bool nulls[2] = {0}; MemoryContext per_query_ctx; MemoryContext oldcontext; @@ -296,12 +296,12 @@ deflist_to_tuplestore(ReturnSetInfo *rsinfo, List *options) rsinfo->setResult = tupstore; rsinfo->setDesc = tupdesc; - foreach (cell, options) + foreach(cell, options) { - DefElem *def = lfirst(cell); + DefElem *def = lfirst(cell); values[0] = CStringGetTextDatum(def->defname); - values[1] = CStringGetTextDatum(((Value *)def->arg)->val.str); + values[1] = CStringGetTextDatum(((Value *) def->arg)->val.str); tuplestore_putvalues(tupstore, tupdesc, values, nulls); } @@ -319,7 +319,7 @@ deflist_to_tuplestore(ReturnSetInfo *rsinfo, List *options) Datum pg_options_to_table(PG_FUNCTION_ARGS) { - Datum array = PG_GETARG_DATUM(0); + Datum array = PG_GETARG_DATUM(0); deflist_to_tuplestore((ReturnSetInfo *) fcinfo->resultinfo, untransformRelOptions(array)); @@ -330,9 +330,10 @@ pg_options_to_table(PG_FUNCTION_ARGS) /* * Describes the valid options for postgresql FDW, server, and user mapping. */ -struct ConnectionOption { - const char *optname; - Oid optcontext; /* Oid of catalog in which option may appear */ +struct ConnectionOption +{ + const char *optname; + Oid optcontext; /* Oid of catalog in which option may appear */ }; /* @@ -341,21 +342,21 @@ struct ConnectionOption { * The list is small - don't bother with bsearch if it stays so. */ static struct ConnectionOption libpq_conninfo_options[] = { - { "authtype", ForeignServerRelationId }, - { "service", ForeignServerRelationId }, - { "user", UserMappingRelationId }, - { "password", UserMappingRelationId }, - { "connect_timeout", ForeignServerRelationId }, - { "dbname", ForeignServerRelationId }, - { "host", ForeignServerRelationId }, - { "hostaddr", ForeignServerRelationId }, - { "port", ForeignServerRelationId }, - { "tty", ForeignServerRelationId }, - { "options", ForeignServerRelationId }, - { "requiressl", ForeignServerRelationId }, - { "sslmode", ForeignServerRelationId }, - { "gsslib", ForeignServerRelationId }, - { NULL, InvalidOid } + {"authtype", ForeignServerRelationId}, + {"service", ForeignServerRelationId}, + {"user", UserMappingRelationId}, + {"password", UserMappingRelationId}, + {"connect_timeout", ForeignServerRelationId}, + {"dbname", ForeignServerRelationId}, + {"host", ForeignServerRelationId}, + {"hostaddr", ForeignServerRelationId}, + {"port", ForeignServerRelationId}, + {"tty", ForeignServerRelationId}, + {"options", ForeignServerRelationId}, + {"requiressl", ForeignServerRelationId}, + {"sslmode", ForeignServerRelationId}, + {"gsslib", ForeignServerRelationId}, + {NULL, InvalidOid} }; @@ -387,19 +388,19 @@ is_conninfo_option(const char *option, Oid context) Datum postgresql_fdw_validator(PG_FUNCTION_ARGS) { - List* options_list = untransformRelOptions(PG_GETARG_DATUM(0)); - Oid catalog = PG_GETARG_OID(1); + List *options_list = untransformRelOptions(PG_GETARG_DATUM(0)); + Oid catalog = PG_GETARG_OID(1); - ListCell *cell; + ListCell *cell; - foreach (cell, options_list) + foreach(cell, options_list) { DefElem *def = lfirst(cell); if (!is_conninfo_option(def->defname, catalog)) { - struct ConnectionOption *opt; - StringInfoData buf; + struct ConnectionOption *opt; + StringInfoData buf; /* * Unknown option specified, complain about it. Provide a hint @@ -414,7 +415,7 @@ postgresql_fdw_validator(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("invalid option \"%s\"", def->defname), - errhint("Valid options in this context are: %s", buf.data))); + errhint("Valid options in this context are: %s", buf.data))); PG_RETURN_BOOL(false); } diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c index fb51d8df04..84d72cb241 100644 --- a/src/backend/libpq/auth.c +++ b/src/backend/libpq/auth.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.181 2009/05/27 21:08:22 mha Exp $ + * $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.182 2009/06/11 14:48:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -22,7 +22,7 @@ #include <sys/ucred.h> #endif #ifdef HAVE_UCRED_H -# include <ucred.h> +#include <ucred.h> #endif #include <netinet/in.h> #include <arpa/inet.h> @@ -36,7 +36,7 @@ #include "storage/ipc.h" /*---------------------------------------------------------------- - * Global authentication functions + * Global authentication functions *---------------------------------------------------------------- */ static void sendAuthRequest(Port *port, AuthRequest areq); @@ -55,7 +55,7 @@ static int recv_and_check_password_packet(Port *port); /* Standard TCP port number for Ident service. Assigned by IANA */ #define IDENT_PORT 113 -static int authident(hbaPort *port); +static int authident(hbaPort *port); /*---------------------------------------------------------------- @@ -101,17 +101,17 @@ static Port *pam_port_cludge; /* Workaround for passing "Port *port" into /* Correct header from the Platform SDK */ typedef -ULONG(*__ldap_start_tls_sA) ( - IN PLDAP ExternalHandle, - OUT PULONG ServerReturnValue, - OUT LDAPMessage ** result, - IN PLDAPControlA * ServerControls, - IN PLDAPControlA * ClientControls +ULONG (*__ldap_start_tls_sA) ( + IN PLDAP ExternalHandle, + OUT PULONG ServerReturnValue, + OUT LDAPMessage **result, + IN PLDAPControlA * ServerControls, + IN PLDAPControlA * ClientControls ); #endif static int CheckLDAPAuth(Port *port); -#endif /* USE_LDAP */ +#endif /* USE_LDAP */ /*---------------------------------------------------------------- * Cert authentication @@ -136,7 +136,7 @@ bool pg_krb_caseins_users; *---------------------------------------------------------------- */ #ifdef KRB5 -static int pg_krb5_recvauth(Port *port); +static int pg_krb5_recvauth(Port *port); #include <krb5.h> /* Some old versions of Kerberos do not include <com_err.h> in <krb5.h> */ @@ -151,7 +151,7 @@ static int pg_krb5_initialised; static krb5_context pg_krb5_context; static krb5_keytab pg_krb5_keytab; static krb5_principal pg_krb5_server; -#endif /* KRB5 */ +#endif /* KRB5 */ /*---------------------------------------------------------------- @@ -165,8 +165,8 @@ static krb5_principal pg_krb5_server; #include <gssapi/gssapi.h> #endif -static int pg_GSS_recvauth(Port *port); -#endif /* ENABLE_GSS */ +static int pg_GSS_recvauth(Port *port); +#endif /* ENABLE_GSS */ /*---------------------------------------------------------------- @@ -174,10 +174,10 @@ static int pg_GSS_recvauth(Port *port); *---------------------------------------------------------------- */ #ifdef ENABLE_SSPI -typedef SECURITY_STATUS +typedef SECURITY_STATUS (WINAPI * QUERY_SECURITY_CONTEXT_TOKEN_FN) ( PCtxtHandle, void **); -static int pg_SSPI_recvauth(Port *port); +static int pg_SSPI_recvauth(Port *port); #endif @@ -282,10 +282,9 @@ ClientAuthentication(Port *port) errhint("See server log for details."))); /* - * This is the first point where we have access to the hba record for - * the current connection, so perform any verifications based on the - * hba options field that should be done *before* the authentication - * here. + * This is the first point where we have access to the hba record for the + * current connection, so perform any verifications based on the hba + * options field that should be done *before* the authentication here. */ if (port->hba->clientcert) { @@ -301,12 +300,13 @@ ClientAuthentication(Port *port) { ereport(FATAL, (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), - errmsg("connection requires a valid client certificate"))); + errmsg("connection requires a valid client certificate"))); } #else + /* - * hba.c makes sure hba->clientcert can't be set unless OpenSSL - * is present. + * hba.c makes sure hba->clientcert can't be set unless OpenSSL is + * present. */ Assert(false); #endif @@ -738,9 +738,9 @@ pg_krb5_recvauth(Port *port) if (cp) { /* - * If we are not going to include the realm in the username that is passed - * to the ident map, destructively modify it here to remove the realm. Then - * advance past the separator to check the realm. + * If we are not going to include the realm in the username that is + * passed to the ident map, destructively modify it here to remove the + * realm. Then advance past the separator to check the realm. */ if (!port->hba->include_realm) *cp = '\0'; @@ -766,7 +766,7 @@ pg_krb5_recvauth(Port *port) } } } - else if (port->hba->krb_realm&& strlen(port->hba->krb_realm)) + else if (port->hba->krb_realm && strlen(port->hba->krb_realm)) { elog(DEBUG2, "krb5 did not return realm but realm matching was requested"); @@ -867,8 +867,8 @@ pg_GSS_recvauth(Port *port) /* * GSS auth is not supported for protocol versions before 3, because it * relies on the overall message length word to determine the GSS payload - * size in AuthenticationGSSContinue and PasswordMessage messages. - * (This is, in fact, a design error in our GSS support, because protocol + * size in AuthenticationGSSContinue and PasswordMessage messages. (This + * is, in fact, a design error in our GSS support, because protocol * messages are supposed to be parsable without relying on the length * word; but it's not worth changing it now.) */ @@ -887,8 +887,8 @@ pg_GSS_recvauth(Port *port) */ if (getenv("KRB5_KTNAME") == NULL) { - size_t kt_len = strlen(pg_krb_server_keyfile) + 14; - char *kt_path = malloc(kt_len); + size_t kt_len = strlen(pg_krb_server_keyfile) + 14; + char *kt_path = malloc(kt_len); if (!kt_path) { @@ -1030,9 +1030,9 @@ pg_GSS_recvauth(Port *port) char *cp = strchr(gbuf.value, '@'); /* - * If we are not going to include the realm in the username that is passed - * to the ident map, destructively modify it here to remove the realm. Then - * advance past the separator to check the realm. + * If we are not going to include the realm in the username that is + * passed to the ident map, destructively modify it here to remove the + * realm. Then advance past the separator to check the realm. */ if (!port->hba->include_realm) *cp = '\0'; @@ -1128,8 +1128,8 @@ pg_SSPI_recvauth(Port *port) /* * SSPI auth is not supported for protocol versions before 3, because it * relies on the overall message length word to determine the SSPI payload - * size in AuthenticationGSSContinue and PasswordMessage messages. - * (This is, in fact, a design error in our SSPI support, because protocol + * size in AuthenticationGSSContinue and PasswordMessage messages. (This + * is, in fact, a design error in our SSPI support, because protocol * messages are supposed to be parsable without relying on the length * word; but it's not worth changing it now.) */ @@ -1355,8 +1355,8 @@ pg_SSPI_recvauth(Port *port) */ if (port->hba->include_realm) { - char *namebuf; - int retval; + char *namebuf; + int retval; namebuf = palloc(strlen(accountname) + strlen(domainname) + 2); sprintf(namebuf, "%s@%s", accountname, domainname); @@ -1697,9 +1697,9 @@ ident_unix(int sock, char *ident_user) /* Solaris > 10 */ uid_t uid; struct passwd *pass; - ucred_t *ucred; + ucred_t *ucred; - ucred = NULL; /* must be initialized to NULL */ + ucred = NULL; /* must be initialized to NULL */ if (getpeerucred(sock, &ucred) == -1) { ereport(LOG, @@ -1712,7 +1712,7 @@ ident_unix(int sock, char *ident_user) { ereport(LOG, (errcode_for_socket_access(), - errmsg("could not get effective UID from peer credentials: %m"))); + errmsg("could not get effective UID from peer credentials: %m"))); return false; } @@ -1722,8 +1722,8 @@ ident_unix(int sock, char *ident_user) if (pass == NULL) { ereport(LOG, - (errmsg("local user with ID %d does not exist", - (int) uid))); + (errmsg("local user with ID %d does not exist", + (int) uid))); return false; } @@ -2050,7 +2050,7 @@ CheckLDAPAuth(Port *port) int ldapversion = LDAP_VERSION3; char fulluser[NAMEDATALEN + 256 + 1]; - if (!port->hba->ldapserver|| port->hba->ldapserver[0] == '\0') + if (!port->hba->ldapserver || port->hba->ldapserver[0] == '\0') { ereport(LOG, (errmsg("LDAP server not specified"))); @@ -2188,4 +2188,5 @@ CheckCertAuth(Port *port) /* Just pass the certificate CN to the usermap check */ return check_usermap(port->hba->usermap, port->user_name, port->peer_cn, false); } + #endif diff --git a/src/backend/libpq/be-fsstubs.c b/src/backend/libpq/be-fsstubs.c index ead962d692..24605b5490 100644 --- a/src/backend/libpq/be-fsstubs.c +++ b/src/backend/libpq/be-fsstubs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/libpq/be-fsstubs.c,v 1.90 2009/01/01 17:23:42 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/libpq/be-fsstubs.c,v 1.91 2009/06/11 14:48:58 momjian Exp $ * * NOTES * This should be moved to a more appropriate place. It is here @@ -80,7 +80,7 @@ static MemoryContext fscxt = NULL; static int newLOfd(LargeObjectDesc *lobjCookie); static void deleteLOfd(int fd); -static Oid lo_import_internal(text *filename, Oid lobjOid); +static Oid lo_import_internal(text *filename, Oid lobjOid); /***************************************************************************** @@ -334,7 +334,7 @@ Datum lo_import_with_oid(PG_FUNCTION_ARGS) { text *filename = PG_GETARG_TEXT_PP(0); - Oid oid = PG_GETARG_OID(1); + Oid oid = PG_GETARG_OID(1); PG_RETURN_OID(lo_import_internal(filename, oid)); } @@ -348,8 +348,8 @@ lo_import_internal(text *filename, Oid lobjOid) char buf[BUFSIZE]; char fnamebuf[MAXPGPATH]; LargeObjectDesc *lobj; - Oid oid; - + Oid oid; + #ifndef ALLOW_DANGEROUS_LO_FUNCTIONS if (!superuser()) ereport(ERROR, diff --git a/src/backend/libpq/be-secure.c b/src/backend/libpq/be-secure.c index a6478b5523..ef2db7f174 100644 --- a/src/backend/libpq/be-secure.c +++ b/src/backend/libpq/be-secure.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.91 2009/05/11 08:06:21 mha Exp $ + * $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.92 2009/06/11 14:48:58 momjian Exp $ * * Since the server static private key ($DataDir/server.key) * will normally be stored unencrypted so that the database @@ -730,7 +730,7 @@ initialize_SSL(void) * Load and verify certificate and private key */ if (SSL_CTX_use_certificate_chain_file(SSL_context, - SERVER_CERT_FILE) != 1) + SERVER_CERT_FILE) != 1) ereport(FATAL, (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("could not load server certificate file \"%s\": %s", @@ -754,14 +754,14 @@ initialize_SSL(void) if (!S_ISREG(buf.st_mode) || buf.st_mode & (S_IRWXG | S_IRWXO)) ereport(FATAL, (errcode(ERRCODE_CONFIG_FILE_ERROR), - errmsg("private key file \"%s\" has group or world access", - SERVER_PRIVATE_KEY_FILE), - errdetail("Permissions should be u=rw (0600) or less."))); + errmsg("private key file \"%s\" has group or world access", + SERVER_PRIVATE_KEY_FILE), + errdetail("Permissions should be u=rw (0600) or less."))); #endif if (SSL_CTX_use_PrivateKey_file(SSL_context, - SERVER_PRIVATE_KEY_FILE, - SSL_FILETYPE_PEM) != 1) + SERVER_PRIVATE_KEY_FILE, + SSL_FILETYPE_PEM) != 1) ereport(FATAL, (errmsg("could not load private key file \"%s\": %s", SERVER_PRIVATE_KEY_FILE, SSLerrmessage()))); @@ -781,29 +781,32 @@ initialize_SSL(void) elog(FATAL, "could not set the cipher list (no valid ciphers available)"); /* - * Attempt to load CA store, so we can verify client certificates if needed. + * Attempt to load CA store, so we can verify client certificates if + * needed. */ if (access(ROOT_CERT_FILE, R_OK)) { ssl_loaded_verify_locations = false; /* - * If root certificate file simply not found. Don't log an error here, because - * it's quite likely the user isn't planning on using client certificates. - * If we can't access it for other reasons, it is an error. + * If root certificate file simply not found. Don't log an error here, + * because it's quite likely the user isn't planning on using client + * certificates. If we can't access it for other reasons, it is an + * error. */ if (errno != ENOENT) { ereport(FATAL, - (errmsg("could not access root certificate file \"%s\": %m", - ROOT_CERT_FILE))); + (errmsg("could not access root certificate file \"%s\": %m", + ROOT_CERT_FILE))); } } else if (SSL_CTX_load_verify_locations(SSL_context, ROOT_CERT_FILE, NULL) != 1) { /* - * File was there, but we could not load it. This means the file is somehow - * broken, and we cannot do verification at all - so abort here. + * File was there, but we could not load it. This means the file is + * somehow broken, and we cannot do verification at all - so abort + * here. */ ssl_loaded_verify_locations = false; ereport(FATAL, @@ -843,8 +846,9 @@ initialize_SSL(void) } /* - * Always ask for SSL client cert, but don't fail if it's not presented. We'll fail later in this case, - * based on what we find in pg_hba.conf. + * Always ask for SSL client cert, but don't fail if it's not + * presented. We'll fail later in this case, based on what we find + * in pg_hba.conf. */ SSL_CTX_set_verify(SSL_context, (SSL_VERIFY_PEER | diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c index 63cb204a8d..0b9e0378a3 100644 --- a/src/backend/libpq/hba.c +++ b/src/backend/libpq/hba.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.185 2009/04/15 21:42:50 alvherre Exp $ + * $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.186 2009/06/11 14:48:58 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -568,12 +568,12 @@ check_db(const char *dbname, const char *role, char *param_str) /* * Macros used to check and report on invalid configuration options. * INVALID_AUTH_OPTION = reports when an option is specified for a method where it's - * not supported. + * not supported. * REQUIRE_AUTH_OPTION = same as INVALID_AUTH_OPTION, except it also checks if the - * method is actually the one specified. Used as a shortcut when - * the option is only valid for one authentication method. + * method is actually the one specified. Used as a shortcut when + * the option is only valid for one authentication method. * MANDATORY_AUTH_ARG = check if a required option is set for an authentication method, - * reporting error if it's not. + * reporting error if it's not. */ #define INVALID_AUTH_OPTION(optname, validmethods) do {\ ereport(LOG, \ @@ -642,9 +642,9 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) ereport(LOG, (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("hostssl not supported on this platform"), - errhint("compile with --enable-ssl to use SSL connections"), + errhint("compile with --enable-ssl to use SSL connections"), errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + line_num, HbaFileName))); return false; #endif } @@ -654,12 +654,12 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) parsedline->conntype = ctHostNoSSL; } #endif - else + else { /* "host", or "hostnossl" and SSL support not built in */ parsedline->conntype = ctHost; } - } /* record type */ + } /* record type */ else { ereport(LOG, @@ -667,7 +667,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) errmsg("invalid connection type \"%s\"", token), errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + line_num, HbaFileName))); return false; } @@ -679,7 +679,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("end-of-line before database specification"), errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + line_num, HbaFileName))); return false; } parsedline->database = pstrdup(lfirst(line_item)); @@ -692,7 +692,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("end-of-line before role specification"), errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + line_num, HbaFileName))); return false; } parsedline->role = pstrdup(lfirst(line_item)); @@ -707,7 +707,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("end-of-line before ip address specification"), errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + line_num, HbaFileName))); return false; } token = pstrdup(lfirst(line_item)); @@ -735,7 +735,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) errmsg("invalid IP address \"%s\": %s", token, gai_strerror(ret)), errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + line_num, HbaFileName))); if (cidr_slash) *cidr_slash = '/'; if (gai_result) @@ -760,7 +760,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) errmsg("invalid CIDR mask in address \"%s\"", token), errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + line_num, HbaFileName))); return false; } } @@ -774,7 +774,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("end-of-line before netmask specification"), errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + line_num, HbaFileName))); return false; } token = lfirst(line_item); @@ -787,7 +787,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) errmsg("invalid IP mask \"%s\": %s", token, gai_strerror(ret)), errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + line_num, HbaFileName))); if (gai_result) pg_freeaddrinfo_all(hints.ai_family, gai_result); return false; @@ -805,7 +805,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) return false; } } - } /* != ctLocal */ + } /* != ctLocal */ /* Get the authentication method */ line_item = lnext(line_item); @@ -815,7 +815,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("end-of-line before authentication method"), errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + line_num, HbaFileName))); return false; } token = lfirst(line_item); @@ -883,7 +883,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) errmsg("invalid authentication method \"%s\"", token), errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + line_num, HbaFileName))); return false; } @@ -894,7 +894,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) errmsg("invalid authentication method \"%s\": not supported on this platform", token), errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + line_num, HbaFileName))); return false; } @@ -904,9 +904,9 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) { ereport(LOG, (errcode(ERRCODE_CONFIG_FILE_ERROR), - errmsg("krb5 authentication is not supported on local sockets"), + errmsg("krb5 authentication is not supported on local sockets"), errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + line_num, HbaFileName))); return false; } @@ -924,7 +924,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) /* Parse remaining arguments */ while ((line_item = lnext(line_item)) != NULL) { - char *c; + char *c; token = lfirst(line_item); @@ -945,7 +945,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) } else { - *c++ = '\0'; /* token now holds "name", c holds "value" */ + *c++ = '\0'; /* token now holds "name", c holds "value" */ if (strcmp(token, "map") == 0) { if (parsedline->auth_method != uaIdent && @@ -959,16 +959,17 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) else if (strcmp(token, "clientcert") == 0) { /* - * Since we require ctHostSSL, this really can never happen on non-SSL-enabled - * builds, so don't bother checking for USE_SSL. + * Since we require ctHostSSL, this really can never happen on + * non-SSL-enabled builds, so don't bother checking for + * USE_SSL. */ if (parsedline->conntype != ctHostSSL) { ereport(LOG, (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("clientcert can only be configured for \"hostssl\" rows"), - errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + errcontext("line %d of configuration file \"%s\"", + line_num, HbaFileName))); return false; } if (strcmp(c, "1") == 0) @@ -979,8 +980,8 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("client certificates can only be checked if a root certificate store is available"), errdetail("make sure the root certificate store is present and readable"), - errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + errcontext("line %d of configuration file \"%s\"", + line_num, HbaFileName))); return false; } parsedline->clientcert = true; @@ -992,8 +993,8 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) ereport(LOG, (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("clientcert can not be set to 0 when using \"cert\" authentication"), - errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + errcontext("line %d of configuration file \"%s\"", + line_num, HbaFileName))); return false; } parsedline->clientcert = false; @@ -1026,8 +1027,8 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) ereport(LOG, (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("invalid LDAP port number: \"%s\"", c), - errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + errcontext("line %d of configuration file \"%s\"", + line_num, HbaFileName))); return false; } } @@ -1069,7 +1070,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) { ereport(LOG, (errcode(ERRCODE_CONFIG_FILE_ERROR), - errmsg("unknown authentication option name: \"%s\"", token), + errmsg("unknown authentication option name: \"%s\"", token), errcontext("line %d of configuration file \"%s\"", line_num, HbaFileName))); return false; @@ -1078,8 +1079,8 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) } /* - * Check if the selected authentication method has any mandatory arguments that - * are not set. + * Check if the selected authentication method has any mandatory arguments + * that are not set. */ if (parsedline->auth_method == uaLDAP) { @@ -1093,7 +1094,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) { parsedline->clientcert = true; } - + return true; } @@ -1106,7 +1107,7 @@ static bool check_hba(hbaPort *port) { ListCell *line; - HbaLine *hba; + HbaLine *hba; foreach(line, parsed_hba_lines) { @@ -1150,28 +1151,30 @@ check_hba(hbaPort *port) continue; } #ifdef HAVE_IPV6 - else if (hba->addr.ss_family == AF_INET && - port->raddr.addr.ss_family == AF_INET6) + else if (hba->addr.ss_family == AF_INET && + port->raddr.addr.ss_family == AF_INET6) { /* - * Wrong address family. We allow only one case: if the file has - * IPv4 and the port is IPv6, promote the file address to IPv6 and - * try to match that way. + * Wrong address family. We allow only one case: if the file + * has IPv4 and the port is IPv6, promote the file address to + * IPv6 and try to match that way. */ - struct sockaddr_storage addrcopy, maskcopy; + struct sockaddr_storage addrcopy, + maskcopy; + memcpy(&addrcopy, &hba->addr, sizeof(addrcopy)); memcpy(&maskcopy, &hba->mask, sizeof(maskcopy)); pg_promote_v4_to_v6_addr(&addrcopy); pg_promote_v4_to_v6_mask(&maskcopy); - + if (!pg_range_sockaddr(&port->raddr.addr, &addrcopy, &maskcopy)) continue; } -#endif /* HAVE_IPV6 */ +#endif /* HAVE_IPV6 */ else /* Wrong address family, no IPV6 */ continue; - } /* != ctLocal */ + } /* != ctLocal */ /* Check database and role */ if (!check_db(port->database_name, port->user_name, hba->database)) @@ -1191,8 +1194,8 @@ check_hba(hbaPort *port) port->hba = hba; return true; - /* XXX: - * Return false only happens if we have a parsing error, which we can + /* + * XXX: Return false only happens if we have a parsing error, which we can * no longer have (parsing now in postmaster). Consider changing API. */ } @@ -1279,11 +1282,12 @@ free_hba_record(HbaLine *record) static void clean_hba_list(List *lines) { - ListCell *line; + ListCell *line; foreach(line, lines) { - HbaLine *parsed = (HbaLine *)lfirst(line); + HbaLine *parsed = (HbaLine *) lfirst(line); + if (parsed) free_hba_record(parsed); } @@ -1301,11 +1305,12 @@ bool load_hba(void) { FILE *file; - List *hba_lines = NIL; - List *hba_line_nums = NIL; - ListCell *line, *line_num; - List *new_parsed_lines = NIL; - bool ok = true; + List *hba_lines = NIL; + List *hba_line_nums = NIL; + ListCell *line, + *line_num; + List *new_parsed_lines = NIL; + bool ok = true; file = AllocateFile(HbaFileName, "r"); if (file == NULL) @@ -1314,10 +1319,11 @@ load_hba(void) (errcode_for_file_access(), errmsg("could not open configuration file \"%s\": %m", HbaFileName))); + /* * Caller will take care of making this a FATAL error in case this is - * the initial startup. If it happens on reload, we just keep the - * old version around. + * the initial startup. If it happens on reload, we just keep the old + * version around. */ return false; } @@ -1328,7 +1334,7 @@ load_hba(void) /* Now parse all the lines */ forboth(line, hba_lines, line_num, hba_line_nums) { - HbaLine *newline; + HbaLine *newline; newline = palloc0(sizeof(HbaLine)); @@ -1339,9 +1345,9 @@ load_hba(void) pfree(newline); /* - * Keep parsing the rest of the file so we can report errors - * on more than the first row. Error has already been reported - * in the parsing function, so no need to log it here. + * Keep parsing the rest of the file so we can report errors on + * more than the first row. Error has already been reported in the + * parsing function, so no need to log it here. */ ok = false; continue; @@ -1461,10 +1467,10 @@ parse_ident_usermap(List *line, int line_number, const char *usermap_name, if (file_ident_user[0] == '/') { /* - * When system username starts with a slash, treat it as a regular expression. - * In this case, we process the system username as a regular expression that - * returns exactly one match. This is replaced for \1 in the database username - * string, if present. + * When system username starts with a slash, treat it as a regular + * expression. In this case, we process the system username as a + * regular expression that returns exactly one match. This is replaced + * for \1 in the database username string, if present. */ int r; regex_t re; @@ -1474,22 +1480,22 @@ parse_ident_usermap(List *line, int line_number, const char *usermap_name, char *ofs; char *regexp_pgrole; - wstr = palloc((strlen(file_ident_user+1) + 1) * sizeof(pg_wchar)); - wlen = pg_mb2wchar_with_len(file_ident_user+1, wstr, strlen(file_ident_user+1)); + wstr = palloc((strlen(file_ident_user + 1) + 1) * sizeof(pg_wchar)); + wlen = pg_mb2wchar_with_len(file_ident_user + 1, wstr, strlen(file_ident_user + 1)); /* - * XXX: Major room for optimization: regexps could be compiled when the file is loaded - * and then re-used in every connection. + * XXX: Major room for optimization: regexps could be compiled when + * the file is loaded and then re-used in every connection. */ r = pg_regcomp(&re, wstr, wlen, REG_ADVANCED); if (r) { - char errstr[100]; + char errstr[100]; pg_regerror(r, &re, errstr, sizeof(errstr)); ereport(ERROR, (errcode(ERRCODE_INVALID_REGULAR_EXPRESSION), - errmsg("invalid regular expression \"%s\": %s", file_ident_user+1, errstr))); + errmsg("invalid regular expression \"%s\": %s", file_ident_user + 1, errstr))); pfree(wstr); *error_p = true; @@ -1500,10 +1506,10 @@ parse_ident_usermap(List *line, int line_number, const char *usermap_name, wstr = palloc((strlen(ident_user) + 1) * sizeof(pg_wchar)); wlen = pg_mb2wchar_with_len(ident_user, wstr, strlen(ident_user)); - r = pg_regexec(&re, wstr, wlen, 0, NULL, 2, matches,0); + r = pg_regexec(&re, wstr, wlen, 0, NULL, 2, matches, 0); if (r) { - char errstr[100]; + char errstr[100]; if (r != REG_NOMATCH) { @@ -1511,7 +1517,7 @@ parse_ident_usermap(List *line, int line_number, const char *usermap_name, pg_regerror(r, &re, errstr, sizeof(errstr)); ereport(ERROR, (errcode(ERRCODE_INVALID_REGULAR_EXPRESSION), - errmsg("regular expression match for \"%s\" failed: %s", file_ident_user+1, errstr))); + errmsg("regular expression match for \"%s\" failed: %s", file_ident_user + 1, errstr))); *error_p = true; } @@ -1528,14 +1534,18 @@ parse_ident_usermap(List *line, int line_number, const char *usermap_name, ereport(ERROR, (errcode(ERRCODE_INVALID_REGULAR_EXPRESSION), errmsg("regular expression \"%s\" has no subexpressions as requested by backreference in \"%s\"", - file_ident_user+1, file_pgrole))); - /* length: original length minus length of \1 plus length of match plus null terminator */ - regexp_pgrole = palloc0(strlen(file_pgrole) - 2 + (matches[1].rm_eo-matches[1].rm_so) + 1); - strncpy(regexp_pgrole, file_pgrole, (ofs-file_pgrole)); - memcpy(regexp_pgrole+strlen(regexp_pgrole), - ident_user+matches[1].rm_so, - matches[1].rm_eo-matches[1].rm_so); - strcat(regexp_pgrole, ofs+2); + file_ident_user + 1, file_pgrole))); + + /* + * length: original length minus length of \1 plus length of match + * plus null terminator + */ + regexp_pgrole = palloc0(strlen(file_pgrole) - 2 + (matches[1].rm_eo - matches[1].rm_so) + 1); + strncpy(regexp_pgrole, file_pgrole, (ofs - file_pgrole)); + memcpy(regexp_pgrole + strlen(regexp_pgrole), + ident_user + matches[1].rm_so, + matches[1].rm_eo - matches[1].rm_so); + strcat(regexp_pgrole, ofs + 2); } else { @@ -1545,7 +1555,10 @@ parse_ident_usermap(List *line, int line_number, const char *usermap_name, pg_regfree(&re); - /* now check if the username actually matched what the user is trying to connect as */ + /* + * now check if the username actually matched what the user is trying + * to connect as + */ if (case_insensitive) { if (pg_strcasecmp(regexp_pgrole, pg_role) == 0) @@ -1594,8 +1607,8 @@ ident_syntax: * See if the user with ident username "ident_user" is allowed to act * as Postgres user "pgrole" according to usermap "usermap_name". * - * Special case: Usermap NULL, equivalent to what was previously called - * "sameuser" or "samerole", don't look in the usermap + * Special case: Usermap NULL, equivalent to what was previously called + * "sameuser" or "samerole", don't look in the usermap * file. That's an implied map where "pgrole" must be identical to * "ident_user" in order to be authorized. * @@ -1603,9 +1616,9 @@ ident_syntax: */ int check_usermap(const char *usermap_name, - const char *pg_role, - const char *auth_user, - bool case_insensitive) + const char *pg_role, + const char *auth_user, + bool case_insensitive) { bool found_entry = false, error = false; @@ -1617,7 +1630,8 @@ check_usermap(const char *usermap_name, if (pg_strcasecmp(pg_role, auth_user) == 0) return STATUS_OK; } - else { + else + { if (strcmp(pg_role, auth_user) == 0) return STATUS_OK; } @@ -1634,7 +1648,7 @@ check_usermap(const char *usermap_name, forboth(line_cell, ident_lines, num_cell, ident_line_nums) { parse_ident_usermap(lfirst(line_cell), lfirst_int(num_cell), - usermap_name, pg_role, auth_user, case_insensitive, + usermap_name, pg_role, auth_user, case_insensitive, &found_entry, &error); if (found_entry || error) break; @@ -1643,11 +1657,11 @@ check_usermap(const char *usermap_name, if (!found_entry && !error) { ereport(LOG, - (errmsg("no match in usermap for user \"%s\" authenticated as \"%s\"", - pg_role, auth_user), - errcontext("usermap \"%s\"", usermap_name))); + (errmsg("no match in usermap for user \"%s\" authenticated as \"%s\"", + pg_role, auth_user), + errcontext("usermap \"%s\"", usermap_name))); } - return found_entry?STATUS_OK:STATUS_ERROR; + return found_entry ? STATUS_OK : STATUS_ERROR; } diff --git a/src/backend/libpq/ip.c b/src/backend/libpq/ip.c index 76f472b629..80880b3807 100644 --- a/src/backend/libpq/ip.c +++ b/src/backend/libpq/ip.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.45 2009/04/23 23:25:13 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.46 2009/06/11 14:48:58 momjian Exp $ * * This file and the IPV6 implementation were initially provided by * Nigel Kukard <nkukard@lbsd.net>, Linux Based Systems Design @@ -78,8 +78,7 @@ pg_getaddrinfo_all(const char *hostname, const char *servname, /* NULL has special meaning to getaddrinfo(). */ rc = getaddrinfo((!hostname || hostname[0] == '\0') ? NULL : hostname, servname, hintp, result); - -#else /* _AIX */ +#else /* _AIX */ /* * Various versions of AIX have various bugs in getaddrinfo()'s handling @@ -113,7 +112,7 @@ pg_getaddrinfo_all(const char *hostname, const char *servname, } } } -#endif /* _AIX */ +#endif /* _AIX */ return rc; } diff --git a/src/backend/libpq/pqformat.c b/src/backend/libpq/pqformat.c index 83d7a2bbf7..7731d19eaf 100644 --- a/src/backend/libpq/pqformat.c +++ b/src/backend/libpq/pqformat.c @@ -24,7 +24,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/libpq/pqformat.c,v 1.49 2009/03/02 21:18:43 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/libpq/pqformat.c,v 1.50 2009/06/11 14:48:58 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -218,7 +218,7 @@ pq_send_ascii_string(StringInfo buf, const char *str) { while (*str) { - char ch = *str++; + char ch = *str++; if (IS_HIGHBIT_SET(ch)) ch = '?'; diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index a587ef5df5..4917986e89 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -15,7 +15,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.430 2009/04/16 20:42:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.431 2009/06/11 14:48:58 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -182,7 +182,7 @@ _copyAppend(Append *from) static RecursiveUnion * _copyRecursiveUnion(RecursiveUnion *from) { - RecursiveUnion *newnode = makeNode(RecursiveUnion); + RecursiveUnion *newnode = makeNode(RecursiveUnion); /* * copy node superclass fields @@ -455,7 +455,7 @@ _copyValuesScan(ValuesScan *from) static CteScan * _copyCteScan(CteScan *from) { - CteScan *newnode = makeNode(CteScan); + CteScan *newnode = makeNode(CteScan); /* * copy node superclass fields @@ -1916,7 +1916,7 @@ _copyFuncCall(FuncCall *from) static A_Star * _copyAStar(A_Star *from) { - A_Star *newnode = makeNode(A_Star); + A_Star *newnode = makeNode(A_Star); return newnode; } @@ -1946,7 +1946,7 @@ _copyA_Indirection(A_Indirection *from) static A_ArrayExpr * _copyA_ArrayExpr(A_ArrayExpr *from) { - A_ArrayExpr *newnode = makeNode(A_ArrayExpr); + A_ArrayExpr *newnode = makeNode(A_ArrayExpr); COPY_NODE_FIELD(elements); COPY_LOCATION_FIELD(location); @@ -2382,7 +2382,7 @@ _copyClusterStmt(ClusterStmt *from) COPY_NODE_FIELD(relation); COPY_STRING_FIELD(indexname); - COPY_SCALAR_FIELD(verbose) ; + COPY_SCALAR_FIELD(verbose); return newnode; } diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c index d4c8b7262c..78756e6e78 100644 --- a/src/backend/nodes/equalfuncs.c +++ b/src/backend/nodes/equalfuncs.c @@ -22,7 +22,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.353 2009/04/16 20:42:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.354 2009/06/11 14:48:58 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -773,9 +773,9 @@ static bool _equalPlaceHolderVar(PlaceHolderVar *a, PlaceHolderVar *b) { /* - * We intentionally do not compare phexpr. Two PlaceHolderVars with the + * We intentionally do not compare phexpr. Two PlaceHolderVars with the * same ID and levelsup should be considered equal even if the contained - * expressions have managed to mutate to different states. One way in + * expressions have managed to mutate to different states. One way in * which that can happen is that initplan sublinks would get replaced by * differently-numbered Params when sublink folding is done. (The end * result of such a situation would be some unreferenced initplans, which diff --git a/src/backend/nodes/list.c b/src/backend/nodes/list.c index 33adc0ff58..04e17439e8 100644 --- a/src/backend/nodes/list.c +++ b/src/backend/nodes/list.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/list.c,v 1.71 2009/01/01 17:23:43 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/list.c,v 1.72 2009/06/11 14:48:58 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -793,7 +793,7 @@ list_union_oid(List *list1, List *list2) * "intersection" if list1 is known unique beforehand. * * This variant works on lists of pointers, and determines list - * membership via equal(). Note that the list1 member will be pointed + * membership via equal(). Note that the list1 member will be pointed * to in the result. */ List * diff --git a/src/backend/nodes/nodeFuncs.c b/src/backend/nodes/nodeFuncs.c index d0a3434783..0d21c9fcb0 100644 --- a/src/backend/nodes/nodeFuncs.c +++ b/src/backend/nodes/nodeFuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/nodeFuncs.c,v 1.39 2009/03/10 22:09:25 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/nodeFuncs.c,v 1.40 2009/06/11 14:48:58 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -231,7 +231,7 @@ exprType(Node *expr) /* * exprTypmod - * returns the type-specific modifier of the expression's result type, - * if it can be determined. In many cases, it can't and we return -1. + * if it can be determined. In many cases, it can't and we return -1. */ int32 exprTypmod(Node *expr) @@ -680,7 +680,7 @@ exprLocation(Node *expr) case T_DistinctExpr: /* struct-equivalent to OpExpr */ case T_NullIfExpr: /* struct-equivalent to OpExpr */ { - OpExpr *opexpr = (OpExpr *) expr; + OpExpr *opexpr = (OpExpr *) expr; /* consider both operator name and leftmost arg */ loc = leftmostLoc(opexpr->location, @@ -711,7 +711,7 @@ exprLocation(Node *expr) break; case T_SubLink: { - SubLink *sublink = (SubLink *) expr; + SubLink *sublink = (SubLink *) expr; /* check the testexpr, if any, and the operator/keyword */ loc = leftmostLoc(exprLocation(sublink->testexpr), @@ -792,7 +792,7 @@ exprLocation(Node *expr) break; case T_XmlExpr: { - XmlExpr *xexpr = (XmlExpr *) expr; + XmlExpr *xexpr = (XmlExpr *) expr; /* consider both function name and leftmost arg */ loc = leftmostLoc(xexpr->location, @@ -846,7 +846,7 @@ exprLocation(Node *expr) break; case T_A_Expr: { - A_Expr *aexpr = (A_Expr *) expr; + A_Expr *aexpr = (A_Expr *) expr; /* use leftmost of operator or left operand (if any) */ /* we assume right operand can't be to left of operator */ @@ -865,7 +865,7 @@ exprLocation(Node *expr) break; case T_FuncCall: { - FuncCall *fc = (FuncCall *) expr; + FuncCall *fc = (FuncCall *) expr; /* consider both function name and leftmost arg */ loc = leftmostLoc(fc->location, @@ -882,11 +882,11 @@ exprLocation(Node *expr) break; case T_TypeCast: { - TypeCast *tc = (TypeCast *) expr; + TypeCast *tc = (TypeCast *) expr; /* - * This could represent CAST(), ::, or TypeName 'literal', - * so any of the components might be leftmost. + * This could represent CAST(), ::, or TypeName 'literal', so + * any of the components might be leftmost. */ loc = exprLocation(tc->arg); loc = leftmostLoc(loc, tc->typename->location); @@ -1265,7 +1265,7 @@ expression_tree_walker(Node *node, break; case T_WindowClause: { - WindowClause *wc = (WindowClause *) node; + WindowClause *wc = (WindowClause *) node; if (walker(wc->partitionClause, context)) return true; @@ -1278,8 +1278,8 @@ expression_tree_walker(Node *node, CommonTableExpr *cte = (CommonTableExpr *) node; /* - * Invoke the walker on the CTE's Query node, so it - * can recurse into the sub-query if it wants to. + * Invoke the walker on the CTE's Query node, so it can + * recurse into the sub-query if it wants to. */ return walker(cte->ctequery, context); } @@ -1423,7 +1423,7 @@ range_table_walker(List *rtable, { case RTE_RELATION: case RTE_SPECIAL: - case RTE_CTE: + case RTE_CTE: /* nothing to do */ break; case RTE_SUBQUERY: @@ -1904,8 +1904,8 @@ expression_tree_mutator(Node *node, return node; case T_WindowClause: { - WindowClause *wc = (WindowClause *) node; - WindowClause *newnode; + WindowClause *wc = (WindowClause *) node; + WindowClause *newnode; FLATCOPY(newnode, wc, WindowClause); MUTATE(newnode->partitionClause, wc->partitionClause, List *); @@ -1921,8 +1921,8 @@ expression_tree_mutator(Node *node, FLATCOPY(newnode, cte, CommonTableExpr); /* - * Also invoke the mutator on the CTE's Query node, so it - * can recurse into the sub-query if it wants to. + * Also invoke the mutator on the CTE's Query node, so it can + * recurse into the sub-query if it wants to. */ MUTATE(newnode->ctequery, cte->ctequery, Node *); return (Node *) newnode; @@ -2070,7 +2070,7 @@ query_tree_mutator(Query *query, MUTATE(query->limitCount, query->limitCount, Node *); if (!(flags & QTW_IGNORE_CTE_SUBQUERIES)) MUTATE(query->cteList, query->cteList, List *); - else /* else copy CTE list as-is */ + else /* else copy CTE list as-is */ query->cteList = copyObject(query->cteList); query->rtable = range_table_mutator(query->rtable, mutator, context, flags); @@ -2198,7 +2198,7 @@ query_or_expression_tree_mutator(Node *node, * that could appear under it, but not other statement types. */ bool -raw_expression_tree_walker(Node *node, bool (*walker) (), void *context) + raw_expression_tree_walker(Node *node, bool (*walker) (), void *context) { ListCell *temp; @@ -2356,7 +2356,7 @@ raw_expression_tree_walker(Node *node, bool (*walker) (), void *context) break; case T_A_Expr: { - A_Expr *expr = (A_Expr *) node; + A_Expr *expr = (A_Expr *) node; if (walker(expr->lexpr, context)) return true; @@ -2370,7 +2370,7 @@ raw_expression_tree_walker(Node *node, bool (*walker) (), void *context) break; case T_FuncCall: { - FuncCall *fcall = (FuncCall *) node; + FuncCall *fcall = (FuncCall *) node; if (walker(fcall->args, context)) return true; @@ -2381,7 +2381,7 @@ raw_expression_tree_walker(Node *node, bool (*walker) (), void *context) break; case T_A_Indices: { - A_Indices *indices = (A_Indices *) node; + A_Indices *indices = (A_Indices *) node; if (walker(indices->lidx, context)) return true; @@ -2403,7 +2403,7 @@ raw_expression_tree_walker(Node *node, bool (*walker) (), void *context) return walker(((A_ArrayExpr *) node)->elements, context); case T_ResTarget: { - ResTarget *rt = (ResTarget *) node; + ResTarget *rt = (ResTarget *) node; if (walker(rt->indirection, context)) return true; @@ -2413,7 +2413,7 @@ raw_expression_tree_walker(Node *node, bool (*walker) (), void *context) break; case T_TypeCast: { - TypeCast *tc = (TypeCast *) node; + TypeCast *tc = (TypeCast *) node; if (walker(tc->arg, context)) return true; @@ -2425,7 +2425,7 @@ raw_expression_tree_walker(Node *node, bool (*walker) (), void *context) return walker(((SortBy *) node)->node, context); case T_WindowDef: { - WindowDef *wd = (WindowDef *) node; + WindowDef *wd = (WindowDef *) node; if (walker(wd->partitionClause, context)) return true; @@ -2455,7 +2455,7 @@ raw_expression_tree_walker(Node *node, bool (*walker) (), void *context) break; case T_TypeName: { - TypeName *tn = (TypeName *) node; + TypeName *tn = (TypeName *) node; if (walker(tn->typmods, context)) return true; @@ -2466,7 +2466,7 @@ raw_expression_tree_walker(Node *node, bool (*walker) (), void *context) break; case T_ColumnDef: { - ColumnDef *coldef = (ColumnDef *) node; + ColumnDef *coldef = (ColumnDef *) node; if (walker(coldef->typename, context)) return true; diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index 18e9a5792f..d79bd750d0 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.359 2009/04/16 20:42:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.360 2009/06/11 14:48:58 momjian Exp $ * * NOTES * Every node type that can appear in stored rules' parsetrees *must* @@ -332,7 +332,7 @@ _outAppend(StringInfo str, Append *node) static void _outRecursiveUnion(StringInfo str, RecursiveUnion *node) { - int i; + int i; WRITE_NODE_TYPE("RECURSIVEUNION"); @@ -544,7 +544,7 @@ _outHashJoin(StringInfo str, HashJoin *node) static void _outAgg(StringInfo str, Agg *node) { - int i; + int i; WRITE_NODE_TYPE("AGG"); @@ -587,7 +587,7 @@ _outWindowAgg(StringInfo str, WindowAgg *node) WRITE_INT_FIELD(ordNumCols); appendStringInfo(str, " :ordColIdx"); - for (i = 0; i< node->ordNumCols; i++) + for (i = 0; i < node->ordNumCols; i++) appendStringInfo(str, " %d", node->ordColIdx[i]); appendStringInfo(str, " :ordOperations"); diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c index de62e53d1d..b27cd513a5 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.221 2009/01/22 20:16:04 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.222 2009/06/11 14:48:58 momjian Exp $ * * NOTES * Path and Plan nodes do not have any readfuncs support, because we @@ -107,7 +107,7 @@ #define READ_LOCATION_FIELD(fldname) \ token = pg_strtok(&length); /* skip :fldname */ \ token = pg_strtok(&length); /* get field value */ \ - local_node->fldname = -1 /* set field to "unknown" */ + local_node->fldname = -1 /* set field to "unknown" */ /* Read a Node field */ #define READ_NODE_FIELD(fldname) \ @@ -148,7 +148,8 @@ static Datum readDatum(bool typbyval); static Bitmapset * _readBitmapset(void) { - Bitmapset *result = NULL; + Bitmapset *result = NULL; + READ_TEMP_LOCALS(); token = pg_strtok(&length); @@ -165,8 +166,8 @@ _readBitmapset(void) for (;;) { - int val; - char *endptr; + int val; + char *endptr; token = pg_strtok(&length); if (token == NULL) diff --git a/src/backend/nodes/tidbitmap.c b/src/backend/nodes/tidbitmap.c index e56b4696b4..79e036e8bf 100644 --- a/src/backend/nodes/tidbitmap.c +++ b/src/backend/nodes/tidbitmap.c @@ -19,7 +19,7 @@ * of lossiness. In theory we could fall back to page ranges at some * point, but for now that seems useless complexity. * - * We also support the notion of candidate matches, or rechecking. This + * We also support the notion of candidate matches, or rechecking. This * means we know that a search need visit only some tuples on a page, * but we are not certain that all of those tuples are real matches. * So the eventual heap scan must recheck the quals for these tuples only, @@ -32,7 +32,7 @@ * Copyright (c) 2003-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/tidbitmap.c,v 1.18 2009/03/24 20:17:14 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/tidbitmap.c,v 1.19 2009/06/11 14:48:58 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -143,7 +143,7 @@ struct TIDBitmap /* * When iterating over a bitmap in sorted order, a TBMIterator is used to - * track our progress. There can be several iterators scanning the same + * track our progress. There can be several iterators scanning the same * bitmap concurrently. Note that the bitmap becomes read-only as soon as * any iterator is created. */ @@ -511,10 +511,10 @@ tbm_intersect_page(TIDBitmap *a, PagetableEntry *apage, const TIDBitmap *b) else if (tbm_page_is_lossy(b, apage->blockno)) { /* - * Some of the tuples in 'a' might not satisfy the quals for 'b', - * but because the page 'b' is lossy, we don't know which ones. - * Therefore we mark 'a' as requiring rechecks, to indicate that - * at most those tuples set in 'a' are matches. + * Some of the tuples in 'a' might not satisfy the quals for 'b', but + * because the page 'b' is lossy, we don't know which ones. Therefore + * we mark 'a' as requiring rechecks, to indicate that at most those + * tuples set in 'a' are matches. */ apage->recheck = true; return false; @@ -573,7 +573,7 @@ tbm_begin_iterate(TIDBitmap *tbm) * needs of the TBMIterateResult sub-struct. */ iterator = (TBMIterator *) palloc(sizeof(TBMIterator) + - MAX_TUPLES_PER_PAGE * sizeof(OffsetNumber)); + MAX_TUPLES_PER_PAGE * sizeof(OffsetNumber)); iterator->tbm = tbm; /* @@ -584,10 +584,10 @@ tbm_begin_iterate(TIDBitmap *tbm) iterator->schunkbit = 0; /* - * If we have a hashtable, create and fill the sorted page lists, - * unless we already did that for a previous iterator. Note that the - * lists are attached to the bitmap not the iterator, so they can be - * used by more than one iterator. + * If we have a hashtable, create and fill the sorted page lists, unless + * we already did that for a previous iterator. Note that the lists are + * attached to the bitmap not the iterator, so they can be used by more + * than one iterator. */ if (tbm->status == TBM_HASH && !tbm->iterating) { @@ -644,7 +644,7 @@ tbm_begin_iterate(TIDBitmap *tbm) TBMIterateResult * tbm_iterate(TBMIterator *iterator) { - TIDBitmap *tbm = iterator->tbm; + TIDBitmap *tbm = iterator->tbm; TBMIterateResult *output = &(iterator->output); Assert(tbm->iterating); diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c index fee9b8fac8..4a0a1012c0 100644 --- a/src/backend/optimizer/path/allpaths.c +++ b/src/backend/optimizer/path/allpaths.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.182 2009/04/19 19:46:33 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.183 2009/06/11 14:48:58 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -58,9 +58,9 @@ static void set_function_pathlist(PlannerInfo *root, RelOptInfo *rel, static void set_values_pathlist(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte); static void set_cte_pathlist(PlannerInfo *root, RelOptInfo *rel, - RangeTblEntry *rte); + RangeTblEntry *rte); static void set_worktable_pathlist(PlannerInfo *root, RelOptInfo *rel, - RangeTblEntry *rte); + RangeTblEntry *rte); static RelOptInfo *make_rel_from_joinlist(PlannerInfo *root, List *joinlist); static bool subquery_is_pushdown_safe(Query *subquery, Query *topquery, bool *differentTypes); @@ -292,13 +292,13 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel, /* * Initialize to compute size estimates for whole append relation. * - * We handle width estimates by weighting the widths of different - * child rels proportionally to their number of rows. This is sensible - * because the use of width estimates is mainly to compute the total - * relation "footprint" if we have to sort or hash it. To do this, - * we sum the total equivalent size (in "double" arithmetic) and then - * divide by the total rowcount estimate. This is done separately for - * the total rel width and each attribute. + * We handle width estimates by weighting the widths of different child + * rels proportionally to their number of rows. This is sensible because + * the use of width estimates is mainly to compute the total relation + * "footprint" if we have to sort or hash it. To do this, we sum the + * total equivalent size (in "double" arithmetic) and then divide by the + * total rowcount estimate. This is done separately for the total rel + * width and each attribute. * * Note: if you consider changing this logic, beware that child rels could * have zero rows and/or width, if they were excluded by constraints. @@ -377,11 +377,11 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel, } /* - * Note: we could compute appropriate attr_needed data for the - * child's variables, by transforming the parent's attr_needed - * through the translated_vars mapping. However, currently there's - * no need because attr_needed is only examined for base relations - * not otherrels. So we just leave the child's attr_needed empty. + * Note: we could compute appropriate attr_needed data for the child's + * variables, by transforming the parent's attr_needed through the + * translated_vars mapping. However, currently there's no need + * because attr_needed is only examined for base relations not + * otherrels. So we just leave the child's attr_needed empty. */ /* @@ -438,7 +438,7 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel, rel->rows = parent_rows; if (parent_rows > 0) { - int i; + int i; rel->width = rint(parent_size / parent_rows); for (i = 0; i < nattrs; i++) @@ -681,6 +681,7 @@ set_cte_pathlist(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte) if (!cteroot) /* shouldn't happen */ elog(ERROR, "bad levelsup for CTE \"%s\"", rte->ctename); } + /* * Note: cte_plan_ids can be shorter than cteList, if we are still working * on planning the CTEs (ie, this is a side-reference from another CTE). @@ -726,8 +727,8 @@ set_worktable_pathlist(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte) /* * We need to find the non-recursive term's plan, which is in the plan - * level that's processing the recursive UNION, which is one level - * *below* where the CTE comes from. + * level that's processing the recursive UNION, which is one level *below* + * where the CTE comes from. */ levelsup = rte->ctelevelsup; if (levelsup == 0) /* shouldn't happen */ @@ -1087,7 +1088,7 @@ compare_tlist_datatypes(List *tlist, List *colTypes, * of rows returned. (This condition is vacuous for DISTINCT, because then * there are no non-DISTINCT output columns, so we needn't check. But note * we are assuming that the qual can't distinguish values that the DISTINCT - * operator sees as equal. This is a bit shaky but we have no way to test + * operator sees as equal. This is a bit shaky but we have no way to test * for the case, and it's unlikely enough that we shouldn't refuse the * optimization just because it could theoretically happen.) * @@ -1113,8 +1114,8 @@ qual_is_pushdown_safe(Query *subquery, Index rti, Node *qual, return false; /* - * It would be unsafe to push down window function calls, but at least - * for the moment we could never see any in a qual anyhow. + * It would be unsafe to push down window function calls, but at least for + * the moment we could never see any in a qual anyhow. */ Assert(!contain_window_function(qual)); diff --git a/src/backend/optimizer/path/clausesel.c b/src/backend/optimizer/path/clausesel.c index ee02689d29..34407af607 100644 --- a/src/backend/optimizer/path/clausesel.c +++ b/src/backend/optimizer/path/clausesel.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/path/clausesel.c,v 1.97 2009/02/06 23:43:23 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/path/clausesel.c,v 1.98 2009/06/11 14:48:58 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -102,8 +102,8 @@ clauselist_selectivity(PlannerInfo *root, ListCell *l; /* - * If there's exactly one clause, then no use in trying to match up - * pairs, so just go directly to clause_selectivity(). + * If there's exactly one clause, then no use in trying to match up pairs, + * so just go directly to clause_selectivity(). */ if (list_length(clauses) == 1) return clause_selectivity(root, (Node *) linitial(clauses), @@ -410,30 +410,30 @@ treat_as_join_clause(Node *clause, RestrictInfo *rinfo, if (varRelid != 0) { /* - * Caller is forcing restriction mode (eg, because we are examining - * an inner indexscan qual). + * Caller is forcing restriction mode (eg, because we are examining an + * inner indexscan qual). */ return false; } else if (sjinfo == NULL) { /* - * It must be a restriction clause, since it's being evaluated at - * a scan node. + * It must be a restriction clause, since it's being evaluated at a + * scan node. */ return false; } else { /* - * Otherwise, it's a join if there's more than one relation used. - * We can optimize this calculation if an rinfo was passed. + * Otherwise, it's a join if there's more than one relation used. We + * can optimize this calculation if an rinfo was passed. * - * XXX Since we know the clause is being evaluated at a join, - * the only way it could be single-relation is if it was delayed - * by outer joins. Although we can make use of the restriction - * qual estimators anyway, it seems likely that we ought to account - * for the probability of injected nulls somehow. + * XXX Since we know the clause is being evaluated at a join, the + * only way it could be single-relation is if it was delayed by outer + * joins. Although we can make use of the restriction qual estimators + * anyway, it seems likely that we ought to account for the + * probability of injected nulls somehow. */ if (rinfo) return (bms_membership(rinfo->clause_relids) == BMS_MULTIPLE); @@ -467,7 +467,7 @@ treat_as_join_clause(Node *clause, RestrictInfo *rinfo, * if the clause isn't a join clause. * * sjinfo is NULL for a non-join clause, otherwise it provides additional - * context information about the join being performed. There are some + * context information about the join being performed. There are some * special cases: * 1. For a special (not INNER) join, sjinfo is always a member of * root->join_info_list. @@ -525,7 +525,7 @@ clause_selectivity(PlannerInfo *root, * contains only vars of that relid --- otherwise varRelid will affect * the result, so mustn't cache. Outer join quals might be examined * with either their join's actual jointype or JOIN_INNER, so we need - * two cache variables to remember both cases. Note: we assume the + * two cache variables to remember both cases. Note: we assume the * result won't change if we are switching the input relations or * considering a unique-ified case, so we only need one cache variable * for all non-JOIN_INNER cases. @@ -571,8 +571,8 @@ clause_selectivity(PlannerInfo *root, { /* * A Var at the top of a clause must be a bool Var. This is - * equivalent to the clause reln.attribute = 't', so we - * compute the selectivity as if that is what we have. + * equivalent to the clause reln.attribute = 't', so we compute + * the selectivity as if that is what we have. */ s1 = restriction_selectivity(root, BooleanEqualOperator, diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c index eca0f80b8c..08f1d361ba 100644 --- a/src/backend/optimizer/path/costsize.c +++ b/src/backend/optimizer/path/costsize.c @@ -54,7 +54,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.208 2009/05/09 22:51:41 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.209 2009/06/11 14:48:58 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -126,7 +126,7 @@ static bool adjust_semi_join(PlannerInfo *root, JoinPath *path, Selectivity *match_count, bool *indexed_join_quals); static double approx_tuple_count(PlannerInfo *root, JoinPath *path, - List *quals); + List *quals); static void set_rel_width(PlannerInfo *root, RelOptInfo *rel); static double relation_byte_size(double tuples, int width); static double page_size(double tuples, int width); @@ -946,7 +946,7 @@ cost_valuesscan(Path *path, PlannerInfo *root, RelOptInfo *baserel) * * Note: this is used for both self-reference and regular CTEs; the * possible cost differences are below the threshold of what we could - * estimate accurately anyway. Note that the costs of evaluating the + * estimate accurately anyway. Note that the costs of evaluating the * referenced CTE query are added into the final plan as initplan costs, * and should NOT be counted here. */ @@ -998,9 +998,9 @@ cost_recursive_union(Plan *runion, Plan *nrterm, Plan *rterm) /* * We arbitrarily assume that about 10 recursive iterations will be - * needed, and that we've managed to get a good fix on the cost and - * output size of each one of them. These are mighty shaky assumptions - * but it's hard to see how to do better. + * needed, and that we've managed to get a good fix on the cost and output + * size of each one of them. These are mighty shaky assumptions but it's + * hard to see how to do better. */ total_cost += 10 * rterm->total_cost; total_rows += 10 * rterm->plan_rows; @@ -1406,8 +1406,8 @@ cost_nestloop(NestPath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo) double outer_path_rows = PATH_ROWS(outer_path); double inner_path_rows = nestloop_inner_path_rows(inner_path); double ntuples; - Selectivity outer_match_frac; - Selectivity match_count; + Selectivity outer_match_frac; + Selectivity match_count; bool indexed_join_quals; if (!enable_nestloop) @@ -1446,7 +1446,7 @@ cost_nestloop(NestPath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo) &indexed_join_quals)) { double outer_matched_rows; - Selectivity inner_scan_frac; + Selectivity inner_scan_frac; /* * SEMI or ANTI join: executor will stop after first match. @@ -1470,11 +1470,11 @@ cost_nestloop(NestPath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo) /* * For unmatched outer-rel rows, there are two cases. If the inner - * path is an indexscan using all the joinquals as indexquals, then - * an unmatched row results in an indexscan returning no rows, which - * is probably quite cheap. We estimate this case as the same cost - * to return the first tuple of a nonempty scan. Otherwise, the - * executor will have to scan the whole inner rel; not so cheap. + * path is an indexscan using all the joinquals as indexquals, then an + * unmatched row results in an indexscan returning no rows, which is + * probably quite cheap. We estimate this case as the same cost to + * return the first tuple of a nonempty scan. Otherwise, the executor + * will have to scan the whole inner rel; not so cheap. */ if (indexed_join_quals) { @@ -1569,7 +1569,7 @@ cost_mergejoin(MergePath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo) qp_qual_cost.per_tuple -= merge_qual_cost.per_tuple; /* - * Get approx # tuples passing the mergequals. We use approx_tuple_count + * Get approx # tuples passing the mergequals. We use approx_tuple_count * here because we need an estimate done with JOIN_INNER semantics. */ mergejointuples = approx_tuple_count(root, &path->jpath, mergeclauses); @@ -1586,7 +1586,7 @@ cost_mergejoin(MergePath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo) * estimated approximately as size of merge join output minus size of * inner relation. Assume that the distinct key values are 1, 2, ..., and * denote the number of values of each key in the outer relation as m1, - * m2, ...; in the inner relation, n1, n2, ... Then we have + * m2, ...; in the inner relation, n1, n2, ... Then we have * * size of join = m1 * n1 + m2 * n2 + ... * @@ -1620,11 +1620,11 @@ cost_mergejoin(MergePath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo) * (unless it's an outer join, in which case the outer side has to be * scanned all the way anyway). Estimate fraction of the left and right * inputs that will actually need to be scanned. Likewise, we can - * estimate the number of rows that will be skipped before the first - * join pair is found, which should be factored into startup cost. - * We use only the first (most significant) merge clause for this purpose. - * Since mergejoinscansel() is a fairly expensive computation, we cache - * the results in the merge clause RestrictInfo. + * estimate the number of rows that will be skipped before the first join + * pair is found, which should be factored into startup cost. We use only + * the first (most significant) merge clause for this purpose. Since + * mergejoinscansel() is a fairly expensive computation, we cache the + * results in the merge clause RestrictInfo. */ if (mergeclauses && path->jpath.jointype != JOIN_FULL) { @@ -1795,8 +1795,8 @@ cost_mergejoin(MergePath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo) * clauses that are to be applied at the join. (This is pessimistic since * not all of the quals may get evaluated at each tuple.) * - * Note: we could adjust for SEMI/ANTI joins skipping some qual evaluations - * here, but it's probably not worth the trouble. + * Note: we could adjust for SEMI/ANTI joins skipping some qual + * evaluations here, but it's probably not worth the trouble. */ startup_cost += qp_qual_cost.startup; cpu_per_tuple = cpu_tuple_cost + qp_qual_cost.per_tuple; @@ -1890,8 +1890,8 @@ cost_hashjoin(HashPath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo) int num_skew_mcvs; double virtualbuckets; Selectivity innerbucketsize; - Selectivity outer_match_frac; - Selectivity match_count; + Selectivity outer_match_frac; + Selectivity match_count; ListCell *hcl; if (!enable_hashjoin) @@ -1937,11 +1937,12 @@ cost_hashjoin(HashPath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo) */ ExecChooseHashTableSize(inner_path_rows, inner_path->parent->width, - true, /* useskew */ + true, /* useskew */ &numbuckets, &numbatches, &num_skew_mcvs); virtualbuckets = (double) numbuckets *(double) numbatches; + /* mark the path with estimated # of batches */ path->num_batches = numbatches; @@ -2038,7 +2039,7 @@ cost_hashjoin(HashPath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo) NULL)) { double outer_matched_rows; - Selectivity inner_scan_frac; + Selectivity inner_scan_frac; /* * SEMI or ANTI join: executor will stop after first match. @@ -2064,12 +2065,12 @@ cost_hashjoin(HashPath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo) * preferentially hit heavily-populated buckets; instead assume they * are uncorrelated with the inner distribution and so they see an * average bucket size of inner_path_rows / virtualbuckets. In the - * second place, it seems likely that they will have few if any - * exact hash-code matches and so very few of the tuples in the - * bucket will actually require eval of the hash quals. We don't - * have any good way to estimate how many will, but for the moment - * assume that the effective cost per bucket entry is one-tenth what - * it is for matchable tuples. + * second place, it seems likely that they will have few if any exact + * hash-code matches and so very few of the tuples in the bucket will + * actually require eval of the hash quals. We don't have any good + * way to estimate how many will, but for the moment assume that the + * effective cost per bucket entry is one-tenth what it is for + * matchable tuples. */ run_cost += hash_qual_cost.per_tuple * (outer_path_rows - outer_matched_rows) * @@ -2151,18 +2152,17 @@ cost_subplan(PlannerInfo *root, SubPlan *subplan, Plan *plan) /* * The per-tuple costs include the cost of evaluating the lefthand * expressions, plus the cost of probing the hashtable. We already - * accounted for the lefthand expressions as part of the testexpr, - * and will also have counted one cpu_operator_cost for each - * comparison operator. That is probably too low for the probing - * cost, but it's hard to make a better estimate, so live with it for - * now. + * accounted for the lefthand expressions as part of the testexpr, and + * will also have counted one cpu_operator_cost for each comparison + * operator. That is probably too low for the probing cost, but it's + * hard to make a better estimate, so live with it for now. */ } else { /* * Otherwise we will be rescanning the subplan output on each - * evaluation. We need to estimate how much of the output we will + * evaluation. We need to estimate how much of the output we will * actually need to scan. NOTE: this logic should agree with the * tuple_fraction estimates used by make_subplan() in * plan/subselect.c. @@ -2315,9 +2315,9 @@ cost_qual_eval_walker(Node *node, cost_qual_eval_context *context) * Vars and Consts are charged zero, and so are boolean operators (AND, * OR, NOT). Simplistic, but a lot better than no model at all. * - * Note that Aggref and WindowFunc nodes are (and should be) treated - * like Vars --- whatever execution cost they have is absorbed into - * plan-node-specific costing. As far as expression evaluation is + * Note that Aggref and WindowFunc nodes are (and should be) treated like + * Vars --- whatever execution cost they have is absorbed into + * plan-node-specific costing. As far as expression evaluation is * concerned they're just like Vars. * * Should we try to account for the possibility of short-circuit @@ -2425,10 +2425,10 @@ cost_qual_eval_walker(Node *node, cost_qual_eval_context *context) else if (IsA(node, AlternativeSubPlan)) { /* - * Arbitrarily use the first alternative plan for costing. (We should + * Arbitrarily use the first alternative plan for costing. (We should * certainly only include one alternative, and we don't yet have - * enough information to know which one the executor is most likely - * to use.) + * enough information to know which one the executor is most likely to + * use.) */ AlternativeSubPlan *asplan = (AlternativeSubPlan *) node; @@ -2495,8 +2495,8 @@ adjust_semi_join(PlannerInfo *root, JoinPath *path, SpecialJoinInfo *sjinfo, */ /* - * In an ANTI join, we must ignore clauses that are "pushed down", - * since those won't affect the match logic. In a SEMI join, we do not + * In an ANTI join, we must ignore clauses that are "pushed down", since + * those won't affect the match logic. In a SEMI join, we do not * distinguish joinquals from "pushed down" quals, so just use the whole * restrictinfo list. */ @@ -2550,15 +2550,15 @@ adjust_semi_join(PlannerInfo *root, JoinPath *path, SpecialJoinInfo *sjinfo, /* * jselec can be interpreted as the fraction of outer-rel rows that have - * any matches (this is true for both SEMI and ANTI cases). And nselec - * is the fraction of the Cartesian product that matches. So, the - * average number of matches for each outer-rel row that has at least - * one match is nselec * inner_rows / jselec. + * any matches (this is true for both SEMI and ANTI cases). And nselec is + * the fraction of the Cartesian product that matches. So, the average + * number of matches for each outer-rel row that has at least one match is + * nselec * inner_rows / jselec. * * Note: it is correct to use the inner rel's "rows" count here, not * PATH_ROWS(), even if the inner path under consideration is an inner - * indexscan. This is because we have included all the join clauses - * in the selectivity estimate, even ones used in an inner indexscan. + * indexscan. This is because we have included all the join clauses in + * the selectivity estimate, even ones used in an inner indexscan. */ if (jselec > 0) /* protect against zero divide */ { @@ -2573,10 +2573,9 @@ adjust_semi_join(PlannerInfo *root, JoinPath *path, SpecialJoinInfo *sjinfo, *match_count = avgmatch; /* - * If requested, check whether the inner path uses all the joinquals - * as indexquals. (If that's true, we can assume that an unmatched - * outer tuple is cheap to process, whereas otherwise it's probably - * expensive.) + * If requested, check whether the inner path uses all the joinquals as + * indexquals. (If that's true, we can assume that an unmatched outer + * tuple is cheap to process, whereas otherwise it's probably expensive.) */ if (indexed_join_quals) { @@ -2906,8 +2905,8 @@ set_cte_size_estimates(PlannerInfo *root, RelOptInfo *rel, Plan *cteplan) if (rte->self_reference) { /* - * In a self-reference, arbitrarily assume the average worktable - * size is about 10 times the nonrecursive term's size. + * In a self-reference, arbitrarily assume the average worktable size + * is about 10 times the nonrecursive term's size. */ rel->tuples = 10 * cteplan->plan_rows; } @@ -2959,7 +2958,8 @@ set_rel_width(PlannerInfo *root, RelOptInfo *rel) ndx = var->varattno - rel->min_attr; /* - * The width probably hasn't been cached yet, but may as well check + * The width probably hasn't been cached yet, but may as well + * check */ if (rel->attr_widths[ndx] > 0) { diff --git a/src/backend/optimizer/path/equivclass.c b/src/backend/optimizer/path/equivclass.c index 17c9539679..17d24e400f 100644 --- a/src/backend/optimizer/path/equivclass.c +++ b/src/backend/optimizer/path/equivclass.c @@ -10,7 +10,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/path/equivclass.c,v 1.18 2009/04/19 19:46:33 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/path/equivclass.c,v 1.19 2009/06/11 14:48:58 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -438,9 +438,9 @@ get_eclass_for_sort_expr(PlannerInfo *root, /* * add_eq_member doesn't check for volatile functions, set-returning - * functions, aggregates, or window functions, but such could appear - * in sort expressions; so we have to check whether its const-marking - * was correct. + * functions, aggregates, or window functions, but such could appear in + * sort expressions; so we have to check whether its const-marking was + * correct. */ if (newec->ec_has_const) { @@ -563,11 +563,11 @@ generate_base_implied_equalities_const(PlannerInfo *root, ListCell *lc; /* - * In the trivial case where we just had one "var = const" clause, - * push the original clause back into the main planner machinery. There - * is nothing to be gained by doing it differently, and we save the - * effort to re-build and re-analyze an equality clause that will be - * exactly equivalent to the old one. + * In the trivial case where we just had one "var = const" clause, push + * the original clause back into the main planner machinery. There is + * nothing to be gained by doing it differently, and we save the effort to + * re-build and re-analyze an equality clause that will be exactly + * equivalent to the old one. */ if (list_length(ec->ec_members) == 2 && list_length(ec->ec_sources) == 1) @@ -1166,7 +1166,7 @@ create_join_clause(PlannerInfo *root, * * Outer join clauses that are marked outerjoin_delayed are special: this * condition means that one or both VARs might go to null due to a lower - * outer join. We can still push a constant through the clause, but only + * outer join. We can still push a constant through the clause, but only * if its operator is strict; and we *have to* throw the clause back into * regular joinclause processing. By keeping the strict join clause, * we ensure that any null-extended rows that are mistakenly generated due @@ -1816,11 +1816,11 @@ have_relevant_eclass_joinclause(PlannerInfo *root, * path to look through ec_sources. Checking the members anyway is OK * as a possibly-overoptimistic heuristic. * - * We don't test ec_has_const either, even though a const eclass - * won't generate real join clauses. This is because if we had - * "WHERE a.x = b.y and a.x = 42", it is worth considering a join - * between a and b, since the join result is likely to be small even - * though it'll end up being an unqualified nestloop. + * We don't test ec_has_const either, even though a const eclass won't + * generate real join clauses. This is because if we had "WHERE a.x = + * b.y and a.x = 42", it is worth considering a join between a and b, + * since the join result is likely to be small even though it'll end + * up being an unqualified nestloop. */ /* Needn't scan if it couldn't contain members from each rel */ @@ -1890,11 +1890,11 @@ has_relevant_eclass_joinclause(PlannerInfo *root, RelOptInfo *rel1) * path to look through ec_sources. Checking the members anyway is OK * as a possibly-overoptimistic heuristic. * - * We don't test ec_has_const either, even though a const eclass - * won't generate real join clauses. This is because if we had - * "WHERE a.x = b.y and a.x = 42", it is worth considering a join - * between a and b, since the join result is likely to be small even - * though it'll end up being an unqualified nestloop. + * We don't test ec_has_const either, even though a const eclass won't + * generate real join clauses. This is because if we had "WHERE a.x = + * b.y and a.x = 42", it is worth considering a join between a and b, + * since the join result is likely to be small even though it'll end + * up being an unqualified nestloop. */ /* Needn't scan if it couldn't contain members from each rel */ diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c index db271e4f1e..b3f96eb773 100644 --- a/src/backend/optimizer/path/indxpath.c +++ b/src/backend/optimizer/path/indxpath.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.239 2009/04/16 20:42:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.240 2009/06/11 14:48:58 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -179,14 +179,14 @@ create_index_paths(PlannerInfo *root, RelOptInfo *rel) true, NULL, SAOP_FORBID, ST_ANYSCAN); /* - * Submit all the ones that can form plain IndexScan plans to add_path. - * (A plain IndexPath always represents a plain IndexScan plan; however - * some of the indexes might support only bitmap scans, and those we - * mustn't submit to add_path here.) Also, pick out the ones that might - * be useful as bitmap scans. For that, we must discard indexes that - * don't support bitmap scans, and we also are only interested in paths - * that have some selectivity; we should discard anything that was - * generated solely for ordering purposes. + * Submit all the ones that can form plain IndexScan plans to add_path. (A + * plain IndexPath always represents a plain IndexScan plan; however some + * of the indexes might support only bitmap scans, and those we mustn't + * submit to add_path here.) Also, pick out the ones that might be useful + * as bitmap scans. For that, we must discard indexes that don't support + * bitmap scans, and we also are only interested in paths that have some + * selectivity; we should discard anything that was generated solely for + * ordering purposes. */ bitindexpaths = NIL; foreach(l, indexpaths) @@ -1628,13 +1628,13 @@ eclass_matches_any_index(EquivalenceClass *ec, EquivalenceMember *em, /* * If it's a btree index, we can reject it if its opfamily isn't - * compatible with the EC, since no clause generated from the - * EC could be used with the index. For non-btree indexes, - * we can't easily tell whether clauses generated from the EC - * could be used with the index, so only check for expression - * match. This might mean we return "true" for a useless index, - * but that will just cause some wasted planner cycles; it's - * better than ignoring useful indexes. + * compatible with the EC, since no clause generated from the EC + * could be used with the index. For non-btree indexes, we can't + * easily tell whether clauses generated from the EC could be used + * with the index, so only check for expression match. This might + * mean we return "true" for a useless index, but that will just + * cause some wasted planner cycles; it's better than ignoring + * useful indexes. */ if ((index->relam != BTREE_AM_OID || list_member_oid(ec->ec_opfamilies, curFamily)) && @@ -2223,9 +2223,9 @@ match_special_index_operator(Expr *clause, Oid opfamily, * want to apply. (A hash index, for example, will not support ">=".) * Currently, only btree supports the operators we need. * - * Note: actually, in the Pattern_Prefix_Exact case, we only need "=" - * so a hash index would work. Currently it doesn't seem worth checking - * for that, however. + * Note: actually, in the Pattern_Prefix_Exact case, we only need "=" so a + * hash index would work. Currently it doesn't seem worth checking for + * that, however. * * We insist on the opfamily being the specific one we expect, else we'd * do the wrong thing if someone were to make a reverse-sort opfamily with @@ -2460,7 +2460,7 @@ expand_indexqual_opclause(RestrictInfo *rinfo, Oid opfamily) /* * LIKE and regex operators are not members of any btree index opfamily, * but they can be members of opfamilies for more exotic index types such - * as GIN. Therefore, we should only do expansion if the operator is + * as GIN. Therefore, we should only do expansion if the operator is * actually not in the opfamily. But checking that requires a syscache * lookup, so it's best to first see if the operator is one we are * interested in. diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c index e172c43c3c..bc0831933e 100644 --- a/src/backend/optimizer/path/joinpath.c +++ b/src/backend/optimizer/path/joinpath.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/path/joinpath.c,v 1.121 2009/02/05 01:24:55 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/path/joinpath.c,v 1.122 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -1022,14 +1022,14 @@ select_mergejoin_clauses(PlannerInfo *root, * Note: it would be bad if this condition failed for an otherwise * mergejoinable FULL JOIN clause, since that would result in * undesirable planner failure. I believe that is not possible - * however; a variable involved in a full join could only appear - * in below_outer_join eclasses, which aren't considered redundant. + * however; a variable involved in a full join could only appear in + * below_outer_join eclasses, which aren't considered redundant. * - * This case *can* happen for left/right join clauses: the - * outer-side variable could be equated to a constant. Because we - * will propagate that constant across the join clause, the loss of - * ability to do a mergejoin is not really all that big a deal, and - * so it's not clear that improving this is important. + * This case *can* happen for left/right join clauses: the outer-side + * variable could be equated to a constant. Because we will propagate + * that constant across the join clause, the loss of ability to do a + * mergejoin is not really all that big a deal, and so it's not clear + * that improving this is important. */ cache_mergeclause_eclasses(root, restrictinfo); diff --git a/src/backend/optimizer/path/joinrels.c b/src/backend/optimizer/path/joinrels.c index 7c38607db6..9e6f57f4c9 100644 --- a/src/backend/optimizer/path/joinrels.c +++ b/src/backend/optimizer/path/joinrels.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/path/joinrels.c,v 1.99 2009/02/27 22:41:37 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/path/joinrels.c,v 1.100 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -353,7 +353,7 @@ join_is_legal(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2, ListCell *l; /* - * Ensure output params are set on failure return. This is just to + * Ensure output params are set on failure return. This is just to * suppress uninitialized-variable warnings from overly anal compilers. */ *sjinfo_p = NULL; @@ -361,7 +361,7 @@ join_is_legal(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2, /* * If we have any special joins, the proposed join might be illegal; and - * in any case we have to determine its join type. Scan the join info + * in any case we have to determine its join type. Scan the join info * list for conflicts. */ match_sjinfo = NULL; @@ -569,7 +569,7 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2) /* * If it's a plain inner join, then we won't have found anything in - * join_info_list. Make up a SpecialJoinInfo so that selectivity + * join_info_list. Make up a SpecialJoinInfo so that selectivity * estimation functions will know what's being joined. */ if (sjinfo == NULL) @@ -595,8 +595,8 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2) &restrictlist); /* - * If we've already proven this join is empty, we needn't consider - * any more paths for it. + * If we've already proven this join is empty, we needn't consider any + * more paths for it. */ if (is_dummy_rel(joinrel)) { @@ -605,19 +605,19 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2) } /* - * Consider paths using each rel as both outer and inner. Depending - * on the join type, a provably empty outer or inner rel might mean - * the join is provably empty too; in which case throw away any - * previously computed paths and mark the join as dummy. (We do it - * this way since it's conceivable that dummy-ness of a multi-element - * join might only be noticeable for certain construction paths.) + * Consider paths using each rel as both outer and inner. Depending on + * the join type, a provably empty outer or inner rel might mean the join + * is provably empty too; in which case throw away any previously computed + * paths and mark the join as dummy. (We do it this way since it's + * conceivable that dummy-ness of a multi-element join might only be + * noticeable for certain construction paths.) * * Also, a provably constant-false join restriction typically means that - * we can skip evaluating one or both sides of the join. We do this - * by marking the appropriate rel as dummy. + * we can skip evaluating one or both sides of the join. We do this by + * marking the appropriate rel as dummy. * - * We need only consider the jointypes that appear in join_info_list, - * plus JOIN_INNER. + * We need only consider the jointypes that appear in join_info_list, plus + * JOIN_INNER. */ switch (sjinfo->jointype) { @@ -665,6 +665,7 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2) restrictlist); break; case JOIN_SEMI: + /* * We might have a normal semijoin, or a case where we don't have * enough rels to do the semijoin but can unique-ify the RHS and @@ -971,12 +972,12 @@ restriction_is_constant_false(List *restrictlist) */ foreach(lc, restrictlist) { - RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc); + RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc); Assert(IsA(rinfo, RestrictInfo)); if (rinfo->clause && IsA(rinfo->clause, Const)) { - Const *con = (Const *) rinfo->clause; + Const *con = (Const *) rinfo->clause; /* constant NULL is as good as constant FALSE for our purposes */ if (con->constisnull) diff --git a/src/backend/optimizer/path/orindxpath.c b/src/backend/optimizer/path/orindxpath.c index c84591fe0c..6a644f9a0f 100644 --- a/src/backend/optimizer/path/orindxpath.c +++ b/src/backend/optimizer/path/orindxpath.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/path/orindxpath.c,v 1.89 2009/04/16 20:42:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/path/orindxpath.c,v 1.90 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -96,10 +96,10 @@ create_or_index_quals(PlannerInfo *root, RelOptInfo *rel) * enforced at the relation scan level. * * We must also ignore clauses that are marked !is_pushed_down (ie they - * are themselves outer-join clauses). It would be safe to extract an + * are themselves outer-join clauses). It would be safe to extract an * index condition from such a clause if we are within the nullable rather * than the non-nullable side of its join, but we haven't got enough - * context here to tell which applies. OR clauses in outer-join quals + * context here to tell which applies. OR clauses in outer-join quals * aren't exactly common, so we'll let that case go unoptimized for now. */ foreach(i, rel->joininfo) diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index 2aabd880aa..ab07a0dbea 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.259 2009/05/09 22:51:41 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.260 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -63,9 +63,9 @@ static FunctionScan *create_functionscan_plan(PlannerInfo *root, Path *best_path static ValuesScan *create_valuesscan_plan(PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses); static CteScan *create_ctescan_plan(PlannerInfo *root, Path *best_path, - List *tlist, List *scan_clauses); + List *tlist, List *scan_clauses); static WorkTableScan *create_worktablescan_plan(PlannerInfo *root, Path *best_path, - List *tlist, List *scan_clauses); + List *tlist, List *scan_clauses); static NestLoop *create_nestloop_plan(PlannerInfo *root, NestPath *best_path, Plan *outer_plan, Plan *inner_plan); static MergeJoin *create_mergejoin_plan(PlannerInfo *root, MergePath *best_path, @@ -98,9 +98,9 @@ static FunctionScan *make_functionscan(List *qptlist, List *qpqual, static ValuesScan *make_valuesscan(List *qptlist, List *qpqual, Index scanrelid, List *values_lists); static CteScan *make_ctescan(List *qptlist, List *qpqual, - Index scanrelid, int ctePlanId, int cteParam); + Index scanrelid, int ctePlanId, int cteParam); static WorkTableScan *make_worktablescan(List *qptlist, List *qpqual, - Index scanrelid, int wtParam); + Index scanrelid, int wtParam); static BitmapAnd *make_bitmap_and(List *bitmapplans); static BitmapOr *make_bitmap_or(List *bitmapplans); static NestLoop *make_nestloop(List *tlist, @@ -113,10 +113,10 @@ static HashJoin *make_hashjoin(List *tlist, Plan *lefttree, Plan *righttree, JoinType jointype); static Hash *make_hash(Plan *lefttree, - Oid skewTable, - AttrNumber skewColumn, - Oid skewColType, - int32 skewColTypmod); + Oid skewTable, + AttrNumber skewColumn, + Oid skewColType, + int32 skewColTypmod); static MergeJoin *make_mergejoin(List *tlist, List *joinclauses, List *otherclauses, List *mergeclauses, @@ -329,7 +329,7 @@ build_relation_tlist(RelOptInfo *rel) foreach(v, rel->reltargetlist) { /* Do we really need to copy here? Not sure */ - Node *node = (Node *) copyObject(lfirst(v)); + Node *node = (Node *) copyObject(lfirst(v)); tlist = lappend(tlist, makeTargetEntry((Expr *) node, resno, @@ -657,20 +657,20 @@ create_unique_plan(PlannerInfo *root, UniquePath *best_path) return subplan; /* - * As constructed, the subplan has a "flat" tlist containing just the - * Vars needed here and at upper levels. The values we are supposed - * to unique-ify may be expressions in these variables. We have to - * add any such expressions to the subplan's tlist. + * As constructed, the subplan has a "flat" tlist containing just the Vars + * needed here and at upper levels. The values we are supposed to + * unique-ify may be expressions in these variables. We have to add any + * such expressions to the subplan's tlist. * - * The subplan may have a "physical" tlist if it is a simple scan plan. - * If we're going to sort, this should be reduced to the regular tlist, - * so that we don't sort more data than we need to. For hashing, the - * tlist should be left as-is if we don't need to add any expressions; - * but if we do have to add expressions, then a projection step will be - * needed at runtime anyway, so we may as well remove unneeded items. - * Therefore newtlist starts from build_relation_tlist() not just a - * copy of the subplan's tlist; and we don't install it into the subplan - * unless we are sorting or stuff has to be added. + * The subplan may have a "physical" tlist if it is a simple scan plan. If + * we're going to sort, this should be reduced to the regular tlist, so + * that we don't sort more data than we need to. For hashing, the tlist + * should be left as-is if we don't need to add any expressions; but if we + * do have to add expressions, then a projection step will be needed at + * runtime anyway, so we may as well remove unneeded items. Therefore + * newtlist starts from build_relation_tlist() not just a copy of the + * subplan's tlist; and we don't install it into the subplan unless we are + * sorting or stuff has to be added. */ in_operators = best_path->in_operators; uniq_exprs = best_path->uniq_exprs; @@ -1063,10 +1063,10 @@ create_bitmap_scan_plan(PlannerInfo *root, qpqual = order_qual_clauses(root, qpqual); /* - * When dealing with special operators, we will at this point - * have duplicate clauses in qpqual and bitmapqualorig. We may as well - * drop 'em from bitmapqualorig, since there's no point in making the - * tests twice. + * When dealing with special operators, we will at this point have + * duplicate clauses in qpqual and bitmapqualorig. We may as well drop + * 'em from bitmapqualorig, since there's no point in making the tests + * twice. */ bitmapqualorig = list_difference_ptr(bitmapqualorig, qpqual); @@ -1414,10 +1414,10 @@ static CteScan * create_ctescan_plan(PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses) { - CteScan *scan_plan; + CteScan *scan_plan; Index scan_relid = best_path->parent->relid; RangeTblEntry *rte; - SubPlan *ctesplan = NULL; + SubPlan *ctesplan = NULL; int plan_id; int cte_param_id; PlannerInfo *cteroot; @@ -1441,6 +1441,7 @@ create_ctescan_plan(PlannerInfo *root, Path *best_path, if (!cteroot) /* shouldn't happen */ elog(ERROR, "bad levelsup for CTE \"%s\"", rte->ctename); } + /* * Note: cte_plan_ids can be shorter than cteList, if we are still working * on planning the CTEs (ie, this is a side-reference from another CTE). @@ -1471,8 +1472,8 @@ create_ctescan_plan(PlannerInfo *root, Path *best_path, elog(ERROR, "could not find plan for CTE \"%s\"", rte->ctename); /* - * We need the CTE param ID, which is the sole member of the - * SubPlan's setParam list. + * We need the CTE param ID, which is the sole member of the SubPlan's + * setParam list. */ cte_param_id = linitial_int(ctesplan->setParam); @@ -1512,12 +1513,12 @@ create_worktablescan_plan(PlannerInfo *root, Path *best_path, /* * We need to find the worktable param ID, which is in the plan level - * that's processing the recursive UNION, which is one level *below* - * where the CTE comes from. + * that's processing the recursive UNION, which is one level *below* where + * the CTE comes from. */ levelsup = rte->ctelevelsup; if (levelsup == 0) /* shouldn't happen */ - elog(ERROR, "bad levelsup for CTE \"%s\"", rte->ctename); + elog(ERROR, "bad levelsup for CTE \"%s\"", rte->ctename); levelsup--; cteroot = root; while (levelsup-- > 0) @@ -1526,7 +1527,7 @@ create_worktablescan_plan(PlannerInfo *root, Path *best_path, if (!cteroot) /* shouldn't happen */ elog(ERROR, "bad levelsup for CTE \"%s\"", rte->ctename); } - if (cteroot->wt_param_id < 0) /* shouldn't happen */ + if (cteroot->wt_param_id < 0) /* shouldn't happen */ elog(ERROR, "could not find param ID for CTE \"%s\"", rte->ctename); /* Sort clauses into best execution order */ @@ -1563,10 +1564,9 @@ create_nestloop_plan(PlannerInfo *root, NestLoop *join_plan; /* - * If the inner path is a nestloop inner indexscan, it might be using - * some of the join quals as index quals, in which case we don't have - * to check them again at the join node. Remove any join quals that - * are redundant. + * If the inner path is a nestloop inner indexscan, it might be using some + * of the join quals as index quals, in which case we don't have to check + * them again at the join node. Remove any join quals that are redundant. */ joinrestrictclauses = select_nonredundant_join_clauses(root, @@ -1869,12 +1869,12 @@ create_hashjoin_plan(PlannerInfo *root, disuse_physical_tlist(outer_plan, best_path->jpath.outerjoinpath); /* - * If there is a single join clause and we can identify the outer - * variable as a simple column reference, supply its identity for - * possible use in skew optimization. (Note: in principle we could - * do skew optimization with multiple join clauses, but we'd have to - * be able to determine the most common combinations of outer values, - * which we don't currently have enough stats for.) + * If there is a single join clause and we can identify the outer variable + * as a simple column reference, supply its identity for possible use in + * skew optimization. (Note: in principle we could do skew optimization + * with multiple join clauses, but we'd have to be able to determine the + * most common combinations of outer values, which we don't currently have + * enough stats for.) */ if (list_length(hashclauses) == 1) { @@ -1887,7 +1887,7 @@ create_hashjoin_plan(PlannerInfo *root, node = (Node *) ((RelabelType *) node)->arg; if (IsA(node, Var)) { - Var *var = (Var *) node; + Var *var = (Var *) node; RangeTblEntry *rte; rte = root->simple_rte_array[var->varno]; @@ -2029,8 +2029,8 @@ fix_indexqual_references(List *indexquals, IndexPath *index_path) /* Never need to commute... */ /* - * Determine which index attribute this is and change the - * indexkey operand as needed. + * Determine which index attribute this is and change the indexkey + * operand as needed. */ linitial(saop->args) = fix_indexqual_operand(linitial(saop->args), index); @@ -2506,7 +2506,7 @@ make_ctescan(List *qptlist, int ctePlanId, int cteParam) { - CteScan *node = makeNode(CteScan); + CteScan *node = makeNode(CteScan); Plan *plan = &node->scan.plan; /* cost should be inserted by caller */ @@ -3282,7 +3282,7 @@ make_windowagg(PlannerInfo *root, List *tlist, { WindowAgg *node = makeNode(WindowAgg); Plan *plan = &node->plan; - Path windowagg_path; /* dummy for result of cost_windowagg */ + Path windowagg_path; /* dummy for result of cost_windowagg */ QualCost qual_cost; node->winref = winref; @@ -3294,7 +3294,7 @@ make_windowagg(PlannerInfo *root, List *tlist, node->ordOperators = ordOperators; node->frameOptions = frameOptions; - copy_plan_costsize(plan, lefttree); /* only care about copying size */ + copy_plan_costsize(plan, lefttree); /* only care about copying size */ cost_windowagg(&windowagg_path, root, numWindowFuncs, partNumCols, ordNumCols, lefttree->startup_cost, diff --git a/src/backend/optimizer/plan/initsplan.c b/src/backend/optimizer/plan/initsplan.c index 56100ba6cc..8a189d4443 100644 --- a/src/backend/optimizer/plan/initsplan.c +++ b/src/backend/optimizer/plan/initsplan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.153 2009/05/07 20:13:09 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.154 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -332,7 +332,7 @@ deconstruct_recurse(PlannerInfo *root, Node *jtnode, bool below_outer_join, */ foreach(l, (List *) f->quals) { - Node *qual = (Node *) lfirst(l); + Node *qual = (Node *) lfirst(l); distribute_qual_to_rels(root, qual, false, below_outer_join, JOIN_INNER, @@ -430,8 +430,8 @@ deconstruct_recurse(PlannerInfo *root, Node *jtnode, bool below_outer_join, * we mustn't add it to join_info_list just yet, because we don't want * distribute_qual_to_rels to think it is an outer join below us. * - * Semijoins are a bit of a hybrid: we build a SpecialJoinInfo, - * but we want ojscope = NULL for distribute_qual_to_rels. + * Semijoins are a bit of a hybrid: we build a SpecialJoinInfo, but we + * want ojscope = NULL for distribute_qual_to_rels. */ if (j->jointype != JOIN_INNER) { @@ -455,7 +455,7 @@ deconstruct_recurse(PlannerInfo *root, Node *jtnode, bool below_outer_join, /* Process the qual clauses */ foreach(l, (List *) j->quals) { - Node *qual = (Node *) lfirst(l); + Node *qual = (Node *) lfirst(l); distribute_qual_to_rels(root, qual, false, below_outer_join, j->jointype, @@ -629,9 +629,9 @@ make_outerjoininfo(PlannerInfo *root, * min_lefthand. (We must use its full syntactic relset, not just its * min_lefthand + min_righthand. This is because there might be other * OJs below this one that this one can commute with, but we cannot - * commute with them if we don't with this one.) Also, if the - * current join is an antijoin, we must preserve ordering regardless - * of strictness. + * commute with them if we don't with this one.) Also, if the current + * join is an antijoin, we must preserve ordering regardless of + * strictness. * * Note: I believe we have to insist on being strict for at least one * rel in the lower OJ's min_righthand, not its whole syn_righthand. @@ -882,7 +882,7 @@ distribute_qual_to_rels(PlannerInfo *root, Node *clause, * We can't use such a clause to deduce equivalence (the left and * right sides might be unequal above the join because one of them has * gone to NULL) ... but we might be able to use it for more limited - * deductions, if it is mergejoinable. So consider adding it to the + * deductions, if it is mergejoinable. So consider adding it to the * lists of set-aside outer-join clauses. */ is_pushed_down = false; @@ -937,8 +937,8 @@ distribute_qual_to_rels(PlannerInfo *root, Node *clause, /* * It's possible that this is an IS NULL clause that's redundant * with a lower antijoin; if so we can just discard it. We need - * not test in any of the other cases, because this will only - * be possible for pushed-down, delayed clauses. + * not test in any of the other cases, because this will only be + * possible for pushed-down, delayed clauses. */ if (check_redundant_nullability_qual(root, clause)) return; @@ -1122,8 +1122,8 @@ distribute_qual_to_rels(PlannerInfo *root, Node *clause, */ static bool check_outerjoin_delay(PlannerInfo *root, - Relids *relids_p, /* in/out parameter */ - Relids *nullable_relids_p, /* output parameter */ + Relids *relids_p, /* in/out parameter */ + Relids *nullable_relids_p, /* output parameter */ bool is_pushed_down) { Relids relids; @@ -1215,8 +1215,8 @@ check_redundant_nullability_qual(PlannerInfo *root, Node *clause) forced_null_rel = forced_null_var->varno; /* - * If the Var comes from the nullable side of a lower antijoin, the - * IS NULL condition is necessarily true. + * If the Var comes from the nullable side of a lower antijoin, the IS + * NULL condition is necessarily true. */ foreach(lc, root->join_info_list) { @@ -1393,7 +1393,7 @@ build_implied_join_equality(Oid opno, true, /* is_pushed_down */ false, /* outerjoin_delayed */ false, /* pseudoconstant */ - qualscope, /* required_relids */ + qualscope, /* required_relids */ NULL); /* nullable_relids */ /* Set mergejoinability info always, and hashjoinability if enabled */ diff --git a/src/backend/optimizer/plan/planagg.c b/src/backend/optimizer/plan/planagg.c index 0cdcb74dfe..6bdbd2a913 100644 --- a/src/backend/optimizer/plan/planagg.c +++ b/src/backend/optimizer/plan/planagg.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/plan/planagg.c,v 1.45 2009/01/01 17:23:44 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/plan/planagg.c,v 1.46 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -96,8 +96,8 @@ optimize_minmax_aggregates(PlannerInfo *root, List *tlist, Path *best_path) * Reject unoptimizable cases. * * We don't handle GROUP BY or windowing, because our current - * implementations of grouping require looking at all the rows anyway, - * and so there's not much point in optimizing MIN/MAX. + * implementations of grouping require looking at all the rows anyway, and + * so there's not much point in optimizing MIN/MAX. */ if (parse->groupClause || parse->hasWindowFuncs) return NULL; @@ -189,12 +189,12 @@ optimize_minmax_aggregates(PlannerInfo *root, List *tlist, Path *best_path) &aggs_list); /* - * We have to replace Aggrefs with Params in equivalence classes too, - * else ORDER BY or DISTINCT on an optimized aggregate will fail. + * We have to replace Aggrefs with Params in equivalence classes too, else + * ORDER BY or DISTINCT on an optimized aggregate will fail. * - * Note: at some point it might become necessary to mutate other - * data structures too, such as the query's sortClause or distinctClause. - * Right now, those won't be examined after this point. + * Note: at some point it might become necessary to mutate other data + * structures too, such as the query's sortClause or distinctClause. Right + * now, those won't be examined after this point. */ mutate_eclass_expressions(root, replace_aggs_with_params_mutator, diff --git a/src/backend/optimizer/plan/planmain.c b/src/backend/optimizer/plan/planmain.c index c87da7a071..0b75d150ab 100644 --- a/src/backend/optimizer/plan/planmain.c +++ b/src/backend/optimizer/plan/planmain.c @@ -14,7 +14,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/plan/planmain.c,v 1.114 2009/01/01 17:23:44 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/plan/planmain.c,v 1.115 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -289,13 +289,13 @@ query_planner(PlannerInfo *root, List *tlist, /* * If both GROUP BY and ORDER BY are specified, we will need two * levels of sort --- and, therefore, certainly need to read all the - * tuples --- unless ORDER BY is a subset of GROUP BY. Likewise if - * we have both DISTINCT and GROUP BY, or if we have a window + * tuples --- unless ORDER BY is a subset of GROUP BY. Likewise if we + * have both DISTINCT and GROUP BY, or if we have a window * specification not compatible with the GROUP BY. */ if (!pathkeys_contained_in(root->sort_pathkeys, root->group_pathkeys) || !pathkeys_contained_in(root->distinct_pathkeys, root->group_pathkeys) || - !pathkeys_contained_in(root->window_pathkeys, root->group_pathkeys)) + !pathkeys_contained_in(root->window_pathkeys, root->group_pathkeys)) tuple_fraction = 0.0; } else if (parse->hasAggs || root->hasHavingQual) diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index 7ad15d9da2..3f344b3a14 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.255 2009/04/28 21:31:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.256 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -43,7 +43,7 @@ /* GUC parameter */ -double cursor_tuple_fraction = DEFAULT_CURSOR_TUPLE_FRACTION; +double cursor_tuple_fraction = DEFAULT_CURSOR_TUPLE_FRACTION; /* Hook for plugins to get control in planner() */ planner_hook_type planner_hook = NULL; @@ -84,18 +84,18 @@ static void locate_grouping_columns(PlannerInfo *root, static List *postprocess_setop_tlist(List *new_tlist, List *orig_tlist); static List *select_active_windows(PlannerInfo *root, WindowFuncLists *wflists); static List *add_volatile_sort_exprs(List *window_tlist, List *tlist, - List *activeWindows); + List *activeWindows); static List *make_pathkeys_for_window(PlannerInfo *root, WindowClause *wc, - List *tlist, bool canonicalize); + List *tlist, bool canonicalize); static void get_column_info_for_window(PlannerInfo *root, WindowClause *wc, - List *tlist, - int numSortCols, AttrNumber *sortColIdx, - int *partNumCols, - AttrNumber **partColIdx, - Oid **partOperators, - int *ordNumCols, - AttrNumber **ordColIdx, - Oid **ordOperators); + List *tlist, + int numSortCols, AttrNumber *sortColIdx, + int *partNumCols, + AttrNumber **partColIdx, + Oid **partOperators, + int *ordNumCols, + AttrNumber **ordColIdx, + Oid **ordOperators); /***************************************************************************** @@ -171,10 +171,9 @@ standard_planner(Query *parse, int cursorOptions, ParamListInfo boundParams) tuple_fraction = cursor_tuple_fraction; /* - * We document cursor_tuple_fraction as simply being a fraction, - * which means the edge cases 0 and 1 have to be treated specially - * here. We convert 1 to 0 ("all the tuples") and 0 to a very small - * fraction. + * We document cursor_tuple_fraction as simply being a fraction, which + * means the edge cases 0 and 1 have to be treated specially here. We + * convert 1 to 0 ("all the tuples") and 0 to a very small fraction. */ if (tuple_fraction >= 1.0) tuple_fraction = 0.0; @@ -297,8 +296,8 @@ subquery_planner(PlannerGlobal *glob, Query *parse, root->non_recursive_plan = NULL; /* - * If there is a WITH list, process each WITH query and build an - * initplan SubPlan structure for it. + * If there is a WITH list, process each WITH query and build an initplan + * SubPlan structure for it. */ if (parse->cteList) SS_process_ctes(root); @@ -313,8 +312,8 @@ subquery_planner(PlannerGlobal *glob, Query *parse, pull_up_sublinks(root); /* - * Scan the rangetable for set-returning functions, and inline them - * if possible (producing subqueries that might get pulled up next). + * Scan the rangetable for set-returning functions, and inline them if + * possible (producing subqueries that might get pulled up next). * Recursion issues here are handled in the same way as for SubLinks. */ inline_set_returning_functions(root); @@ -329,8 +328,8 @@ subquery_planner(PlannerGlobal *glob, Query *parse, /* * Detect whether any rangetable entries are RTE_JOIN kind; if not, we can * avoid the expense of doing flatten_join_alias_vars(). Also check for - * outer joins --- if none, we can skip reduce_outer_joins(). - * This must be done after we have done pull_up_subqueries, of course. + * outer joins --- if none, we can skip reduce_outer_joins(). This must be + * done after we have done pull_up_subqueries, of course. */ root->hasJoinRTEs = false; hasOuterJoins = false; @@ -528,7 +527,7 @@ preprocess_expression(PlannerInfo *root, Node *expr, int kind) * Simplify constant expressions. * * Note: one essential effect here is to insert the current actual values - * of any default arguments for functions. To ensure that happens, we + * of any default arguments for functions. To ensure that happens, we * *must* process all expressions here. Previous PG versions sometimes * skipped const-simplification if it didn't seem worth the trouble, but * we can't do that anymore. @@ -797,8 +796,8 @@ grouping_planner(PlannerInfo *root, double tuple_fraction) /* * If there's a top-level ORDER BY, assume we have to fetch all the * tuples. This might be too simplistic given all the hackery below - * to possibly avoid the sort; but the odds of accurate estimates - * here are pretty low anyway. + * to possibly avoid the sort; but the odds of accurate estimates here + * are pretty low anyway. */ if (parse->sortClause) tuple_fraction = 0.0; @@ -908,9 +907,9 @@ grouping_planner(PlannerInfo *root, double tuple_fraction) /* * Calculate pathkeys that represent grouping/ordering requirements. * Stash them in PlannerInfo so that query_planner can canonicalize - * them after EquivalenceClasses have been formed. The sortClause - * is certainly sort-able, but GROUP BY and DISTINCT might not be, - * in which case we just leave their pathkeys empty. + * them after EquivalenceClasses have been formed. The sortClause is + * certainly sort-able, but GROUP BY and DISTINCT might not be, in + * which case we just leave their pathkeys empty. */ if (parse->groupClause && grouping_is_sortable(parse->groupClause)) @@ -982,7 +981,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction) * Note: if we have both ORDER BY and GROUP BY, and ORDER BY is a * superset of GROUP BY, it would be tempting to request sort by ORDER * BY --- but that might just leave us failing to exploit an available - * sort order at all. Needs more thought. The choice for DISTINCT + * sort order at all. Needs more thought. The choice for DISTINCT * versus ORDER BY is much easier, since we know that the parser * ensured that one is a superset of the other. */ @@ -1012,12 +1011,12 @@ grouping_planner(PlannerInfo *root, double tuple_fraction) */ if (parse->groupClause) { - bool can_hash; - bool can_sort; + bool can_hash; + bool can_sort; /* * Executor doesn't support hashed aggregation with DISTINCT - * aggregates. (Doing so would imply storing *all* the input + * aggregates. (Doing so would imply storing *all* the input * values in the hash table, which seems like a certain loser.) */ can_hash = (agg_counts.numDistinctAggs == 0 && @@ -1079,16 +1078,17 @@ grouping_planner(PlannerInfo *root, double tuple_fraction) * Normal case --- create a plan according to query_planner's * results. */ - bool need_sort_for_grouping = false; + bool need_sort_for_grouping = false; result_plan = create_plan(root, best_path); current_pathkeys = best_path->pathkeys; /* Detect if we'll need an explicit sort for grouping */ if (parse->groupClause && !use_hashed_grouping && - !pathkeys_contained_in(root->group_pathkeys, current_pathkeys)) + !pathkeys_contained_in(root->group_pathkeys, current_pathkeys)) { need_sort_for_grouping = true; + /* * Always override query_planner's tlist, so that we don't * sort useless data from a "physical" tlist. @@ -1275,9 +1275,9 @@ grouping_planner(PlannerInfo *root, double tuple_fraction) } /* end of non-minmax-aggregate case */ /* - * Since each window function could require a different sort order, - * we stack up a WindowAgg node for each window, with sort steps - * between them as needed. + * Since each window function could require a different sort order, we + * stack up a WindowAgg node for each window, with sort steps between + * them as needed. */ if (activeWindows) { @@ -1286,12 +1286,12 @@ grouping_planner(PlannerInfo *root, double tuple_fraction) /* * If the top-level plan node is one that cannot do expression - * evaluation, we must insert a Result node to project the - * desired tlist. (In some cases this might not really be - * required, but it's not worth trying to avoid it.) Note that - * on second and subsequent passes through the following loop, - * the top-level node will be a WindowAgg which we know can - * project; so we only need to check once. + * evaluation, we must insert a Result node to project the desired + * tlist. (In some cases this might not really be required, but + * it's not worth trying to avoid it.) Note that on second and + * subsequent passes through the following loop, the top-level + * node will be a WindowAgg which we know can project; so we only + * need to check once. */ if (!is_projection_capable_plan(result_plan)) { @@ -1302,21 +1302,20 @@ grouping_planner(PlannerInfo *root, double tuple_fraction) } /* - * The "base" targetlist for all steps of the windowing process - * is a flat tlist of all Vars and Aggs needed in the result. - * (In some cases we wouldn't need to propagate all of these - * all the way to the top, since they might only be needed as - * inputs to WindowFuncs. It's probably not worth trying to - * optimize that though.) We also need any volatile sort - * expressions, because make_sort_from_pathkeys won't add those - * on its own, and anyway we want them evaluated only once at - * the bottom of the stack. As we climb up the stack, we add - * outputs for the WindowFuncs computed at each level. Also, - * each input tlist has to present all the columns needed to - * sort the data for the next WindowAgg step. That's handled - * internally by make_sort_from_pathkeys, but we need the - * copyObject steps here to ensure that each plan node has - * a separately modifiable tlist. + * The "base" targetlist for all steps of the windowing process is + * a flat tlist of all Vars and Aggs needed in the result. (In + * some cases we wouldn't need to propagate all of these all the + * way to the top, since they might only be needed as inputs to + * WindowFuncs. It's probably not worth trying to optimize that + * though.) We also need any volatile sort expressions, because + * make_sort_from_pathkeys won't add those on its own, and anyway + * we want them evaluated only once at the bottom of the stack. + * As we climb up the stack, we add outputs for the WindowFuncs + * computed at each level. Also, each input tlist has to present + * all the columns needed to sort the data for the next WindowAgg + * step. That's handled internally by make_sort_from_pathkeys, + * but we need the copyObject steps here to ensure that each plan + * node has a separately modifiable tlist. */ window_tlist = flatten_tlist(tlist); if (parse->hasAggs) @@ -1392,7 +1391,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction) { /* Add the current WindowFuncs to the running tlist */ window_tlist = add_to_flat_tlist(window_tlist, - wflists->windowFuncs[wc->winref]); + wflists->windowFuncs[wc->winref]); } else { @@ -1404,7 +1403,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction) result_plan = (Plan *) make_windowagg(root, (List *) copyObject(window_tlist), - list_length(wflists->windowFuncs[wc->winref]), + list_length(wflists->windowFuncs[wc->winref]), wc->winref, partNumCols, partColIdx, @@ -1423,11 +1422,11 @@ grouping_planner(PlannerInfo *root, double tuple_fraction) */ if (parse->distinctClause) { - double dNumDistinctRows; - long numDistinctRows; - bool use_hashed_distinct; - bool can_sort; - bool can_hash; + double dNumDistinctRows; + long numDistinctRows; + bool use_hashed_distinct; + bool can_sort; + bool can_hash; /* * If there was grouping or aggregation, use the current number of @@ -1472,7 +1471,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction) (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("could not implement DISTINCT"), errdetail("Some of the datatypes only support hashing, while others only support sorting."))); - use_hashed_distinct = false; /* keep compiler quiet */ + use_hashed_distinct = false; /* keep compiler quiet */ } } @@ -1483,10 +1482,10 @@ grouping_planner(PlannerInfo *root, double tuple_fraction) result_plan->targetlist, NIL, AGG_HASHED, - list_length(parse->distinctClause), - extract_grouping_cols(parse->distinctClause, - result_plan->targetlist), - extract_grouping_ops(parse->distinctClause), + list_length(parse->distinctClause), + extract_grouping_cols(parse->distinctClause, + result_plan->targetlist), + extract_grouping_ops(parse->distinctClause), numDistinctRows, 0, result_plan); @@ -1502,11 +1501,11 @@ grouping_planner(PlannerInfo *root, double tuple_fraction) * rigorous of DISTINCT and ORDER BY, to avoid a second sort * below. However, for regular DISTINCT, don't sort now if we * don't have to --- sorting afterwards will likely be cheaper, - * and also has the possibility of optimizing via LIMIT. But - * for DISTINCT ON, we *must* force the final sort now, else - * it won't have the desired behavior. + * and also has the possibility of optimizing via LIMIT. But for + * DISTINCT ON, we *must* force the final sort now, else it won't + * have the desired behavior. */ - List *needed_pathkeys; + List *needed_pathkeys; if (parse->hasDistinctOn && list_length(root->distinct_pathkeys) < @@ -1530,7 +1529,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction) result_plan = (Plan *) make_sort_from_pathkeys(root, result_plan, - current_pathkeys, + current_pathkeys, -1.0); } @@ -1551,7 +1550,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction) { result_plan = (Plan *) make_sort_from_pathkeys(root, result_plan, - root->sort_pathkeys, + root->sort_pathkeys, limit_tuples); current_pathkeys = root->sort_pathkeys; } @@ -1883,12 +1882,12 @@ preprocess_groupclause(PlannerInfo *root) return; /* - * Add any remaining GROUP BY items to the new list, but only if we - * were able to make a complete match. In other words, we only - * rearrange the GROUP BY list if the result is that one list is a - * prefix of the other --- otherwise there's no possibility of a - * common sort. Also, give up if there are any non-sortable GROUP BY - * items, since then there's no hope anyway. + * Add any remaining GROUP BY items to the new list, but only if we were + * able to make a complete match. In other words, we only rearrange the + * GROUP BY list if the result is that one list is a prefix of the other + * --- otherwise there's no possibility of a common sort. Also, give up + * if there are any non-sortable GROUP BY items, since then there's no + * hope anyway. */ foreach(gl, parse->groupClause) { @@ -1962,11 +1961,10 @@ choose_hashed_grouping(PlannerInfo *root, /* * When we have both GROUP BY and DISTINCT, use the more-rigorous of - * DISTINCT and ORDER BY as the assumed required output sort order. - * This is an oversimplification because the DISTINCT might get - * implemented via hashing, but it's not clear that the case is common - * enough (or that our estimates are good enough) to justify trying to - * solve it exactly. + * DISTINCT and ORDER BY as the assumed required output sort order. This + * is an oversimplification because the DISTINCT might get implemented via + * hashing, but it's not clear that the case is common enough (or that our + * estimates are good enough) to justify trying to solve it exactly. */ if (list_length(root->distinct_pathkeys) > list_length(root->sort_pathkeys)) @@ -2056,7 +2054,7 @@ choose_hashed_grouping(PlannerInfo *root, * differences that it doesn't seem worth trying to unify the two functions. * * But note that making the two choices independently is a bit bogus in - * itself. If the two could be combined into a single choice operation + * itself. If the two could be combined into a single choice operation * it'd probably be better, but that seems far too unwieldy to be practical, * especially considering that the combination of GROUP BY and DISTINCT * isn't very common in real queries. By separating them, we are giving @@ -2098,8 +2096,8 @@ choose_hashed_distinct(PlannerInfo *root, * comparison. * * We need to consider input_plan + hashagg [+ final sort] versus - * input_plan [+ sort] + group [+ final sort] where brackets indicate - * a step that may not be needed. + * input_plan [+ sort] + group [+ final sort] where brackets indicate a + * step that may not be needed. * * These path variables are dummies that just hold cost fields; we don't * make actual Paths for these steps. @@ -2108,16 +2106,17 @@ choose_hashed_distinct(PlannerInfo *root, numDistinctCols, dNumDistinctRows, input_plan->startup_cost, input_plan->total_cost, input_plan->plan_rows); + /* - * Result of hashed agg is always unsorted, so if ORDER BY is present - * we need to charge for the final sort. + * Result of hashed agg is always unsorted, so if ORDER BY is present we + * need to charge for the final sort. */ if (root->parse->sortClause) cost_sort(&hashed_p, root, root->sort_pathkeys, hashed_p.total_cost, dNumDistinctRows, input_plan->plan_width, limit_tuples); /* - * Now for the GROUP case. See comments in grouping_planner about the + * Now for the GROUP case. See comments in grouping_planner about the * sorting choices here --- this code should match that code. */ sorted_p.startup_cost = input_plan->startup_cost; @@ -2398,10 +2397,10 @@ select_active_windows(PlannerInfo *root, WindowFuncLists *wflists) * are otherwise distinct (eg, different names or framing clauses). * * There is room to be much smarter here, for example detecting whether - * one window's sort keys are a prefix of another's (so that sorting - * for the latter would do for the former), or putting windows first - * that match a sort order available for the underlying query. For the - * moment we are content with meeting the spec. + * one window's sort keys are a prefix of another's (so that sorting for + * the latter would do for the former), or putting windows first that + * match a sort order available for the underlying query. For the moment + * we are content with meeting the spec. */ result = NIL; while (actives != NIL) @@ -2469,12 +2468,12 @@ add_volatile_sort_exprs(List *window_tlist, List *tlist, List *activeWindows) } /* - * Now scan the original tlist to find the referenced expressions. - * Any that are volatile must be added to window_tlist. + * Now scan the original tlist to find the referenced expressions. Any + * that are volatile must be added to window_tlist. * - * Note: we know that the input window_tlist contains no items marked - * with ressortgrouprefs, so we don't have to worry about collisions - * of the reference numbers. + * Note: we know that the input window_tlist contains no items marked with + * ressortgrouprefs, so we don't have to worry about collisions of the + * reference numbers. */ foreach(lc, tlist) { @@ -2524,7 +2523,7 @@ make_pathkeys_for_window(PlannerInfo *root, WindowClause *wc, ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("could not implement window ORDER BY"), - errdetail("Window ordering columns must be of sortable datatypes."))); + errdetail("Window ordering columns must be of sortable datatypes."))); /* Okay, make the combined pathkeys */ window_sortclauses = list_concat(list_copy(wc->partitionClause), @@ -2545,7 +2544,7 @@ make_pathkeys_for_window(PlannerInfo *root, WindowClause *wc, * This depends on the behavior of make_pathkeys_for_window()! * * We are given the target WindowClause and an array of the input column - * numbers associated with the resulting pathkeys. In the easy case, there + * numbers associated with the resulting pathkeys. In the easy case, there * are the same number of pathkey columns as partitioning + ordering columns * and we just have to copy some data around. However, it's possible that * some of the original partitioning + ordering columns were eliminated as @@ -2553,11 +2552,11 @@ make_pathkeys_for_window(PlannerInfo *root, WindowClause *wc, * though the parser gets rid of obvious duplicates. A typical scenario is a * window specification "PARTITION BY x ORDER BY y" coupled with a clause * "WHERE x = y" that causes the two sort columns to be recognized as - * redundant.) In that unusual case, we have to work a lot harder to + * redundant.) In that unusual case, we have to work a lot harder to * determine which keys are significant. * * The method used here is a bit brute-force: add the sort columns to a list - * one at a time and note when the resulting pathkey list gets longer. But + * one at a time and note when the resulting pathkey list gets longer. But * it's a sufficiently uncommon case that a faster way doesn't seem worth * the amount of code refactoring that'd be needed. *---------- @@ -2659,7 +2658,7 @@ get_column_info_for_window(PlannerInfo *root, WindowClause *wc, List *tlist, * Currently, we disallow sublinks in standalone expressions, so there's no * real "planning" involved here. (That might not always be true though.) * What we must do is run eval_const_expressions to ensure that any function - * default arguments get inserted. The fact that constant subexpressions + * default arguments get inserted. The fact that constant subexpressions * get simplified is a side-effect that is useful when the expression will * get evaluated more than once. Also, we must fix operator function IDs. * diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c index 17016d5f3b..11e14f96c5 100644 --- a/src/backend/optimizer/plan/setrefs.c +++ b/src/backend/optimizer/plan/setrefs.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.149 2009/01/22 20:16:04 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.150 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -116,7 +116,7 @@ static Node *fix_upper_expr_mutator(Node *node, fix_upper_expr_context *context); static bool fix_opfuncids_walker(Node *node, void *context); static bool extract_query_dependencies_walker(Node *node, - PlannerGlobal *context); + PlannerGlobal *context); /***************************************************************************** @@ -349,7 +349,7 @@ set_plan_refs(PlannerGlobal *glob, Plan *plan, int rtoffset) break; case T_CteScan: { - CteScan *splan = (CteScan *) plan; + CteScan *splan = (CteScan *) plan; splan->scan.scanrelid += rtoffset; splan->scan.plan.targetlist = @@ -713,13 +713,13 @@ fix_expr_common(PlannerGlobal *glob, Node *node) { set_sa_opfuncid((ScalarArrayOpExpr *) node); record_plan_function_dependency(glob, - ((ScalarArrayOpExpr *) node)->opfuncid); + ((ScalarArrayOpExpr *) node)->opfuncid); } else if (IsA(node, ArrayCoerceExpr)) { if (OidIsValid(((ArrayCoerceExpr *) node)->elemfuncid)) record_plan_function_dependency(glob, - ((ArrayCoerceExpr *) node)->elemfuncid); + ((ArrayCoerceExpr *) node)->elemfuncid); } else if (IsA(node, Const)) { @@ -759,8 +759,8 @@ fix_scan_expr(PlannerGlobal *glob, Node *node, int rtoffset) * If rtoffset == 0, we don't need to change any Vars, and if there * are no placeholders anywhere we won't need to remove them. Then * it's OK to just scribble on the input node tree instead of copying - * (since the only change, filling in any unset opfuncid fields, - * is harmless). This saves just enough cycles to be noticeable on + * (since the only change, filling in any unset opfuncid fields, is + * harmless). This saves just enough cycles to be noticeable on * trivial queries. */ (void) fix_scan_expr_walker(node, &context); @@ -1633,11 +1633,11 @@ set_returning_clause_references(PlannerGlobal *glob, * entries, while leaving result-rel Vars as-is. * * PlaceHolderVars will also be sought in the targetlist, but no - * more-complex expressions will be. Note that it is not possible for - * a PlaceHolderVar to refer to the result relation, since the result - * is never below an outer join. If that case could happen, we'd have - * to be prepared to pick apart the PlaceHolderVar and evaluate its - * contained expression instead. + * more-complex expressions will be. Note that it is not possible for a + * PlaceHolderVar to refer to the result relation, since the result is + * never below an outer join. If that case could happen, we'd have to be + * prepared to pick apart the PlaceHolderVar and evaluate its contained + * expression instead. */ itlist = build_tlist_index_other_vars(topplan->targetlist, resultRelation); @@ -1734,8 +1734,8 @@ record_plan_function_dependency(PlannerGlobal *glob, Oid funcid) * we just assume they'll never change (or at least not in ways that'd * invalidate plans using them). For this purpose we can consider a * built-in function to be one with OID less than FirstBootstrapObjectId. - * Note that the OID generator guarantees never to generate such an - * OID after startup, even at OID wraparound. + * Note that the OID generator guarantees never to generate such an OID + * after startup, even at OID wraparound. */ if (funcid >= (Oid) FirstBootstrapObjectId) { diff --git a/src/backend/optimizer/plan/subselect.c b/src/backend/optimizer/plan/subselect.c index 6839e5d99b..cdff123828 100644 --- a/src/backend/optimizer/plan/subselect.c +++ b/src/backend/optimizer/plan/subselect.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/plan/subselect.c,v 1.149 2009/04/25 16:44:56 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/plan/subselect.c,v 1.150 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -56,9 +56,9 @@ static Node *build_subplan(PlannerInfo *root, Plan *plan, List *rtable, SubLinkType subLinkType, Node *testexpr, bool adjust_testexpr, bool unknownEqFalse); static List *generate_subquery_params(PlannerInfo *root, List *tlist, - List **paramIds); + List **paramIds); static List *generate_subquery_vars(PlannerInfo *root, List *tlist, - Index varno); + Index varno); static Node *convert_testexpr(PlannerInfo *root, Node *testexpr, List *subst_nodes); @@ -308,7 +308,7 @@ make_subplan(PlannerInfo *root, Query *orig_subquery, SubLinkType subLinkType, * path/costsize.c. * * XXX If an ANY subplan is uncorrelated, build_subplan may decide to hash - * its output. In that case it would've been better to specify full + * its output. In that case it would've been better to specify full * retrieval. At present, however, we can only check hashability after * we've made the subplan :-(. (Determining whether it'll fit in work_mem * is the really hard part.) Therefore, we don't want to be too @@ -338,11 +338,11 @@ make_subplan(PlannerInfo *root, Query *orig_subquery, SubLinkType subLinkType, /* * If it's a correlated EXISTS with an unimportant targetlist, we might be * able to transform it to the equivalent of an IN and then implement it - * by hashing. We don't have enough information yet to tell which way - * is likely to be better (it depends on the expected number of executions - * of the EXISTS qual, and we are much too early in planning the outer - * query to be able to guess that). So we generate both plans, if - * possible, and leave it to the executor to decide which to use. + * by hashing. We don't have enough information yet to tell which way is + * likely to be better (it depends on the expected number of executions of + * the EXISTS qual, and we are much too early in planning the outer query + * to be able to guess that). So we generate both plans, if possible, and + * leave it to the executor to decide which to use. */ if (simple_exists && IsA(result, SubPlan)) { @@ -368,7 +368,7 @@ make_subplan(PlannerInfo *root, Query *orig_subquery, SubLinkType subLinkType, /* Now we can check if it'll fit in work_mem */ if (subplan_is_hashable(plan)) { - SubPlan *hashplan; + SubPlan *hashplan; AlternativeSubPlan *asplan; /* OK, convert to SubPlan format. */ @@ -437,7 +437,7 @@ build_subplan(PlannerInfo *root, Plan *plan, List *rtable, if (pitem->abslevel == root->query_level) { - Node *arg; + Node *arg; /* * The Var or Aggref has already been adjusted to have the correct @@ -447,8 +447,8 @@ build_subplan(PlannerInfo *root, Plan *plan, List *rtable, arg = copyObject(pitem->item); /* - * If it's an Aggref, its arguments might contain SubLinks, - * which have not yet been processed. Do that now. + * If it's an Aggref, its arguments might contain SubLinks, which + * have not yet been processed. Do that now. */ if (IsA(arg, Aggref)) arg = SS_process_sublinks(root, arg, false); @@ -714,7 +714,7 @@ generate_subquery_vars(PlannerInfo *root, List *tlist, Index varno) /* * convert_testexpr: convert the testexpr given by the parser into * actually executable form. This entails replacing PARAM_SUBLINK Params - * with Params or Vars representing the results of the sub-select. The + * with Params or Vars representing the results of the sub-select. The * nodes to be substituted are passed in as the List result from * generate_subquery_params or generate_subquery_vars. * @@ -794,8 +794,8 @@ static bool testexpr_is_hashable(Node *testexpr) { /* - * The testexpr must be a single OpExpr, or an AND-clause containing - * only OpExprs. + * The testexpr must be a single OpExpr, or an AND-clause containing only + * OpExprs. * * The combining operators must be hashable and strict. The need for * hashability is obvious, since we want to use hashing. Without @@ -892,8 +892,8 @@ SS_process_ctes(PlannerInfo *root) } /* - * Copy the source Query node. Probably not necessary, but let's - * keep this similar to make_subplan. + * Copy the source Query node. Probably not necessary, but let's keep + * this similar to make_subplan. */ subquery = (Query *) copyObject(cte->ctequery); @@ -907,7 +907,7 @@ SS_process_ctes(PlannerInfo *root) &subroot); /* - * Make a SubPlan node for it. This is just enough unlike + * Make a SubPlan node for it. This is just enough unlike * build_subplan that we can't share code. * * Note plan_id, plan_name, and cost fields are set further down. @@ -925,8 +925,8 @@ SS_process_ctes(PlannerInfo *root) /* * Make parParam and args lists of param IDs and expressions that - * current query level will pass to this child plan. Even though - * this is an initplan, there could be side-references to earlier + * current query level will pass to this child plan. Even though this + * is an initplan, there could be side-references to earlier * initplan's outputs, specifically their CTE output parameters. */ tmpset = bms_copy(plan->extParam); @@ -948,8 +948,8 @@ SS_process_ctes(PlannerInfo *root) bms_free(tmpset); /* - * Assign a param to represent the query output. We only really - * care about reserving a parameter ID number. + * Assign a param to represent the query output. We only really care + * about reserving a parameter ID number. */ prm = generate_new_param(root, INTERNALOID, -1); splan->setParam = list_make1_int(prm->paramid); @@ -1028,9 +1028,9 @@ convert_ANY_sublink_to_join(PlannerInfo *root, SubLink *sublink, return NULL; /* - * The test expression must contain some Vars of the parent query, - * else it's not gonna be a join. (Note that it won't have Vars - * referring to the subquery, rather Params.) + * The test expression must contain some Vars of the parent query, else + * it's not gonna be a join. (Note that it won't have Vars referring to + * the subquery, rather Params.) */ upper_varnos = pull_varnos(sublink->testexpr); if (bms_is_empty(upper_varnos)) @@ -1126,10 +1126,10 @@ convert_EXISTS_sublink_to_join(PlannerInfo *root, SubLink *sublink, subselect = (Query *) copyObject(subselect); /* - * See if the subquery can be simplified based on the knowledge that - * it's being used in EXISTS(). If we aren't able to get rid of its - * targetlist, we have to fail, because the pullup operation leaves - * us with noplace to evaluate the targetlist. + * See if the subquery can be simplified based on the knowledge that it's + * being used in EXISTS(). If we aren't able to get rid of its + * targetlist, we have to fail, because the pullup operation leaves us + * with noplace to evaluate the targetlist. */ if (!simplify_EXISTS_query(subselect)) return NULL; @@ -1175,13 +1175,13 @@ convert_EXISTS_sublink_to_join(PlannerInfo *root, SubLink *sublink, * to the inner (necessarily true). Therefore this is a lot easier than * what pull_up_subqueries has to go through. * - * In fact, it's even easier than what convert_ANY_sublink_to_join has - * to do. The machinations of simplify_EXISTS_query ensured that there - * is nothing interesting in the subquery except an rtable and jointree, - * and even the jointree FromExpr no longer has quals. So we can just - * append the rtable to our own and use the FromExpr in our jointree. - * But first, adjust all level-zero varnos in the subquery to account - * for the rtable merger. + * In fact, it's even easier than what convert_ANY_sublink_to_join has to + * do. The machinations of simplify_EXISTS_query ensured that there is + * nothing interesting in the subquery except an rtable and jointree, and + * even the jointree FromExpr no longer has quals. So we can just append + * the rtable to our own and use the FromExpr in our jointree. But first, + * adjust all level-zero varnos in the subquery to account for the rtable + * merger. */ rtoffset = list_length(parse->rtable); OffsetVarNodes((Node *) subselect, rtoffset, 0); @@ -1198,8 +1198,8 @@ convert_EXISTS_sublink_to_join(PlannerInfo *root, SubLink *sublink, /* * Now that the WHERE clause is adjusted to match the parent query * environment, we can easily identify all the level-zero rels it uses. - * The ones <= rtoffset belong to the upper query; the ones > rtoffset - * do not. + * The ones <= rtoffset belong to the upper query; the ones > rtoffset do + * not. */ clause_varnos = pull_varnos(whereClause); upper_varnos = NULL; @@ -1212,8 +1212,8 @@ convert_EXISTS_sublink_to_join(PlannerInfo *root, SubLink *sublink, Assert(!bms_is_empty(upper_varnos)); /* - * Now that we've got the set of upper-level varnos, we can make the - * last check: only available_rels can be referenced. + * Now that we've got the set of upper-level varnos, we can make the last + * check: only available_rels can be referenced. */ if (!bms_is_subset(upper_varnos, available_rels)) return NULL; @@ -1308,7 +1308,7 @@ simplify_EXISTS_query(Query *query) * * On success, the modified subselect is returned, and we store a suitable * upper-level test expression at *testexpr, plus a list of the subselect's - * output Params at *paramIds. (The test expression is already Param-ified + * output Params at *paramIds. (The test expression is already Param-ified * and hence need not go through convert_testexpr, which is why we have to * deal with the Param IDs specially.) * @@ -1365,32 +1365,32 @@ convert_EXISTS_to_ANY(PlannerInfo *root, Query *subselect, /* * Clean up the WHERE clause by doing const-simplification etc on it. * Aside from simplifying the processing we're about to do, this is - * important for being able to pull chunks of the WHERE clause up into - * the parent query. Since we are invoked partway through the parent's + * important for being able to pull chunks of the WHERE clause up into the + * parent query. Since we are invoked partway through the parent's * preprocess_expression() work, earlier steps of preprocess_expression() - * wouldn't get applied to the pulled-up stuff unless we do them here. - * For the parts of the WHERE clause that get put back into the child - * query, this work is partially duplicative, but it shouldn't hurt. + * wouldn't get applied to the pulled-up stuff unless we do them here. For + * the parts of the WHERE clause that get put back into the child query, + * this work is partially duplicative, but it shouldn't hurt. * - * Note: we do not run flatten_join_alias_vars. This is OK because - * any parent aliases were flattened already, and we're not going to - * pull any child Vars (of any description) into the parent. + * Note: we do not run flatten_join_alias_vars. This is OK because any + * parent aliases were flattened already, and we're not going to pull any + * child Vars (of any description) into the parent. * - * Note: passing the parent's root to eval_const_expressions is technically - * wrong, but we can get away with it since only the boundParams (if any) - * are used, and those would be the same in a subroot. + * Note: passing the parent's root to eval_const_expressions is + * technically wrong, but we can get away with it since only the + * boundParams (if any) are used, and those would be the same in a + * subroot. */ whereClause = eval_const_expressions(root, whereClause); whereClause = (Node *) canonicalize_qual((Expr *) whereClause); whereClause = (Node *) make_ands_implicit((Expr *) whereClause); /* - * We now have a flattened implicit-AND list of clauses, which we - * try to break apart into "outervar = innervar" hash clauses. - * Anything that can't be broken apart just goes back into the - * newWhere list. Note that we aren't trying hard yet to ensure - * that we have only outer or only inner on each side; we'll check - * that if we get to the end. + * We now have a flattened implicit-AND list of clauses, which we try to + * break apart into "outervar = innervar" hash clauses. Anything that + * can't be broken apart just goes back into the newWhere list. Note that + * we aren't trying hard yet to ensure that we have only outer or only + * inner on each side; we'll check that if we get to the end. */ leftargs = rightargs = opids = newWhere = NIL; foreach(lc, (List *) whereClause) @@ -1400,8 +1400,8 @@ convert_EXISTS_to_ANY(PlannerInfo *root, Query *subselect, if (IsA(expr, OpExpr) && hash_ok_operator(expr)) { - Node *leftarg = (Node *) linitial(expr->args); - Node *rightarg = (Node *) lsecond(expr->args); + Node *leftarg = (Node *) linitial(expr->args); + Node *rightarg = (Node *) lsecond(expr->args); if (contain_vars_of_level(leftarg, 1)) { @@ -1459,15 +1459,15 @@ convert_EXISTS_to_ANY(PlannerInfo *root, Query *subselect, /* * And there can't be any child Vars in the stuff we intend to pull up. - * (Note: we'd need to check for child Aggs too, except we know the - * child has no aggs at all because of simplify_EXISTS_query's check. - * The same goes for window functions.) + * (Note: we'd need to check for child Aggs too, except we know the child + * has no aggs at all because of simplify_EXISTS_query's check. The same + * goes for window functions.) */ if (contain_vars_of_level((Node *) leftargs, 0)) return NULL; /* - * Also reject sublinks in the stuff we intend to pull up. (It might be + * Also reject sublinks in the stuff we intend to pull up. (It might be * possible to support this, but doesn't seem worth the complication.) */ if (contain_subplans((Node *) leftargs)) @@ -1485,11 +1485,10 @@ convert_EXISTS_to_ANY(PlannerInfo *root, Query *subselect, subselect->jointree->quals = (Node *) make_ands_explicit(newWhere); /* - * Build a new targetlist for the child that emits the expressions - * we need. Concurrently, build a testexpr for the parent using - * Params to reference the child outputs. (Since we generate Params - * directly here, there will be no need to convert the testexpr in - * build_subplan.) + * Build a new targetlist for the child that emits the expressions we + * need. Concurrently, build a testexpr for the parent using Params to + * reference the child outputs. (Since we generate Params directly here, + * there will be no need to convert the testexpr in build_subplan.) */ tlist = testlist = paramids = NIL; resno = 1; @@ -1625,10 +1624,10 @@ process_sublinks_mutator(Node *node, process_sublinks_context *context) } /* - * Don't recurse into the arguments of an outer aggregate here. - * Any SubLinks in the arguments have to be dealt with at the outer - * query level; they'll be handled when build_subplan collects the - * Aggref into the arguments to be passed down to the current subplan. + * Don't recurse into the arguments of an outer aggregate here. Any + * SubLinks in the arguments have to be dealt with at the outer query + * level; they'll be handled when build_subplan collects the Aggref into + * the arguments to be passed down to the current subplan. */ if (IsA(node, Aggref)) { @@ -1655,7 +1654,7 @@ process_sublinks_mutator(Node *node, process_sublinks_context *context) * is needed for a bare List.) * * Anywhere within the top-level AND/OR clause structure, we can tell - * make_subplan() that NULL and FALSE are interchangeable. So isTopQual + * make_subplan() that NULL and FALSE are interchangeable. So isTopQual * propagates down in both cases. (Note that this is unlike the meaning * of "top level qual" used in most other places in Postgres.) */ @@ -1702,8 +1701,8 @@ process_sublinks_mutator(Node *node, process_sublinks_context *context) } /* - * If we recurse down through anything other than an AND or OR node, - * we are definitely not at top qual level anymore. + * If we recurse down through anything other than an AND or OR node, we + * are definitely not at top qual level anymore. */ locContext.isTopQual = false; @@ -1759,8 +1758,8 @@ SS_finalize_plan(PlannerInfo *root, Plan *plan, bool attach_initplans) /* * Now determine the set of params that are validly referenceable in this * query level; to wit, those available from outer query levels plus the - * output parameters of any initPlans. (We do not include output - * parameters of regular subplans. Those should only appear within the + * output parameters of any initPlans. (We do not include output + * parameters of regular subplans. Those should only appear within the * testexpr of SubPlan nodes, and are taken care of locally within * finalize_primnode.) * @@ -1809,7 +1808,7 @@ SS_finalize_plan(PlannerInfo *root, Plan *plan, bool attach_initplans) if (attach_initplans) { plan->initPlan = root->init_plans; - root->init_plans = NIL; /* make sure they're not attached twice */ + root->init_plans = NIL; /* make sure they're not attached twice */ /* allParam must include all these params */ plan->allParam = bms_add_members(plan->allParam, initExtParam); @@ -2043,9 +2042,9 @@ finalize_plan(PlannerInfo *root, Plan *plan, Bitmapset *valid_params) /* * Note: by definition, extParam and allParam should have the same value - * in any plan node that doesn't have child initPlans. We set them - * equal here, and later SS_finalize_plan will update them properly - * in node(s) that it attaches initPlans to. + * in any plan node that doesn't have child initPlans. We set them equal + * here, and later SS_finalize_plan will update them properly in node(s) + * that it attaches initPlans to. * * For speed at execution time, make sure extParam/allParam are actually * NULL if they are empty sets. @@ -2095,7 +2094,7 @@ finalize_primnode(Node *node, finalize_primnode_context *context) /* * Remove any param IDs of output parameters of the subplan that were - * referenced in the testexpr. These are not interesting for + * referenced in the testexpr. These are not interesting for * parameter change signaling since we always re-evaluate the subplan. * Note that this wouldn't work too well if there might be uses of the * same param IDs elsewhere in the plan, but that can't happen because @@ -2167,9 +2166,9 @@ SS_make_initplan_from_plan(PlannerInfo *root, Plan *plan, root->parse->rtable); /* - * Create a SubPlan node and add it to the outer list of InitPlans. - * Note it has to appear after any other InitPlans it might depend on - * (see comments in ExecReScan). + * Create a SubPlan node and add it to the outer list of InitPlans. Note + * it has to appear after any other InitPlans it might depend on (see + * comments in ExecReScan). */ node = makeNode(SubPlan); node->subLinkType = EXPR_SUBLINK; diff --git a/src/backend/optimizer/prep/prepjointree.c b/src/backend/optimizer/prep/prepjointree.c index 3df9d57c1d..fd451b338b 100644 --- a/src/backend/optimizer/prep/prepjointree.c +++ b/src/backend/optimizer/prep/prepjointree.c @@ -16,7 +16,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.65 2009/04/28 21:31:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.66 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -52,16 +52,16 @@ static Node *pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, static Node *pull_up_simple_union_all(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte); static void pull_up_union_leaf_queries(Node *setOp, PlannerInfo *root, - int parentRTindex, Query *setOpQuery, - int childRToffset); + int parentRTindex, Query *setOpQuery, + int childRToffset); static void make_setop_translation_list(Query *query, Index newvarno, - List **translated_vars); + List **translated_vars); static bool is_simple_subquery(Query *subquery); static bool is_simple_union_all(Query *subquery); static bool is_simple_union_all_recurse(Node *setOp, Query *setOpQuery, List *colTypes); static List *insert_targetlist_placeholders(PlannerInfo *root, List *tlist, - int varno, bool wrap_non_vars); + int varno, bool wrap_non_vars); static bool is_safe_append_member(Query *subquery); static void resolvenew_in_jointree(Node *jtnode, int varno, RangeTblEntry *rte, List *subtlist, List *subtlist_with_phvs, @@ -74,7 +74,7 @@ static void reduce_outer_joins_pass2(Node *jtnode, List *nonnullable_vars, List *forced_null_vars); static void substitute_multiple_relids(Node *node, - int varno, Relids subrelids); + int varno, Relids subrelids); static void fix_append_rel_relids(List *append_rel_list, int varno, Relids subrelids); static Node *find_jointree_node_for_rel(Node *jtnode, int relid); @@ -87,7 +87,7 @@ static Node *find_jointree_node_for_rel(Node *jtnode, int relid); * * A clause "foo op ANY (sub-SELECT)" can be processed by pulling the * sub-SELECT up to become a rangetable entry and treating the implied - * comparisons as quals of a semijoin. However, this optimization *only* + * comparisons as quals of a semijoin. However, this optimization *only* * works at the top level of WHERE or a JOIN/ON clause, because we cannot * distinguish whether the ANY ought to return FALSE or NULL in cases * involving NULL inputs. Also, in an outer join's ON clause we can only @@ -104,7 +104,7 @@ static Node *find_jointree_node_for_rel(Node *jtnode, int relid); * transformations if any are found. * * This routine has to run before preprocess_expression(), so the quals - * clauses are not yet reduced to implicit-AND format. That means we need + * clauses are not yet reduced to implicit-AND format. That means we need * to recursively search through explicit AND clauses, which are * probably only binary ANDs. We stop as soon as we hit a non-AND item. */ @@ -162,8 +162,8 @@ pull_up_sublinks_jointree_recurse(PlannerInfo *root, Node *jtnode, /* First, recurse to process children and collect their relids */ foreach(l, f->fromlist) { - Node *newchild; - Relids childrelids; + Node *newchild; + Relids childrelids; newchild = pull_up_sublinks_jointree_recurse(root, lfirst(l), @@ -181,8 +181,8 @@ pull_up_sublinks_jointree_recurse(PlannerInfo *root, Node *jtnode, /* * Note that the result will be either newf, or a stack of JoinExprs - * with newf at the base. We rely on subsequent optimization steps - * to flatten this and rearrange the joins as needed. + * with newf at the base. We rely on subsequent optimization steps to + * flatten this and rearrange the joins as needed. * * Although we could include the pulled-up subqueries in the returned * relids, there's no need since upper quals couldn't refer to their @@ -199,8 +199,8 @@ pull_up_sublinks_jointree_recurse(PlannerInfo *root, Node *jtnode, Node *jtlink; /* - * Make a modifiable copy of join node, but don't bother copying - * its subnodes (yet). + * Make a modifiable copy of join node, but don't bother copying its + * subnodes (yet). */ j = (JoinExpr *) palloc(sizeof(JoinExpr)); memcpy(j, jtnode, sizeof(JoinExpr)); @@ -214,19 +214,19 @@ pull_up_sublinks_jointree_recurse(PlannerInfo *root, Node *jtnode, /* * Now process qual, showing appropriate child relids as available, - * and attach any pulled-up jointree items at the right place. - * In the inner-join case we put new JoinExprs above the existing one - * (much as for a FromExpr-style join). In outer-join cases the - * new JoinExprs must go into the nullable side of the outer join. - * The point of the available_rels machinations is to ensure that we - * only pull up quals for which that's okay. + * and attach any pulled-up jointree items at the right place. In the + * inner-join case we put new JoinExprs above the existing one (much + * as for a FromExpr-style join). In outer-join cases the new + * JoinExprs must go into the nullable side of the outer join. The + * point of the available_rels machinations is to ensure that we only + * pull up quals for which that's okay. * * XXX for the moment, we refrain from pulling up IN/EXISTS clauses - * appearing in LEFT or RIGHT join conditions. Although it is + * appearing in LEFT or RIGHT join conditions. Although it is * semantically valid to do so under the above conditions, we end up * with a query in which the semijoin or antijoin must be evaluated - * below the outer join, which could perform far worse than leaving - * it as a sublink that is executed only for row pairs that meet the + * below the outer join, which could perform far worse than leaving it + * as a sublink that is executed only for row pairs that meet the * other join conditions. Fixing this seems to require considerable * restructuring of the executor, but maybe someday it can happen. * @@ -238,7 +238,7 @@ pull_up_sublinks_jointree_recurse(PlannerInfo *root, Node *jtnode, case JOIN_INNER: j->quals = pull_up_sublinks_qual_recurse(root, j->quals, bms_union(leftrelids, - rightrelids), + rightrelids), &jtlink); break; case JOIN_LEFT: @@ -267,7 +267,7 @@ pull_up_sublinks_jointree_recurse(PlannerInfo *root, Node *jtnode, /* * Although we could include the pulled-up subqueries in the returned * relids, there's no need since upper quals couldn't refer to their - * outputs anyway. But we *do* need to include the join's own rtindex + * outputs anyway. But we *do* need to include the join's own rtindex * because we haven't yet collapsed join alias variables, so upper * levels would mistakenly think they couldn't use references to this * join. @@ -416,7 +416,7 @@ inline_set_returning_functions(PlannerInfo *root) if (rte->rtekind == RTE_FUNCTION) { - Query *funcquery; + Query *funcquery; /* Check safety of expansion, and expand if possible */ funcquery = inline_set_returning_function(root, rte); @@ -495,10 +495,10 @@ pull_up_subqueries(PlannerInfo *root, Node *jtnode, * Alternatively, is it a simple UNION ALL subquery? If so, flatten * into an "append relation". * - * It's safe to do this regardless of whether this query is - * itself an appendrel member. (If you're thinking we should try to - * flatten the two levels of appendrel together, you're right; but we - * handle that in set_append_rel_pathlist, not here.) + * It's safe to do this regardless of whether this query is itself an + * appendrel member. (If you're thinking we should try to flatten the + * two levels of appendrel together, you're right; but we handle that + * in set_append_rel_pathlist, not here.) */ if (rte->rtekind == RTE_SUBQUERY && is_simple_union_all(rte->subquery)) @@ -637,10 +637,10 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte, * pull_up_subqueries' processing is complete for its jointree and * rangetable. * - * Note: we should pass NULL for containing-join info even if we are within - * an outer join in the upper query; the lower query starts with a clean - * slate for outer-join semantics. Likewise, we say we aren't handling an - * appendrel member. + * Note: we should pass NULL for containing-join info even if we are + * within an outer join in the upper query; the lower query starts with a + * clean slate for outer-join semantics. Likewise, we say we aren't + * handling an appendrel member. */ subquery->jointree = (FromExpr *) pull_up_subqueries(subroot, (Node *) subquery->jointree, NULL, NULL); @@ -673,8 +673,8 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte, /* * Adjust level-0 varnos in subquery so that we can append its rangetable - * to upper query's. We have to fix the subquery's append_rel_list - * as well. + * to upper query's. We have to fix the subquery's append_rel_list as + * well. */ rtoffset = list_length(parse->rtable); OffsetVarNodes((Node *) subquery, rtoffset, 0); @@ -691,15 +691,15 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte, * The subquery's targetlist items are now in the appropriate form to * insert into the top query, but if we are under an outer join then * non-nullable items may have to be turned into PlaceHolderVars. If we - * are dealing with an appendrel member then anything that's not a - * simple Var has to be turned into a PlaceHolderVar. + * are dealing with an appendrel member then anything that's not a simple + * Var has to be turned into a PlaceHolderVar. */ subtlist = subquery->targetList; if (lowest_outer_join != NULL || containing_appendrel != NULL) subtlist_with_phvs = insert_targetlist_placeholders(root, subtlist, varno, - containing_appendrel != NULL); + containing_appendrel != NULL); else subtlist_with_phvs = subtlist; @@ -709,7 +709,7 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte, * replace any of the jointree structure. (This'd be a lot cleaner if we * could use query_tree_mutator.) We have to use PHVs in the targetList, * returningList, and havingQual, since those are certainly above any - * outer join. resolvenew_in_jointree tracks its location in the jointree + * outer join. resolvenew_in_jointree tracks its location in the jointree * and uses PHVs or not appropriately. */ parse->targetList = (List *) @@ -730,11 +730,11 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte, subtlist_with_phvs, CMD_SELECT, 0); /* - * Replace references in the translated_vars lists of appendrels. - * When pulling up an appendrel member, we do not need PHVs in the list - * of the parent appendrel --- there isn't any outer join between. - * Elsewhere, use PHVs for safety. (This analysis could be made tighter - * but it seems unlikely to be worth much trouble.) + * Replace references in the translated_vars lists of appendrels. When + * pulling up an appendrel member, we do not need PHVs in the list of the + * parent appendrel --- there isn't any outer join between. Elsewhere, use + * PHVs for safety. (This analysis could be made tighter but it seems + * unlikely to be worth much trouble.) */ foreach(lc, root->append_rel_list) { @@ -753,9 +753,9 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte, * * You might think that we could avoid using PHVs for alias vars of joins * below lowest_outer_join, but that doesn't work because the alias vars - * could be referenced above that join; we need the PHVs to be present - * in such references after the alias vars get flattened. (It might be - * worth trying to be smarter here, someday.) + * could be referenced above that join; we need the PHVs to be present in + * such references after the alias vars get flattened. (It might be worth + * trying to be smarter here, someday.) */ foreach(lc, parse->rtable) { @@ -789,9 +789,9 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte, * will be adjusted, so having created them with the subquery's varno is * correct. * - * Likewise, relids appearing in AppendRelInfo nodes have to be fixed. - * We already checked that this won't require introducing multiple - * subrelids into the single-slot AppendRelInfo structs. + * Likewise, relids appearing in AppendRelInfo nodes have to be fixed. We + * already checked that this won't require introducing multiple subrelids + * into the single-slot AppendRelInfo structs. */ if (parse->hasSubLinks || root->glob->lastPHId != 0 || root->append_rel_list) @@ -822,9 +822,10 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte, * Miscellaneous housekeeping. */ parse->hasSubLinks |= subquery->hasSubLinks; + /* - * subquery won't be pulled up if it hasAggs or hasWindowFuncs, so no - * work needed on those flags + * subquery won't be pulled up if it hasAggs or hasWindowFuncs, so no work + * needed on those flags */ /* @@ -859,10 +860,10 @@ pull_up_simple_union_all(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte) /* * Append child RTEs to parent rtable. * - * Upper-level vars in subquery are now one level closer to their - * parent than before. We don't have to worry about offsetting - * varnos, though, because any such vars must refer to stuff above the - * level of the query we are pulling into. + * Upper-level vars in subquery are now one level closer to their parent + * than before. We don't have to worry about offsetting varnos, though, + * because any such vars must refer to stuff above the level of the query + * we are pulling into. */ rtable = copyObject(subquery->rtable); IncrementVarSublevelsUp_rtable(rtable, -1, 1); @@ -1049,11 +1050,11 @@ is_simple_subquery(Query *subquery) * query_planner() will correctly generate a Result plan for a jointree * that's totally empty, but I don't think the right things happen if an * empty FromExpr appears lower down in a jointree. It would pose a - * problem for the PlaceHolderVar mechanism too, since we'd have no - * way to identify where to evaluate a PHV coming out of the subquery. - * Not worth working hard on this, just to collapse SubqueryScan/Result - * into Result; especially since the SubqueryScan can often be optimized - * away by setrefs.c anyway. + * problem for the PlaceHolderVar mechanism too, since we'd have no way to + * identify where to evaluate a PHV coming out of the subquery. Not worth + * working hard on this, just to collapse SubqueryScan/Result into Result; + * especially since the SubqueryScan can often be optimized away by + * setrefs.c anyway. */ if (subquery->jointree->fromlist == NIL) return false; @@ -1167,8 +1168,8 @@ insert_targetlist_placeholders(PlannerInfo *root, List *tlist, } /* - * Simple Vars always escape being wrapped. This is common enough - * to deserve a fast path even if we aren't doing wrap_non_vars. + * Simple Vars always escape being wrapped. This is common enough to + * deserve a fast path even if we aren't doing wrap_non_vars. */ if (tle->expr && IsA(tle->expr, Var) && ((Var *) tle->expr)->varlevelsup == 0) @@ -1180,8 +1181,8 @@ insert_targetlist_placeholders(PlannerInfo *root, List *tlist, if (!wrap_non_vars) { /* - * If it contains a Var of current level, and does not contain - * any non-strict constructs, then it's certainly nullable and we + * If it contains a Var of current level, and does not contain any + * non-strict constructs, then it's certainly nullable and we * don't need to insert a PlaceHolderVar. (Note: in future maybe * we should insert PlaceHolderVars anyway, when a tlist item is * expensive to evaluate? @@ -1248,7 +1249,7 @@ is_safe_append_member(Query *subquery) * but there's no other way... * * If we are above lowest_outer_join then use subtlist_with_phvs; at or - * below it, use subtlist. (When no outer joins are in the picture, + * below it, use subtlist. (When no outer joins are in the picture, * these will be the same list.) */ static void @@ -1328,7 +1329,7 @@ resolvenew_in_jointree(Node *jtnode, int varno, RangeTblEntry *rte, * SELECT ... FROM a LEFT JOIN b ON (a.x = b.y) WHERE b.y IS NULL; * If the join clause is strict for b.y, then only null-extended rows could * pass the upper WHERE, and we can conclude that what the query is really - * specifying is an anti-semijoin. We change the join type from JOIN_LEFT + * specifying is an anti-semijoin. We change the join type from JOIN_LEFT * to JOIN_ANTI. The IS NULL clause then becomes redundant, and must be * removed to prevent bogus selectivity calculations, but we leave it to * distribute_qual_to_rels to get rid of such clauses. @@ -1533,6 +1534,7 @@ reduce_outer_joins_pass2(Node *jtnode, break; case JOIN_SEMI: case JOIN_ANTI: + /* * These could only have been introduced by pull_up_sublinks, * so there's no way that upper quals could refer to their @@ -1565,14 +1567,14 @@ reduce_outer_joins_pass2(Node *jtnode, } /* - * See if we can reduce JOIN_LEFT to JOIN_ANTI. This is the case - * if the join's own quals are strict for any var that was forced - * null by higher qual levels. NOTE: there are other ways that we - * could detect an anti-join, in particular if we were to check - * whether Vars coming from the RHS must be non-null because of - * table constraints. That seems complicated and expensive though - * (in particular, one would have to be wary of lower outer joins). - * For the moment this seems sufficient. + * See if we can reduce JOIN_LEFT to JOIN_ANTI. This is the case if + * the join's own quals are strict for any var that was forced null by + * higher qual levels. NOTE: there are other ways that we could + * detect an anti-join, in particular if we were to check whether Vars + * coming from the RHS must be non-null because of table constraints. + * That seems complicated and expensive though (in particular, one + * would have to be wary of lower outer joins). For the moment this + * seems sufficient. */ if (jointype == JOIN_LEFT) { @@ -1582,8 +1584,8 @@ reduce_outer_joins_pass2(Node *jtnode, computed_local_nonnullable_vars = true; /* - * It's not sufficient to check whether local_nonnullable_vars - * and forced_null_vars overlap: we need to know if the overlap + * It's not sufficient to check whether local_nonnullable_vars and + * forced_null_vars overlap: we need to know if the overlap * includes any RHS variables. */ overlap = list_intersection(local_nonnullable_vars, @@ -1621,11 +1623,11 @@ reduce_outer_joins_pass2(Node *jtnode, * side, because an outer join never eliminates any rows from its * non-nullable side. Also, there is no point in passing upper * constraints into the nullable side, since if there were any - * we'd have been able to reduce the join. (In the case of - * upper forced-null constraints, we *must not* pass them into - * the nullable side --- they either applied here, or not.) - * The upshot is that we pass either the local or the upper - * constraints, never both, to the children of an outer join. + * we'd have been able to reduce the join. (In the case of upper + * forced-null constraints, we *must not* pass them into the + * nullable side --- they either applied here, or not.) The upshot + * is that we pass either the local or the upper constraints, + * never both, to the children of an outer join. * * At a FULL join we just punt and pass nothing down --- is it * possible to be smarter? @@ -1640,7 +1642,7 @@ reduce_outer_joins_pass2(Node *jtnode, { /* OK to merge upper and local constraints */ local_nonnullable_rels = bms_add_members(local_nonnullable_rels, - nonnullable_rels); + nonnullable_rels); local_nonnullable_vars = list_concat(local_nonnullable_vars, nonnullable_vars); local_forced_null_vars = list_concat(local_forced_null_vars, @@ -1663,7 +1665,7 @@ reduce_outer_joins_pass2(Node *jtnode, pass_nonnullable_vars = local_nonnullable_vars; pass_forced_null_vars = local_forced_null_vars; } - else if (jointype != JOIN_FULL) /* ie, LEFT/SEMI/ANTI */ + else if (jointype != JOIN_FULL) /* ie, LEFT/SEMI/ANTI */ { /* can't pass local constraints to non-nullable side */ pass_nonnullable_rels = nonnullable_rels; @@ -1722,7 +1724,7 @@ reduce_outer_joins_pass2(Node *jtnode, * top query could (yet) contain such a reference. * * NOTE: although this has the form of a walker, we cheat and modify the - * nodes in-place. This should be OK since the tree was copied by ResolveNew + * nodes in-place. This should be OK since the tree was copied by ResolveNew * earlier. Avoid scribbling on the original values of the bitmapsets, though, * because expression_tree_mutator doesn't copy those. */ diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c index 09acdaca65..b5e10a9180 100644 --- a/src/backend/optimizer/prep/prepunion.c +++ b/src/backend/optimizer/prep/prepunion.c @@ -22,7 +22,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.170 2009/05/12 03:11:01 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.171 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -97,7 +97,7 @@ static void make_inh_translation_list(Relation oldrelation, Index newvarno, List **translated_vars); static Bitmapset *translate_col_privs(const Bitmapset *parent_privs, - List *translated_vars); + List *translated_vars); static Node *adjust_appendrel_attrs_mutator(Node *node, AppendRelInfo *context); static Relids adjust_relid_set(Relids relids, Index oldrelid, Index newrelid); @@ -220,9 +220,9 @@ recurse_set_operations(Node *setOp, PlannerInfo *root, &subroot); /* - * Estimate number of groups if caller wants it. If the subquery - * used grouping or aggregation, its output is probably mostly - * unique anyway; otherwise do statistical estimation. + * Estimate number of groups if caller wants it. If the subquery used + * grouping or aggregation, its output is probably mostly unique + * anyway; otherwise do statistical estimation. */ if (pNumGroups) { @@ -231,7 +231,7 @@ recurse_set_operations(Node *setOp, PlannerInfo *root, *pNumGroups = subplan->plan_rows; else *pNumGroups = estimate_num_groups(subroot, - get_tlist_exprs(subquery->targetList, false), + get_tlist_exprs(subquery->targetList, false), subplan->plan_rows); } @@ -361,7 +361,7 @@ generate_recursion_plan(SetOperationStmt *setOp, PlannerInfo *root, } else { - double dNumGroups; + double dNumGroups; /* Identify the grouping semantics */ groupList = generate_setop_grouplist(setOp, tlist); @@ -374,8 +374,8 @@ generate_recursion_plan(SetOperationStmt *setOp, PlannerInfo *root, errdetail("All column datatypes must be hashable."))); /* - * For the moment, take the number of distinct groups as equal to - * the total input size, ie, the worst case. + * For the moment, take the number of distinct groups as equal to the + * total input size, ie, the worst case. */ dNumGroups = lplan->plan_rows + rplan->plan_rows * 10; @@ -460,9 +460,9 @@ generate_union_plan(SetOperationStmt *op, PlannerInfo *root, plan = make_union_unique(op, plan, root, tuple_fraction, sortClauses); /* - * Estimate number of groups if caller wants it. For now we just - * assume the output is unique --- this is certainly true for the - * UNION case, and we want worst-case estimates anyway. + * Estimate number of groups if caller wants it. For now we just assume + * the output is unique --- this is certainly true for the UNION case, and + * we want worst-case estimates anyway. */ if (pNumGroups) *pNumGroups = plan->plan_rows; @@ -555,8 +555,8 @@ generate_nonunion_plan(SetOperationStmt *op, PlannerInfo *root, * Estimate number of distinct groups that we'll need hashtable entries * for; this is the size of the left-hand input for EXCEPT, or the smaller * input for INTERSECT. Also estimate the number of eventual output rows. - * In non-ALL cases, we estimate each group produces one output row; - * in ALL cases use the relevant relation size. These are worst-case + * In non-ALL cases, we estimate each group produces one output row; in + * ALL cases use the relevant relation size. These are worst-case * estimates, of course, but we need to be conservative. */ if (op->op == SETOP_EXCEPT) @@ -578,7 +578,7 @@ generate_nonunion_plan(SetOperationStmt *op, PlannerInfo *root, */ use_hash = choose_hashed_setop(root, groupList, plan, dNumGroups, dNumOutputRows, tuple_fraction, - (op->op == SETOP_INTERSECT) ? "INTERSECT" : "EXCEPT"); + (op->op == SETOP_INTERSECT) ? "INTERSECT" : "EXCEPT"); if (!use_hash) plan = (Plan *) make_sort_from_sortclauses(root, groupList, plan); @@ -687,12 +687,12 @@ make_union_unique(SetOperationStmt *op, Plan *plan, } /* - * XXX for the moment, take the number of distinct groups as equal to - * the total input size, ie, the worst case. This is too conservative, - * but we don't want to risk having the hashtable overrun memory; also, - * it's not clear how to get a decent estimate of the true size. One - * should note as well the propensity of novices to write UNION rather - * than UNION ALL even when they don't expect any duplicates... + * XXX for the moment, take the number of distinct groups as equal to the + * total input size, ie, the worst case. This is too conservative, but we + * don't want to risk having the hashtable overrun memory; also, it's not + * clear how to get a decent estimate of the true size. One should note + * as well the propensity of novices to write UNION rather than UNION ALL + * even when they don't expect any duplicates... */ dNumGroups = plan->plan_rows; @@ -763,7 +763,7 @@ choose_hashed_setop(PlannerInfo *root, List *groupClauses, else ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - /* translator: %s is UNION, INTERSECT, or EXCEPT */ + /* translator: %s is UNION, INTERSECT, or EXCEPT */ errmsg("could not implement %s", construct), errdetail("Some of the datatypes only support hashing, while others only support sorting."))); @@ -1260,16 +1260,16 @@ expand_inherited_rtentry(PlannerInfo *root, RangeTblEntry *rte, Index rti) appinfos = lappend(appinfos, appinfo); /* - * Translate the column permissions bitmaps to the child's attnums - * (we have to build the translated_vars list before we can do this). - * But if this is the parent table, leave copyObject's result alone. + * Translate the column permissions bitmaps to the child's attnums (we + * have to build the translated_vars list before we can do this). But + * if this is the parent table, leave copyObject's result alone. */ if (childOID != parentOID) { childrte->selectedCols = translate_col_privs(rte->selectedCols, - appinfo->translated_vars); + appinfo->translated_vars); childrte->modifiedCols = translate_col_privs(rte->modifiedCols, - appinfo->translated_vars); + appinfo->translated_vars); } /* @@ -1420,7 +1420,7 @@ make_inh_translation_list(Relation oldrelation, Relation newrelation, * parent rel's attribute numbering to the child's. * * The only surprise here is that we don't translate a parent whole-row - * reference into a child whole-row reference. That would mean requiring + * reference into a child whole-row reference. That would mean requiring * permissions on all child columns, which is overly strict, since the * query is really only going to reference the inherited columns. Instead * we set the per-column bits for all inherited columns. @@ -1435,12 +1435,12 @@ translate_col_privs(const Bitmapset *parent_privs, ListCell *lc; /* System attributes have the same numbers in all tables */ - for (attno = FirstLowInvalidHeapAttributeNumber+1; attno < 0; attno++) + for (attno = FirstLowInvalidHeapAttributeNumber + 1; attno < 0; attno++) { if (bms_is_member(attno - FirstLowInvalidHeapAttributeNumber, parent_privs)) child_privs = bms_add_member(child_privs, - attno - FirstLowInvalidHeapAttributeNumber); + attno - FirstLowInvalidHeapAttributeNumber); } /* Check if parent has whole-row reference */ @@ -1451,7 +1451,7 @@ translate_col_privs(const Bitmapset *parent_privs, attno = InvalidAttrNumber; foreach(lc, translated_vars) { - Var *var = (Var *) lfirst(lc); + Var *var = (Var *) lfirst(lc); attno++; if (var == NULL) /* ignore dropped columns */ @@ -1461,7 +1461,7 @@ translate_col_privs(const Bitmapset *parent_privs, bms_is_member(attno - FirstLowInvalidHeapAttributeNumber, parent_privs)) child_privs = bms_add_member(child_privs, - var->varattno - FirstLowInvalidHeapAttributeNumber); + var->varattno - FirstLowInvalidHeapAttributeNumber); } return child_privs; diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c index c9c7270d2b..75c5d0c94d 100644 --- a/src/backend/optimizer/util/clauses.c +++ b/src/backend/optimizer/util/clauses.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.276 2009/02/25 03:30:37 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.277 2009/06/11 14:48:59 momjian Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -98,8 +98,8 @@ static Expr *simplify_function(Oid funcid, bool allow_inline, eval_const_expressions_context *context); static List *add_function_defaults(List *args, Oid result_type, - HeapTuple func_tuple, - eval_const_expressions_context *context); + HeapTuple func_tuple, + eval_const_expressions_context *context); static Expr *evaluate_function(Oid funcid, Oid result_type, int32 result_typmod, List *args, HeapTuple func_tuple, @@ -114,9 +114,9 @@ static Node *substitute_actual_parameters_mutator(Node *node, static void sql_inline_error_callback(void *arg); static Expr *evaluate_expr(Expr *expr, Oid result_type, int32 result_typmod); static Query *substitute_actual_srf_parameters(Query *expr, - int nargs, List *args); + int nargs, List *args); static Node *substitute_actual_srf_parameters_mutator(Node *node, - substitute_actual_srf_parameters_context *context); + substitute_actual_srf_parameters_context *context); static bool tlist_matches_coltypelist(List *tlist, List *coltypelist); @@ -612,7 +612,8 @@ find_window_functions_walker(Node *node, WindowFuncLists *lists) lists->numWindowFuncs++; /* - * Complain if the window function's arguments contain window functions + * Complain if the window function's arguments contain window + * functions */ if (contain_window_function((Node *) wfunc->args)) ereport(ERROR, @@ -1557,8 +1558,8 @@ find_forced_null_vars(Node *node) /* * We don't bother considering the OR case, because it's fairly - * unlikely anyone would write "v1 IS NULL OR v1 IS NULL". - * Likewise, the NOT case isn't worth expending code on. + * unlikely anyone would write "v1 IS NULL OR v1 IS NULL". Likewise, + * the NOT case isn't worth expending code on. */ if (expr->boolop == AND_EXPR) { @@ -1594,7 +1595,7 @@ find_forced_null_var(Node *node) if (expr->nulltesttype == IS_NULL) { - Var *var = (Var *) expr->arg; + Var *var = (Var *) expr->arg; if (var && IsA(var, Var) && var->varlevelsup == 0) @@ -1608,7 +1609,7 @@ find_forced_null_var(Node *node) if (expr->booltesttype == IS_UNKNOWN) { - Var *var = (Var *) expr->arg; + Var *var = (Var *) expr->arg; if (var && IsA(var, Var) && var->varlevelsup == 0) @@ -2013,7 +2014,7 @@ eval_const_expressions(PlannerInfo *root, Node *node) if (root) { context.boundParams = root->glob->boundParams; /* bound Params */ - context.glob = root->glob; /* for inlined-function dependencies */ + context.glob = root->glob; /* for inlined-function dependencies */ } else { @@ -2453,9 +2454,9 @@ eval_const_expressions_mutator(Node *node, /* * CoerceViaIO represents calling the source type's output function - * then the result type's input function. So, try to simplify it - * as though it were a stack of two such function calls. First we - * need to know what the functions are. + * then the result type's input function. So, try to simplify it as + * though it were a stack of two such function calls. First we need + * to know what the functions are. */ getTypeOutputInfo(exprType((Node *) arg), &outfunc, &outtypisvarlena); getTypeInputInfo(expr->resulttype, &infunc, &intypioparam); @@ -2505,8 +2506,8 @@ eval_const_expressions_mutator(Node *node, ArrayCoerceExpr *newexpr; /* - * Reduce constants in the ArrayCoerceExpr's argument, then build - * a new ArrayCoerceExpr. + * Reduce constants in the ArrayCoerceExpr's argument, then build a + * new ArrayCoerceExpr. */ arg = (Expr *) eval_const_expressions_mutator((Node *) expr->arg, context); @@ -2925,7 +2926,7 @@ eval_const_expressions_mutator(Node *node, newbtest->booltesttype = btest->booltesttype; return (Node *) newbtest; } - if (IsA(node, PlaceHolderVar) && context->estimate) + if (IsA(node, PlaceHolderVar) &&context->estimate) { /* * In estimation mode, just strip the PlaceHolderVar node altogether; @@ -3266,7 +3267,7 @@ simplify_function(Oid funcid, Oid result_type, int32 result_typmod, * * It is possible for some of the defaulted arguments to be polymorphic; * therefore we can't assume that the default expressions have the correct - * data types already. We have to re-resolve polymorphics and do coercion + * data types already. We have to re-resolve polymorphics and do coercion * just like the parser did. */ static List * @@ -3594,7 +3595,7 @@ inline_function(Oid funcid, Oid result_type, List *args, /* * Make sure the function (still) returns what it's declared to. This * will raise an error if wrong, but that's okay since the function would - * fail at runtime anyway. Note that check_sql_fn_retval will also insert + * fail at runtime anyway. Note that check_sql_fn_retval will also insert * a RelabelType if needed to make the tlist expression match the declared * type of the function. * @@ -3695,8 +3696,8 @@ inline_function(Oid funcid, Oid result_type, List *args, MemoryContextDelete(mycxt); /* - * Since there is now no trace of the function in the plan tree, we - * must explicitly record the plan's dependency on the function. + * Since there is now no trace of the function in the plan tree, we must + * explicitly record the plan's dependency on the function. */ if (context->glob) record_plan_function_dependency(context->glob, funcid); @@ -3825,7 +3826,7 @@ evaluate_expr(Expr *expr, Oid result_type, int32 result_typmod) fix_opfuncids((Node *) expr); /* - * Prepare expr for execution. (Note: we can't use ExecPrepareExpr + * Prepare expr for execution. (Note: we can't use ExecPrepareExpr * because it'd result in recursively invoking eval_const_expressions.) */ exprstate = ExecInitExpr(expr, NULL); @@ -3908,10 +3909,10 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte) Assert(rte->rtekind == RTE_FUNCTION); /* - * It doesn't make a lot of sense for a SQL SRF to refer to itself - * in its own FROM clause, since that must cause infinite recursion - * at runtime. It will cause this code to recurse too, so check - * for stack overflow. (There's no need to do more.) + * It doesn't make a lot of sense for a SQL SRF to refer to itself in its + * own FROM clause, since that must cause infinite recursion at runtime. + * It will cause this code to recurse too, so check for stack overflow. + * (There's no need to do more.) */ check_stack_depth(); @@ -3922,8 +3923,8 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte) /* * The function must be declared to return a set, else inlining would - * change the results if the contained SELECT didn't return exactly - * one row. + * change the results if the contained SELECT didn't return exactly one + * row. */ if (!fexpr->funcretset) return NULL; @@ -3932,7 +3933,7 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte) * Refuse to inline if the arguments contain any volatile functions or * sub-selects. Volatile functions are rejected because inlining may * result in the arguments being evaluated multiple times, risking a - * change in behavior. Sub-selects are rejected partly for implementation + * change in behavior. Sub-selects are rejected partly for implementation * reasons (pushing them down another level might change their behavior) * and partly because they're likely to be expensive and so multiple * evaluation would be bad. @@ -3957,7 +3958,7 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte) /* * Forget it if the function is not SQL-language or has other showstopper - * properties. In particular it mustn't be declared STRICT, since we + * properties. In particular it mustn't be declared STRICT, since we * couldn't enforce that. It also mustn't be VOLATILE, because that is * supposed to cause it to be executed with its own snapshot, rather than * sharing the snapshot of the calling query. (The nargs check is just @@ -4017,16 +4018,16 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte) src = TextDatumGetCString(tmp); /* - * Parse, analyze, and rewrite (unlike inline_function(), we can't - * skip rewriting here). We can fail as soon as we find more than - * one query, though. + * Parse, analyze, and rewrite (unlike inline_function(), we can't skip + * rewriting here). We can fail as soon as we find more than one query, + * though. */ raw_parsetree_list = pg_parse_query(src); if (list_length(raw_parsetree_list) != 1) goto fail; querytree_list = pg_analyze_and_rewrite(linitial(raw_parsetree_list), src, - argtypes, funcform->pronargs); + argtypes, funcform->pronargs); if (list_length(querytree_list) != 1) goto fail; querytree = linitial(querytree_list); @@ -4043,13 +4044,13 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte) /* * Make sure the function (still) returns what it's declared to. This * will raise an error if wrong, but that's okay since the function would - * fail at runtime anyway. Note that check_sql_fn_retval will also insert + * fail at runtime anyway. Note that check_sql_fn_retval will also insert * RelabelType(s) if needed to make the tlist expression(s) match the * declared type of the function. * - * If the function returns a composite type, don't inline unless the - * check shows it's returning a whole tuple result; otherwise what - * it's returning is a single composite column which is not what we need. + * If the function returns a composite type, don't inline unless the check + * shows it's returning a whole tuple result; otherwise what it's + * returning is a single composite column which is not what we need. */ if (!check_sql_fn_retval(fexpr->funcid, fexpr->funcresulttype, querytree_list, @@ -4076,8 +4077,8 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte) fexpr->args); /* - * Copy the modified query out of the temporary memory context, - * and clean up. + * Copy the modified query out of the temporary memory context, and clean + * up. */ MemoryContextSwitchTo(oldcxt); @@ -4088,8 +4089,8 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte) ReleaseSysCache(func_tuple); /* - * Since there is now no trace of the function in the plan tree, we - * must explicitly record the plan's dependency on the function. + * Since there is now no trace of the function in the plan tree, we must + * explicitly record the plan's dependency on the function. */ record_plan_function_dependency(root->glob, fexpr->funcid); @@ -4128,9 +4129,9 @@ substitute_actual_srf_parameters(Query *expr, int nargs, List *args) static Node * substitute_actual_srf_parameters_mutator(Node *node, - substitute_actual_srf_parameters_context *context) + substitute_actual_srf_parameters_context *context) { - Node *result; + Node *result; if (node == NULL) return NULL; @@ -4138,7 +4139,7 @@ substitute_actual_srf_parameters_mutator(Node *node, { context->sublevels_up++; result = (Node *) query_tree_mutator((Query *) node, - substitute_actual_srf_parameters_mutator, + substitute_actual_srf_parameters_mutator, (void *) context, 0); context->sublevels_up--; @@ -4154,8 +4155,8 @@ substitute_actual_srf_parameters_mutator(Node *node, elog(ERROR, "invalid paramid: %d", param->paramid); /* - * Since the parameter is being inserted into a subquery, - * we must adjust levels. + * Since the parameter is being inserted into a subquery, we must + * adjust levels. */ result = copyObject(list_nth(context->args, param->paramid - 1)); IncrementVarSublevelsUp(result, context->sublevels_up, 0); diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c index 5ba413bb1a..b0358cb112 100644 --- a/src/backend/optimizer/util/pathnode.c +++ b/src/backend/optimizer/util/pathnode.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.151 2009/03/26 17:15:35 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.152 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -797,7 +797,7 @@ create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, in_operators = NIL; uniq_exprs = NIL; all_btree = true; - all_hash = enable_hashagg; /* don't consider hash if not enabled */ + all_hash = enable_hashagg; /* don't consider hash if not enabled */ foreach(lc, sjinfo->join_quals) { OpExpr *op = (OpExpr *) lfirst(lc); @@ -904,8 +904,8 @@ create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, goto no_unique_path; /* - * If we get here, we can unique-ify using at least one of sorting - * and hashing. Start building the result Path object. + * If we get here, we can unique-ify using at least one of sorting and + * hashing. Start building the result Path object. */ pathnode = makeNode(UniquePath); @@ -972,8 +972,8 @@ create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, -1.0); /* - * Charge one cpu_operator_cost per comparison per input tuple. - * We assume all columns get compared at most of the tuples. (XXX + * Charge one cpu_operator_cost per comparison per input tuple. We + * assume all columns get compared at most of the tuples. (XXX * probably this is an overestimate.) This should agree with * make_unique. */ @@ -1030,7 +1030,7 @@ create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, return pathnode; -no_unique_path: /* failure exit */ +no_unique_path: /* failure exit */ /* Mark the SpecialJoinInfo as not unique-able */ sjinfo->join_quals = NIL; @@ -1404,27 +1404,27 @@ create_mergejoin_path(PlannerInfo *root, * selected as the input of a mergejoin, and they don't support * mark/restore at present. * - * Note: Sort supports mark/restore, so no materialize is really needed - * in that case; but one may be desirable anyway to optimize the sort. - * However, since we aren't representing the sort step separately in - * the Path tree, we can't explicitly represent the materialize either. - * So that case is not handled here. Instead, cost_mergejoin has to - * factor in the cost and create_mergejoin_plan has to add the plan node. + * Note: Sort supports mark/restore, so no materialize is really needed in + * that case; but one may be desirable anyway to optimize the sort. + * However, since we aren't representing the sort step separately in the + * Path tree, we can't explicitly represent the materialize either. So + * that case is not handled here. Instead, cost_mergejoin has to factor + * in the cost and create_mergejoin_plan has to add the plan node. */ if (innersortkeys == NIL && !ExecSupportsMarkRestore(inner_path->pathtype)) { - Path *mpath; + Path *mpath; mpath = (Path *) create_material_path(inner_path->parent, inner_path); /* - * We expect the materialize won't spill to disk (it could only do - * so if there were a whole lot of duplicate tuples, which is a case - * cost_mergejoin will avoid choosing anyway). Therefore - * cost_material's cost estimate is bogus and we should charge - * just cpu_tuple_cost per tuple. (Keep this estimate in sync with - * similar ones in cost_mergejoin and create_mergejoin_plan.) + * We expect the materialize won't spill to disk (it could only do so + * if there were a whole lot of duplicate tuples, which is a case + * cost_mergejoin will avoid choosing anyway). Therefore + * cost_material's cost estimate is bogus and we should charge just + * cpu_tuple_cost per tuple. (Keep this estimate in sync with similar + * ones in cost_mergejoin and create_mergejoin_plan.) */ mpath->startup_cost = inner_path->startup_cost; mpath->total_cost = inner_path->total_cost; @@ -1480,16 +1480,17 @@ create_hashjoin_path(PlannerInfo *root, pathnode->jpath.outerjoinpath = outer_path; pathnode->jpath.innerjoinpath = inner_path; pathnode->jpath.joinrestrictinfo = restrict_clauses; + /* * A hashjoin never has pathkeys, since its output ordering is - * unpredictable due to possible batching. XXX If the inner relation is + * unpredictable due to possible batching. XXX If the inner relation is * small enough, we could instruct the executor that it must not batch, * and then we could assume that the output inherits the outer relation's - * ordering, which might save a sort step. However there is considerable - * downside if our estimate of the inner relation size is badly off. - * For the moment we don't risk it. (Note also that if we wanted to take - * this seriously, joinpath.c would have to consider many more paths for - * the outer rel than it does now.) + * ordering, which might save a sort step. However there is considerable + * downside if our estimate of the inner relation size is badly off. For + * the moment we don't risk it. (Note also that if we wanted to take this + * seriously, joinpath.c would have to consider many more paths for the + * outer rel than it does now.) */ pathnode->jpath.path.pathkeys = NIL; pathnode->path_hashclauses = hashclauses; diff --git a/src/backend/optimizer/util/placeholder.c b/src/backend/optimizer/util/placeholder.c index 019352158d..b06c48c1e4 100644 --- a/src/backend/optimizer/util/placeholder.c +++ b/src/backend/optimizer/util/placeholder.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/placeholder.c,v 1.4 2009/04/19 19:46:33 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/placeholder.c,v 1.5 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -72,7 +72,7 @@ find_placeholder_info(PlannerInfo *root, PlaceHolderVar *phv) phinfo->ph_var = copyObject(phv); phinfo->ph_eval_at = pull_varnos((Node *) phv); /* ph_eval_at may change later, see fix_placeholder_eval_levels */ - phinfo->ph_needed = NULL; /* initially it's unused */ + phinfo->ph_needed = NULL; /* initially it's unused */ /* for the moment, estimate width using just the datatype info */ phinfo->ph_width = get_typavgwidth(exprType((Node *) phv->phexpr), exprTypmod((Node *) phv->phexpr)); @@ -88,7 +88,7 @@ find_placeholder_info(PlannerInfo *root, PlaceHolderVar *phv) * * The initial eval_at level set by find_placeholder_info was the set of * rels used in the placeholder's expression (or the whole subselect if - * the expr is variable-free). If the subselect contains any outer joins + * the expr is variable-free). If the subselect contains any outer joins * that can null any of those rels, we must delay evaluation to above those * joins. * @@ -153,11 +153,11 @@ fix_placeholder_eval_levels(PlannerInfo *root) /* * Now that we know where to evaluate the placeholder, make sure that * any vars or placeholders it uses will be available at that join - * level. NOTE: this could cause more PlaceHolderInfos to be added - * to placeholder_list. That is okay because we'll process them - * before falling out of the foreach loop. Also, it could cause - * the ph_needed sets of existing list entries to expand, which - * is also okay because this loop doesn't examine those. + * level. NOTE: this could cause more PlaceHolderInfos to be added to + * placeholder_list. That is okay because we'll process them before + * falling out of the foreach loop. Also, it could cause the + * ph_needed sets of existing list entries to expand, which is also + * okay because this loop doesn't examine those. */ if (bms_membership(eval_at) == BMS_MULTIPLE) { @@ -173,7 +173,7 @@ fix_placeholder_eval_levels(PlannerInfo *root) * Now, if any placeholder can be computed at a base rel and is needed * above it, add it to that rel's targetlist. (This is essentially the * same logic as in add_placeholders_to_joinrel, but we can't do that part - * until joinrels are formed.) We have to do this as a separate step + * until joinrels are formed.) We have to do this as a separate step * because the ph_needed values aren't stable until the previous loop * finishes. */ diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index 0479e93ec8..4f07cade68 100644 --- a/src/backend/optimizer/util/plancat.c +++ b/src/backend/optimizer/util/plancat.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.157 2009/05/12 00:56:05 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.158 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -525,7 +525,7 @@ get_relation_constraints(PlannerInfo *root, /* Add NOT NULL constraints in expression form, if requested */ if (include_notnull && constr->has_not_null) { - int natts = relation->rd_att->natts; + int natts = relation->rd_att->natts; for (i = 1; i <= natts; i++) { @@ -533,7 +533,7 @@ get_relation_constraints(PlannerInfo *root, if (att->attnotnull && !att->attisdropped) { - NullTest *ntest = makeNode(NullTest); + NullTest *ntest = makeNode(NullTest); ntest->arg = (Expr *) makeVar(varno, i, @@ -604,7 +604,7 @@ relation_excluded_by_constraints(PlannerInfo *root, return false; /* - * OK to fetch the constraint expressions. Include "col IS NOT NULL" + * OK to fetch the constraint expressions. Include "col IS NOT NULL" * expressions for attnotnull columns, in case we can refute those. */ constraint_pred = get_relation_constraints(root, rte->relid, rel, true); @@ -865,10 +865,10 @@ has_unique_index(RelOptInfo *rel, AttrNumber attno) /* * Note: ignore partial indexes, since they don't allow us to conclude * that all attr values are distinct, *unless* they are marked predOK - * which means we know the index's predicate is satisfied by the query. - * We don't take any interest in expressional indexes either. Also, a - * multicolumn unique index doesn't allow us to conclude that just the - * specified attr is unique. + * which means we know the index's predicate is satisfied by the + * query. We don't take any interest in expressional indexes either. + * Also, a multicolumn unique index doesn't allow us to conclude that + * just the specified attr is unique. */ if (index->unique && index->ncolumns == 1 && diff --git a/src/backend/optimizer/util/predtest.c b/src/backend/optimizer/util/predtest.c index 3249b2726e..2b9f7727d8 100644 --- a/src/backend/optimizer/util/predtest.c +++ b/src/backend/optimizer/util/predtest.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/predtest.c,v 1.26 2009/05/11 17:56:08 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/predtest.c,v 1.27 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -98,7 +98,7 @@ static Node *extract_not_arg(Node *clause); static bool list_member_strip(List *list, Expr *datum); static bool btree_predicate_proof(Expr *predicate, Node *clause, bool refute_it); -static Oid get_btree_test_op(Oid pred_op, Oid clause_op, bool refute_it); +static Oid get_btree_test_op(Oid pred_op, Oid clause_op, bool refute_it); static void InvalidateOprProofCacheCallBack(Datum arg, int cacheid, ItemPointer tuplePtr); @@ -134,7 +134,7 @@ predicate_implied_by(List *predicate_list, List *restrictinfo_list) /* * If either input is a single-element list, replace it with its lone - * member; this avoids one useless level of AND-recursion. We only need + * member; this avoids one useless level of AND-recursion. We only need * to worry about this at top level, since eval_const_expressions should * have gotten rid of any trivial ANDs or ORs below that. */ @@ -192,7 +192,7 @@ predicate_refuted_by(List *predicate_list, List *restrictinfo_list) /* * If either input is a single-element list, replace it with its lone - * member; this avoids one useless level of AND-recursion. We only need + * member; this avoids one useless level of AND-recursion. We only need * to worry about this at top level, since eval_const_expressions should * have gotten rid of any trivial ANDs or ORs below that. */ @@ -652,13 +652,14 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate) case CLASS_ATOM: #ifdef NOT_USED + /* * If A is a NOT-clause, A R=> B if B => A's arg * * Unfortunately not: this would only prove that B is not-TRUE, * not that it's not NULL either. Keep this code as a comment - * because it would be useful if we ever had a need for the - * weak form of refutation. + * because it would be useful if we ever had a need for the weak + * form of refutation. */ not_arg = extract_not_arg(clause); if (not_arg && @@ -738,7 +739,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate) * This function also implements enforcement of MAX_SAOP_ARRAY_SIZE: if a * ScalarArrayOpExpr's array has too many elements, we just classify it as an * atom. (This will result in its being passed as-is to the simple_clause - * functions, which will fail to prove anything about it.) Note that we + * functions, which will fail to prove anything about it.) Note that we * cannot just stop after considering MAX_SAOP_ARRAY_SIZE elements; in general * that would result in wrong proofs, rather than failing to prove anything. */ @@ -1484,8 +1485,8 @@ typedef struct OprProofCacheEntry bool have_implic; /* do we know the implication result? */ bool have_refute; /* do we know the refutation result? */ - Oid implic_test_op; /* OID of the operator, or 0 if none */ - Oid refute_test_op; /* OID of the operator, or 0 if none */ + Oid implic_test_op; /* OID of the operator, or 0 if none */ + Oid refute_test_op; /* OID of the operator, or 0 if none */ } OprProofCacheEntry; static HTAB *OprProofCacheHash = NULL; diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c index 2d289cae71..4ca3eeaaf2 100644 --- a/src/backend/optimizer/util/relnode.c +++ b/src/backend/optimizer/util/relnode.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.93 2009/01/01 17:23:45 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.94 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -430,8 +430,8 @@ build_joinrel_tlist(PlannerInfo *root, RelOptInfo *joinrel, int ndx; /* - * Ignore PlaceHolderVars in the input tlists; we'll make our - * own decisions about whether to copy them. + * Ignore PlaceHolderVars in the input tlists; we'll make our own + * decisions about whether to copy them. */ if (IsA(origvar, PlaceHolderVar)) continue; diff --git a/src/backend/optimizer/util/restrictinfo.c b/src/backend/optimizer/util/restrictinfo.c index 5b75d2de3b..47086a4bfc 100644 --- a/src/backend/optimizer/util/restrictinfo.c +++ b/src/backend/optimizer/util/restrictinfo.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/restrictinfo.c,v 1.59 2009/05/09 22:51:41 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/restrictinfo.c,v 1.60 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -593,9 +593,9 @@ select_nonredundant_join_clauses(PlannerInfo *root, * OK because we're only trying to prove we can dispense with some * join quals; failing to prove that doesn't result in an incorrect * plan. It's quite unlikely that a join qual could be proven - * redundant by an index predicate anyway. (Also, if we did manage - * to prove it, we'd have to have a special case for update targets; - * see notes about EvalPlanQual testing in create_indexscan_plan().) + * redundant by an index predicate anyway. (Also, if we did manage to + * prove it, we'd have to have a special case for update targets; see + * notes about EvalPlanQual testing in create_indexscan_plan().) */ BitmapHeapPath *innerpath = (BitmapHeapPath *) inner_path; @@ -614,10 +614,10 @@ select_nonredundant_join_clauses(PlannerInfo *root, } /* - * XXX the inner path of a nestloop could also be an append relation - * whose elements use join quals. However, they might each use different - * quals; we could only remove join quals that are enforced by all the - * appendrel members. For the moment we don't bother to try. + * XXX the inner path of a nestloop could also be an append relation whose + * elements use join quals. However, they might each use different quals; + * we could only remove join quals that are enforced by all the appendrel + * members. For the moment we don't bother to try. */ return restrictinfo_list; diff --git a/src/backend/optimizer/util/var.c b/src/backend/optimizer/util/var.c index cd88c337f1..deb9ef8ebd 100644 --- a/src/backend/optimizer/util/var.c +++ b/src/backend/optimizer/util/var.c @@ -14,7 +14,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/var.c,v 1.85 2009/04/19 19:46:33 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/var.c,v 1.86 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -71,9 +71,9 @@ static bool pull_varattnos_walker(Node *node, Bitmapset **varattnos); static bool contain_var_clause_walker(Node *node, void *context); static bool contain_vars_of_level_walker(Node *node, int *sublevels_up); static bool locate_var_of_level_walker(Node *node, - locate_var_of_level_context *context); + locate_var_of_level_context *context); static bool locate_var_of_relation_walker(Node *node, - locate_var_of_relation_context *context); + locate_var_of_relation_context *context); static bool find_minimum_var_level_walker(Node *node, find_minimum_var_level_context *context); static bool pull_var_clause_walker(Node *node, @@ -318,7 +318,7 @@ contain_vars_of_level_walker(Node *node, int *sublevels_up) * Find the parse location of any Var of the specified query level. * * Returns -1 if no such Var is in the querytree, or if they all have - * unknown parse location. (The former case is probably caller error, + * unknown parse location. (The former case is probably caller error, * but we don't bother to distinguish it from the latter case.) * * Will recurse into sublinks. Also, may be invoked directly on a Query. @@ -333,7 +333,7 @@ locate_var_of_level(Node *node, int levelsup) { locate_var_of_level_context context; - context.var_location = -1; /* in case we find nothing */ + context.var_location = -1; /* in case we find nothing */ context.sublevels_up = levelsup; (void) query_or_expression_tree_walker(node, @@ -352,7 +352,7 @@ locate_var_of_level_walker(Node *node, return false; if (IsA(node, Var)) { - Var *var = (Var *) node; + Var *var = (Var *) node; if (var->varlevelsup == context->sublevels_up && var->location >= 0) @@ -401,7 +401,7 @@ locate_var_of_relation(Node *node, int relid, int levelsup) { locate_var_of_relation_context context; - context.var_location = -1; /* in case we find nothing */ + context.var_location = -1; /* in case we find nothing */ context.relid = relid; context.sublevels_up = levelsup; @@ -421,7 +421,7 @@ locate_var_of_relation_walker(Node *node, return false; if (IsA(node, Var)) { - Var *var = (Var *) node; + Var *var = (Var *) node; if (var->varno == context->relid && var->varlevelsup == context->sublevels_up && @@ -625,7 +625,7 @@ find_minimum_var_level_walker(Node *node, * Upper-level vars (with varlevelsup > 0) are not included. * (These probably represent errors too, but we don't complain.) * - * Returns list of nodes found. Note the nodes themselves are not + * Returns list of nodes found. Note the nodes themselves are not * copied, only referenced. * * Does not examine subqueries, therefore must only be used after reduction diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index 397e951c71..97c560b309 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -17,7 +17,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.388 2009/01/22 20:16:04 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.389 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -50,7 +50,7 @@ static Query *transformSelectStmt(ParseState *pstate, SelectStmt *stmt); static Query *transformValuesClause(ParseState *pstate, SelectStmt *stmt); static Query *transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt); static Node *transformSetOperationTree(ParseState *pstate, SelectStmt *stmt, - List **colInfo); + List **colInfo); static void applyColumnNames(List *dst, List *src); static Query *transformUpdateStmt(ParseState *pstate, UpdateStmt *stmt); static List *transformReturningList(ParseState *pstate, List *returningList); @@ -59,7 +59,7 @@ static Query *transformDeclareCursorStmt(ParseState *pstate, static Query *transformExplainStmt(ParseState *pstate, ExplainStmt *stmt); static void transformLockingClause(ParseState *pstate, - Query *qry, LockingClause *lc); + Query *qry, LockingClause *lc); static bool check_parameter_resolution_walker(Node *node, ParseState *pstate); @@ -81,7 +81,7 @@ parse_analyze(Node *parseTree, const char *sourceText, ParseState *pstate = make_parsestate(NULL); Query *query; - Assert(sourceText != NULL); /* required as of 8.4 */ + Assert(sourceText != NULL); /* required as of 8.4 */ pstate->p_sourcetext = sourceText; pstate->p_paramtypes = paramTypes; @@ -109,7 +109,7 @@ parse_analyze_varparams(Node *parseTree, const char *sourceText, ParseState *pstate = make_parsestate(NULL); Query *query; - Assert(sourceText != NULL); /* required as of 8.4 */ + Assert(sourceText != NULL); /* required as of 8.4 */ pstate->p_sourcetext = sourceText; pstate->p_paramtypes = *paramTypes; @@ -255,6 +255,7 @@ analyze_requires_snapshot(Node *parseTree) break; case T_ExplainStmt: + /* * We only need a snapshot in varparams case, but it doesn't seem * worth complicating this function's API to distinguish that. @@ -423,7 +424,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt) * bugs of just that nature...) */ sub_pstate->p_rtable = sub_rtable; - sub_pstate->p_joinexprs = NIL; /* sub_rtable has no joins */ + sub_pstate->p_joinexprs = NIL; /* sub_rtable has no joins */ sub_pstate->p_relnamespace = sub_relnamespace; sub_pstate->p_varnamespace = sub_varnamespace; @@ -441,7 +442,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt) (errcode(ERRCODE_SYNTAX_ERROR), errmsg("INSERT ... SELECT cannot specify INTO"), parser_errposition(pstate, - exprLocation((Node *) selectQuery->intoClause)))); + exprLocation((Node *) selectQuery->intoClause)))); /* * Make the source be a subquery in the INSERT's rangetable, and add @@ -485,11 +486,12 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt) expr = tle->expr; else { - Var *var = makeVar(rtr->rtindex, - tle->resno, - exprType((Node *) tle->expr), - exprTypmod((Node *) tle->expr), - 0); + Var *var = makeVar(rtr->rtindex, + tle->resno, + exprType((Node *) tle->expr), + exprTypmod((Node *) tle->expr), + 0); + var->location = exprLocation((Node *) tle->expr); expr = (Expr *) var; } @@ -563,7 +565,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt) (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("VALUES must not contain table references"), parser_errposition(pstate, - locate_var_of_level((Node *) exprsLists, 0)))); + locate_var_of_level((Node *) exprsLists, 0)))); /* * Another thing we can't currently support is NEW/OLD references in @@ -578,7 +580,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt) errmsg("VALUES must not contain OLD or NEW references"), errhint("Use SELECT ... UNION ALL ... instead."), parser_errposition(pstate, - locate_var_of_level((Node *) exprsLists, 0)))); + locate_var_of_level((Node *) exprsLists, 0)))); /* * Generate the VALUES RTE @@ -655,7 +657,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt) qry->targetList = lappend(qry->targetList, tle); rte->modifiedCols = bms_add_member(rte->modifiedCols, - attr_num - FirstLowInvalidHeapAttributeNumber); + attr_num - FirstLowInvalidHeapAttributeNumber); icols = lnext(icols); attnos = lnext(attnos); @@ -727,7 +729,7 @@ transformInsertRow(ParseState *pstate, List *exprlist, errmsg("INSERT has more expressions than target columns"), parser_errposition(pstate, exprLocation(list_nth(exprlist, - list_length(icolumns)))))); + list_length(icolumns)))))); if (stmtcols != NIL && list_length(exprlist) < list_length(icolumns)) ereport(ERROR, @@ -735,7 +737,7 @@ transformInsertRow(ParseState *pstate, List *exprlist, errmsg("INSERT has more target columns than expressions"), parser_errposition(pstate, exprLocation(list_nth(icolumns, - list_length(exprlist)))))); + list_length(exprlist)))))); /* * Prepare columns for assignment to target table. @@ -816,9 +818,9 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt) /* * Transform sorting/grouping stuff. Do ORDER BY first because both - * transformGroupClause and transformDistinctClause need the results. - * Note that these functions can also change the targetList, so it's - * passed to them by reference. + * transformGroupClause and transformDistinctClause need the results. Note + * that these functions can also change the targetList, so it's passed to + * them by reference. */ qry->sortClause = transformSortClause(pstate, stmt->sortClause, @@ -1068,7 +1070,7 @@ transformValuesClause(ParseState *pstate, SelectStmt *stmt) (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("VALUES must not contain table references"), parser_errposition(pstate, - locate_var_of_level((Node *) newExprsLists, 0)))); + locate_var_of_level((Node *) newExprsLists, 0)))); /* * Another thing we can't currently support is NEW/OLD references in rules @@ -1083,7 +1085,7 @@ transformValuesClause(ParseState *pstate, SelectStmt *stmt) errmsg("VALUES must not contain OLD or NEW references"), errhint("Use SELECT ... UNION ALL ... instead."), parser_errposition(pstate, - locate_var_of_level((Node *) newExprsLists, 0)))); + locate_var_of_level((Node *) newExprsLists, 0)))); qry->rtable = pstate->p_rtable; qry->jointree = makeFromExpr(pstate->p_joinlist, NULL); @@ -1095,13 +1097,13 @@ transformValuesClause(ParseState *pstate, SelectStmt *stmt) (errcode(ERRCODE_GROUPING_ERROR), errmsg("cannot use aggregate function in VALUES"), parser_errposition(pstate, - locate_agg_of_level((Node *) newExprsLists, 0)))); + locate_agg_of_level((Node *) newExprsLists, 0)))); if (pstate->p_hasWindowFuncs) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), errmsg("cannot use window function in VALUES"), parser_errposition(pstate, - locate_windowfunc((Node *) newExprsLists)))); + locate_windowfunc((Node *) newExprsLists)))); return qry; } @@ -1302,7 +1304,7 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt) errdetail("Only result column names can be used, not expressions or functions."), errhint("Add the expression/function to every SELECT, or move the UNION into a FROM clause."), parser_errposition(pstate, - exprLocation(list_nth(qry->targetList, tllen))))); + exprLocation(list_nth(qry->targetList, tllen))))); qry->limitOffset = transformLimitClause(pstate, limitOffset, "OFFSET"); @@ -1368,7 +1370,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("INTO is only allowed on first SELECT of UNION/INTERSECT/EXCEPT"), parser_errposition(pstate, - exprLocation((Node *) stmt->intoClause)))); + exprLocation((Node *) stmt->intoClause)))); /* We don't support FOR UPDATE/SHARE with set ops at the moment. */ if (stmt->lockingClause) @@ -1428,7 +1430,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt, (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), errmsg("UNION/INTERSECT/EXCEPT member statement cannot refer to other relations of same query level"), parser_errposition(pstate, - locate_var_of_level((Node *) selectQuery, 1)))); + locate_var_of_level((Node *) selectQuery, 1)))); } /* @@ -1790,8 +1792,8 @@ transformReturningList(ParseState *pstate, List *returningList) /* no new relation references please */ if (list_length(pstate->p_rtable) != length_rtable) { - int vlocation = -1; - int relid; + int vlocation = -1; + int relid; /* try to locate such a reference to point to */ for (relid = length_rtable + 1; relid <= list_length(pstate->p_rtable); relid++) @@ -1802,7 +1804,7 @@ transformReturningList(ParseState *pstate, List *returningList) } ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("RETURNING cannot contain references to other relations"), + errmsg("RETURNING cannot contain references to other relations"), parser_errposition(pstate, vlocation))); } @@ -1857,7 +1859,7 @@ transformDeclareCursorStmt(ParseState *pstate, DeclareCursorStmt *stmt) (errcode(ERRCODE_INVALID_CURSOR_DEFINITION), errmsg("DECLARE CURSOR cannot specify INTO"), parser_errposition(pstate, - exprLocation((Node *) result->intoClause)))); + exprLocation((Node *) result->intoClause)))); /* FOR UPDATE and WITH HOLD are not compatible */ if (result->rowMarks != NIL && (stmt->options & CURSOR_OPT_HOLD)) @@ -2006,10 +2008,10 @@ transformLockingClause(ParseState *pstate, Query *qry, LockingClause *lc) { /* * We allow FOR UPDATE/SHARE of a WITH query to be - * propagated into the WITH, but it doesn't seem - * very sane to allow this for a reference to an - * outer-level WITH. And it definitely wouldn't - * work for a self-reference, since we're not done + * propagated into the WITH, but it doesn't seem very + * sane to allow this for a reference to an + * outer-level WITH. And it definitely wouldn't work + * for a self-reference, since we're not done * analyzing the CTE anyway. */ CommonTableExpr *cte; @@ -2073,25 +2075,25 @@ transformLockingClause(ParseState *pstate, Query *qry, LockingClause *lc) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("SELECT FOR UPDATE/SHARE cannot be applied to a join"), - parser_errposition(pstate, thisrel->location))); + parser_errposition(pstate, thisrel->location))); break; case RTE_SPECIAL: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("SELECT FOR UPDATE/SHARE cannot be applied to NEW or OLD"), - parser_errposition(pstate, thisrel->location))); + parser_errposition(pstate, thisrel->location))); break; case RTE_FUNCTION: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("SELECT FOR UPDATE/SHARE cannot be applied to a function"), - parser_errposition(pstate, thisrel->location))); + parser_errposition(pstate, thisrel->location))); break; case RTE_VALUES: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("SELECT FOR UPDATE/SHARE cannot be applied to VALUES"), - parser_errposition(pstate, thisrel->location))); + parser_errposition(pstate, thisrel->location))); break; case RTE_CTE: { @@ -2108,14 +2110,14 @@ transformLockingClause(ParseState *pstate, Query *qry, LockingClause *lc) if (rte->ctelevelsup > 0 || rte->self_reference) ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("SELECT FOR UPDATE/SHARE cannot be applied to an outer-level WITH query"), - parser_errposition(pstate, thisrel->location))); + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("SELECT FOR UPDATE/SHARE cannot be applied to an outer-level WITH query"), + parser_errposition(pstate, thisrel->location))); cte = GetCTEForRTE(pstate, rte, -1); /* should be analyzed by now */ Assert(IsA(cte->ctequery, Query)); transformLockingClause(pstate, - (Query *) cte->ctequery, + (Query *) cte->ctequery, allrels); } break; diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c index dea9c54693..0594396921 100644 --- a/src/backend/parser/parse_agg.c +++ b/src/backend/parser/parse_agg.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_agg.c,v 1.87 2009/01/01 17:23:45 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_agg.c,v 1.88 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -73,7 +73,7 @@ transformAggregateCall(ParseState *pstate, Aggref *agg) (errcode(ERRCODE_GROUPING_ERROR), errmsg("aggregate function calls cannot be nested"), parser_errposition(pstate, - locate_agg_of_level((Node *) agg->args, 0)))); + locate_agg_of_level((Node *) agg->args, 0)))); } /* It can't contain window functions either */ @@ -111,8 +111,8 @@ transformWindowFuncCall(ParseState *pstate, WindowFunc *wfunc, WindowDef *windef) { /* - * A window function call can't contain another one (but aggs are OK). - * XXX is this required by spec, or just an unimplemented feature? + * A window function call can't contain another one (but aggs are OK). XXX + * is this required by spec, or just an unimplemented feature? */ if (pstate->p_hasWindowFuncs && checkExprHasWindowFuncs((Node *) wfunc->args)) @@ -120,13 +120,13 @@ transformWindowFuncCall(ParseState *pstate, WindowFunc *wfunc, (errcode(ERRCODE_WINDOWING_ERROR), errmsg("window function calls cannot be nested"), parser_errposition(pstate, - locate_windowfunc((Node *) wfunc->args)))); + locate_windowfunc((Node *) wfunc->args)))); /* - * If the OVER clause just specifies a window name, find that - * WINDOW clause (which had better be present). Otherwise, try to - * match all the properties of the OVER clause, and make a new entry - * in the p_windowdefs list if no luck. + * If the OVER clause just specifies a window name, find that WINDOW + * clause (which had better be present). Otherwise, try to match all the + * properties of the OVER clause, and make a new entry in the p_windowdefs + * list if no luck. */ if (windef->name) { @@ -140,7 +140,7 @@ transformWindowFuncCall(ParseState *pstate, WindowFunc *wfunc, foreach(lc, pstate->p_windowdefs) { - WindowDef *refwin = (WindowDef *) lfirst(lc); + WindowDef *refwin = (WindowDef *) lfirst(lc); winref++; if (refwin->name && strcmp(refwin->name, windef->name) == 0) @@ -162,14 +162,14 @@ transformWindowFuncCall(ParseState *pstate, WindowFunc *wfunc, foreach(lc, pstate->p_windowdefs) { - WindowDef *refwin = (WindowDef *) lfirst(lc); + WindowDef *refwin = (WindowDef *) lfirst(lc); winref++; if (refwin->refname && windef->refname && strcmp(refwin->refname, windef->refname) == 0) - /* matched on refname */ ; + /* matched on refname */ ; else if (!refwin->refname && !windef->refname) - /* matched, no refname */ ; + /* matched, no refname */ ; else continue; if (equal(refwin->partitionClause, windef->partitionClause) && @@ -242,13 +242,13 @@ parseCheckAggregates(ParseState *pstate, Query *qry) (errcode(ERRCODE_GROUPING_ERROR), errmsg("aggregates not allowed in WHERE clause"), parser_errposition(pstate, - locate_agg_of_level(qry->jointree->quals, 0)))); + locate_agg_of_level(qry->jointree->quals, 0)))); if (checkExprHasAggs((Node *) qry->jointree->fromlist)) ereport(ERROR, (errcode(ERRCODE_GROUPING_ERROR), errmsg("aggregates not allowed in JOIN conditions"), parser_errposition(pstate, - locate_agg_of_level((Node *) qry->jointree->fromlist, 0)))); + locate_agg_of_level((Node *) qry->jointree->fromlist, 0)))); /* * No aggregates allowed in GROUP BY clauses, either. @@ -277,10 +277,9 @@ parseCheckAggregates(ParseState *pstate, Query *qry) * If there are join alias vars involved, we have to flatten them to the * underlying vars, so that aliased and unaliased vars will be correctly * taken as equal. We can skip the expense of doing this if no rangetable - * entries are RTE_JOIN kind. - * We use the planner's flatten_join_alias_vars routine to do the - * flattening; it wants a PlannerInfo root node, which fortunately can be - * mostly dummy. + * entries are RTE_JOIN kind. We use the planner's flatten_join_alias_vars + * routine to do the flattening; it wants a PlannerInfo root node, which + * fortunately can be mostly dummy. */ if (hasJoinRTEs) { @@ -315,7 +314,7 @@ parseCheckAggregates(ParseState *pstate, Query *qry) * * Note: because we check resjunk tlist elements as well as regular ones, * this will also find ungrouped variables that came from ORDER BY and - * WINDOW clauses. For that matter, it's also going to examine the + * WINDOW clauses. For that matter, it's also going to examine the * grouping expressions themselves --- but they'll all pass the test ... */ clause = (Node *) qry->targetList; @@ -346,14 +345,14 @@ parseCheckAggregates(ParseState *pstate, Query *qry) * Check for window functions where they shouldn't be. * * We have to forbid window functions in WHERE, JOIN/ON, HAVING, GROUP BY, - * and window specifications. (Other clauses, such as RETURNING and LIMIT, + * and window specifications. (Other clauses, such as RETURNING and LIMIT, * have already been checked.) Transformation of all these clauses must * be completed already. */ void parseCheckWindowFuncs(ParseState *pstate, Query *qry) { - ListCell *l; + ListCell *l; /* This should only be called if we found window functions */ Assert(pstate->p_hasWindowFuncs); @@ -363,13 +362,13 @@ parseCheckWindowFuncs(ParseState *pstate, Query *qry) (errcode(ERRCODE_WINDOWING_ERROR), errmsg("window functions not allowed in WHERE clause"), parser_errposition(pstate, - locate_windowfunc(qry->jointree->quals)))); + locate_windowfunc(qry->jointree->quals)))); if (checkExprHasWindowFuncs((Node *) qry->jointree->fromlist)) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), errmsg("window functions not allowed in JOIN conditions"), parser_errposition(pstate, - locate_windowfunc((Node *) qry->jointree->fromlist)))); + locate_windowfunc((Node *) qry->jointree->fromlist)))); if (checkExprHasWindowFuncs(qry->havingQual)) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), @@ -386,14 +385,14 @@ parseCheckWindowFuncs(ParseState *pstate, Query *qry) if (checkExprHasWindowFuncs(expr)) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), - errmsg("window functions not allowed in GROUP BY clause"), + errmsg("window functions not allowed in GROUP BY clause"), parser_errposition(pstate, locate_windowfunc(expr)))); } foreach(l, qry->windowClause) { - WindowClause *wc = (WindowClause *) lfirst(l); + WindowClause *wc = (WindowClause *) lfirst(l); ListCell *l2; foreach(l2, wc->partitionClause) @@ -405,7 +404,7 @@ parseCheckWindowFuncs(ParseState *pstate, Query *qry) if (checkExprHasWindowFuncs(expr)) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), - errmsg("window functions not allowed in window definition"), + errmsg("window functions not allowed in window definition"), parser_errposition(pstate, locate_windowfunc(expr)))); } @@ -418,7 +417,7 @@ parseCheckWindowFuncs(ParseState *pstate, Query *qry) if (checkExprHasWindowFuncs(expr)) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), - errmsg("window functions not allowed in window definition"), + errmsg("window functions not allowed in window definition"), parser_errposition(pstate, locate_windowfunc(expr)))); } diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c index 2deffa9139..8a42f5bf0a 100644 --- a/src/backend/parser/parse_clause.c +++ b/src/backend/parser/parse_clause.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.188 2009/04/04 21:12:31 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.189 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -42,7 +42,7 @@ #define DISTINCT_ON_CLAUSE 2 #define PARTITION_CLAUSE 3 -static const char * const clauseText[] = { +static const char *const clauseText[] = { "ORDER BY", "GROUP BY", "DISTINCT ON", @@ -75,8 +75,8 @@ static Node *buildMergedJoinVar(ParseState *pstate, JoinType jointype, Var *l_colvar, Var *r_colvar); static TargetEntry *findTargetlistEntry(ParseState *pstate, Node *node, List **tlist, int clause); -static int get_matching_location(int sortgroupref, - List *sortgrouprefs, List *exprs); +static int get_matching_location(int sortgroupref, + List *sortgrouprefs, List *exprs); static List *addTargetToSortList(ParseState *pstate, TargetEntry *tle, List *sortlist, List *targetlist, SortBy *sortby, bool resolveUnknown); @@ -414,7 +414,7 @@ transformJoinOnClause(ParseState *pstate, JoinExpr *j, errmsg("JOIN/ON clause refers to \"%s\", which is not part of JOIN", rt_fetch(varno, pstate->p_rtable)->eref->aliasname), parser_errposition(pstate, - locate_var_of_relation(result, varno, 0)))); + locate_var_of_relation(result, varno, 0)))); } bms_free(clause_varnos); @@ -493,7 +493,7 @@ transformRangeSubselect(ParseState *pstate, RangeSubselect *r) (errcode(ERRCODE_SYNTAX_ERROR), errmsg("subquery in FROM cannot have SELECT INTO"), parser_errposition(pstate, - exprLocation((Node *) query->intoClause)))); + exprLocation((Node *) query->intoClause)))); /* * The subquery cannot make use of any variables from FROM items created @@ -515,7 +515,7 @@ transformRangeSubselect(ParseState *pstate, RangeSubselect *r) (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), errmsg("subquery in FROM cannot refer to other relations of same query level"), parser_errposition(pstate, - locate_var_of_level((Node *) query, 1)))); + locate_var_of_level((Node *) query, 1)))); } /* @@ -584,7 +584,7 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r) checkExprHasWindowFuncs(funcexpr)) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), - errmsg("cannot use window function in function expression in FROM"), + errmsg("cannot use window function in function expression in FROM"), parser_errposition(pstate, locate_windowfunc(funcexpr)))); @@ -649,7 +649,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, if (IsA(n, RangeVar)) { /* Plain relation reference, or perhaps a CTE reference */ - RangeVar *rv = (RangeVar *) n; + RangeVar *rv = (RangeVar *) n; RangeTblRef *rtr; RangeTblEntry *rte = NULL; int rtindex; @@ -658,7 +658,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, if (!rv->schemaname) { CommonTableExpr *cte; - Index levelsup; + Index levelsup; cte = scanNameSpaceForCTE(pstate, rv->relname, &levelsup); if (cte) @@ -1432,11 +1432,11 @@ transformGroupClause(ParseState *pstate, List *grouplist, * info from the (first) matching ORDER BY item. This means that if * you write something like "GROUP BY foo ORDER BY foo USING <<<", the * GROUP BY operation silently takes on the equality semantics implied - * by the ORDER BY. There are two reasons to do this: it improves - * the odds that we can implement both GROUP BY and ORDER BY with a - * single sort step, and it allows the user to choose the equality - * semantics used by GROUP BY, should she be working with a datatype - * that has more than one equality operator. + * by the ORDER BY. There are two reasons to do this: it improves the + * odds that we can implement both GROUP BY and ORDER BY with a single + * sort step, and it allows the user to choose the equality semantics + * used by GROUP BY, should she be working with a datatype that has + * more than one equality operator. */ if (tle->ressortgroupref > 0) { @@ -1456,8 +1456,8 @@ transformGroupClause(ParseState *pstate, List *grouplist, } /* - * If no match in ORDER BY, just add it to the result using - * default sort/group semantics. + * If no match in ORDER BY, just add it to the result using default + * sort/group semantics. */ if (!found) result = addTargetToGroupList(pstate, tle, @@ -1516,10 +1516,10 @@ transformWindowDefinitions(ParseState *pstate, foreach(lc, windowdefs) { - WindowDef *windef = (WindowDef *) lfirst(lc); + WindowDef *windef = (WindowDef *) lfirst(lc); WindowClause *refwc = NULL; - List *partitionClause; - List *orderClause; + List *partitionClause; + List *orderClause; WindowClause *wc; winref++; @@ -1550,8 +1550,8 @@ transformWindowDefinitions(ParseState *pstate, /* * Transform PARTITION and ORDER specs, if any. These are treated - * exactly like top-level GROUP BY and ORDER BY clauses, including - * the special handling of nondefault operator semantics. + * exactly like top-level GROUP BY and ORDER BY clauses, including the + * special handling of nondefault operator semantics. */ orderClause = transformSortClause(pstate, windef->orderClause, @@ -1573,19 +1573,19 @@ transformWindowDefinitions(ParseState *pstate, /* * Per spec, a windowdef that references a previous one copies the * previous partition clause (and mustn't specify its own). It can - * specify its own ordering clause. but only if the previous one - * had none. It always specifies its own frame clause, and the - * previous one must not have a frame clause. (Yeah, it's bizarre - * that each of these cases works differently, but SQL:2008 says so; - * see 7.11 <window clause> syntax rule 10 and general rule 1.) + * specify its own ordering clause. but only if the previous one had + * none. It always specifies its own frame clause, and the previous + * one must not have a frame clause. (Yeah, it's bizarre that each of + * these cases works differently, but SQL:2008 says so; see 7.11 + * <window clause> syntax rule 10 and general rule 1.) */ if (refwc) { if (partitionClause) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), - errmsg("cannot override PARTITION BY clause of window \"%s\"", - windef->refname), + errmsg("cannot override PARTITION BY clause of window \"%s\"", + windef->refname), parser_errposition(pstate, windef->location))); wc->partitionClause = copyObject(refwc->partitionClause); } @@ -1596,8 +1596,8 @@ transformWindowDefinitions(ParseState *pstate, if (orderClause && refwc->orderClause) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), - errmsg("cannot override ORDER BY clause of window \"%s\"", - windef->refname), + errmsg("cannot override ORDER BY clause of window \"%s\"", + windef->refname), parser_errposition(pstate, windef->location))); if (orderClause) { @@ -1652,19 +1652,19 @@ transformDistinctClause(ParseState *pstate, ListCell *tlitem; /* - * The distinctClause should consist of all ORDER BY items followed - * by all other non-resjunk targetlist items. There must not be any - * resjunk ORDER BY items --- that would imply that we are sorting - * by a value that isn't necessarily unique within a DISTINCT group, - * so the results wouldn't be well-defined. This construction - * ensures we follow the rule that sortClause and distinctClause match; - * in fact the sortClause will always be a prefix of distinctClause. + * The distinctClause should consist of all ORDER BY items followed by all + * other non-resjunk targetlist items. There must not be any resjunk + * ORDER BY items --- that would imply that we are sorting by a value that + * isn't necessarily unique within a DISTINCT group, so the results + * wouldn't be well-defined. This construction ensures we follow the rule + * that sortClause and distinctClause match; in fact the sortClause will + * always be a prefix of distinctClause. * - * Note a corner case: the same TLE could be in the ORDER BY list - * multiple times with different sortops. We have to include it in - * the distinctClause the same way to preserve the prefix property. - * The net effect will be that the TLE value will be made unique - * according to both sortops. + * Note a corner case: the same TLE could be in the ORDER BY list multiple + * times with different sortops. We have to include it in the + * distinctClause the same way to preserve the prefix property. The net + * effect will be that the TLE value will be made unique according to both + * sortops. */ foreach(slitem, sortClause) { @@ -1681,8 +1681,8 @@ transformDistinctClause(ParseState *pstate, } /* - * Now add any remaining non-resjunk tlist items, using default - * sort/group semantics for their data types. + * Now add any remaining non-resjunk tlist items, using default sort/group + * semantics for their data types. */ foreach(tlitem, *targetlist) { @@ -1724,11 +1724,11 @@ transformDistinctOnClause(ParseState *pstate, List *distinctlist, /* * Add all the DISTINCT ON expressions to the tlist (if not already - * present, they are added as resjunk items). Assign sortgroupref - * numbers to them, and make a list of these numbers. (NB: we rely - * below on the sortgrouprefs list being one-for-one with the original - * distinctlist. Also notice that we could have duplicate DISTINCT ON - * expressions and hence duplicate entries in sortgrouprefs.) + * present, they are added as resjunk items). Assign sortgroupref numbers + * to them, and make a list of these numbers. (NB: we rely below on the + * sortgrouprefs list being one-for-one with the original distinctlist. + * Also notice that we could have duplicate DISTINCT ON expressions and + * hence duplicate entries in sortgrouprefs.) */ foreach(lc, distinctlist) { @@ -1743,12 +1743,12 @@ transformDistinctOnClause(ParseState *pstate, List *distinctlist, } /* - * If the user writes both DISTINCT ON and ORDER BY, adopt the - * sorting semantics from ORDER BY items that match DISTINCT ON - * items, and also adopt their column sort order. We insist that - * the distinctClause and sortClause match, so throw error if we - * find the need to add any more distinctClause items after we've - * skipped an ORDER BY item that wasn't in DISTINCT ON. + * If the user writes both DISTINCT ON and ORDER BY, adopt the sorting + * semantics from ORDER BY items that match DISTINCT ON items, and also + * adopt their column sort order. We insist that the distinctClause and + * sortClause match, so throw error if we find the need to add any more + * distinctClause items after we've skipped an ORDER BY item that wasn't + * in DISTINCT ON. */ skipped_sortitem = false; foreach(lc, sortClause) @@ -1762,9 +1762,9 @@ transformDistinctOnClause(ParseState *pstate, List *distinctlist, (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), errmsg("SELECT DISTINCT ON expressions must match initial ORDER BY expressions"), parser_errposition(pstate, - get_matching_location(scl->tleSortGroupRef, - sortgrouprefs, - distinctlist)))); + get_matching_location(scl->tleSortGroupRef, + sortgrouprefs, + distinctlist)))); else result = lappend(result, copyObject(scl)); } @@ -1774,8 +1774,8 @@ transformDistinctOnClause(ParseState *pstate, List *distinctlist, /* * Now add any remaining DISTINCT ON items, using default sort/group - * semantics for their data types. (Note: this is pretty questionable; - * if the ORDER BY list doesn't include all the DISTINCT ON items and more + * semantics for their data types. (Note: this is pretty questionable; if + * the ORDER BY list doesn't include all the DISTINCT ON items and more * besides, you certainly aren't using DISTINCT ON in the intended way, * and you probably aren't going to get consistent results. It might be * better to throw an error or warning here. But historically we've @@ -1870,9 +1870,9 @@ addTargetToSortList(ParseState *pstate, TargetEntry *tle, * Rather than clutter the API of get_sort_group_operators and the other * functions we're about to use, make use of error context callback to * mark any error reports with a parse position. We point to the operator - * location if present, else to the expression being sorted. (NB: use - * the original untransformed expression here; the TLE entry might well - * point at a duplicate expression in the regular SELECT list.) + * location if present, else to the expression being sorted. (NB: use the + * original untransformed expression here; the TLE entry might well point + * at a duplicate expression in the regular SELECT list.) */ location = sortby->location; if (location < 0) diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c index 8513741fa4..0aec4a850e 100644 --- a/src/backend/parser/parse_coerce.c +++ b/src/backend/parser/parse_coerce.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.176 2009/05/12 03:11:02 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.177 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -200,10 +200,10 @@ coerce_type(ParseState *pstate, Node *node, * For most types we pass typmod -1 to the input routine, because * existing input routines follow implicit-coercion semantics for * length checks, which is not always what we want here. Any length - * constraint will be applied later by our caller. An exception + * constraint will be applied later by our caller. An exception * however is the INTERVAL type, for which we *must* pass the typmod - * or it won't be able to obey the bizarre SQL-spec input rules. - * (Ugly as sin, but so is this part of the spec...) + * or it won't be able to obey the bizarre SQL-spec input rules. (Ugly + * as sin, but so is this part of the spec...) */ if (baseTypeId == INTERVALOID) inputTypeMod = baseTypeMod; @@ -226,8 +226,8 @@ coerce_type(ParseState *pstate, Node *node, newcon->location = location; /* - * Set up to point at the constant's text if the input routine - * throws an error. + * Set up to point at the constant's text if the input routine throws + * an error. */ setup_parser_errposition_callback(&pcbstate, pstate, con->location); @@ -510,9 +510,10 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *target_typeids, continue; #ifdef NOT_USED /* not implemented yet */ + /* - * If input is record[] and target is a composite array type, - * assume we can coerce (may need tighter checking here) + * If input is record[] and target is a composite array type, assume + * we can coerce (may need tighter checking here) */ if (inputTypeId == RECORDARRAYOID && is_complex_array(targetTypeId)) @@ -984,7 +985,7 @@ coerce_to_boolean(ParseState *pstate, Node *node, if (inputTypeId != BOOLOID) { - Node *newnode; + Node *newnode; newnode = coerce_to_target_type(pstate, node, inputTypeId, BOOLOID, -1, @@ -995,8 +996,8 @@ coerce_to_boolean(ParseState *pstate, Node *node, ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), /* translator: first %s is name of a SQL construct, eg WHERE */ - errmsg("argument of %s must be type boolean, not type %s", - constructName, format_type_be(inputTypeId)), + errmsg("argument of %s must be type boolean, not type %s", + constructName, format_type_be(inputTypeId)), parser_errposition(pstate, exprLocation(node)))); node = newnode; } @@ -1031,7 +1032,7 @@ coerce_to_specific_type(ParseState *pstate, Node *node, if (inputTypeId != targetTypeId) { - Node *newnode; + Node *newnode; newnode = coerce_to_target_type(pstate, node, inputTypeId, targetTypeId, -1, @@ -1104,7 +1105,7 @@ select_common_type(ParseState *pstate, List *exprs, const char *context, { Node *pexpr; Oid ptype; - TYPCATEGORY pcategory; + TYPCATEGORY pcategory; bool pispreferred; ListCell *lc; @@ -1122,8 +1123,8 @@ select_common_type(ParseState *pstate, List *exprs, const char *context, { for_each_cell(lc, lc) { - Node *nexpr = (Node *) lfirst(lc); - Oid ntype = exprType(nexpr); + Node *nexpr = (Node *) lfirst(lc); + Oid ntype = exprType(nexpr); if (ntype != ptype) break; @@ -1137,9 +1138,9 @@ select_common_type(ParseState *pstate, List *exprs, const char *context, } /* - * Nope, so set up for the full algorithm. Note that at this point, - * lc points to the first list item with type different from pexpr's; - * we need not re-examine any items the previous loop advanced over. + * Nope, so set up for the full algorithm. Note that at this point, lc + * points to the first list item with type different from pexpr's; we need + * not re-examine any items the previous loop advanced over. */ ptype = getBaseType(ptype); get_type_category_preferred(ptype, &pcategory, &pispreferred); @@ -1152,7 +1153,7 @@ select_common_type(ParseState *pstate, List *exprs, const char *context, /* move on to next one if no new information... */ if (ntype != UNKNOWNOID && ntype != ptype) { - TYPCATEGORY ncategory; + TYPCATEGORY ncategory; bool nispreferred; get_type_category_preferred(ntype, &ncategory, &nispreferred); @@ -1422,14 +1423,14 @@ check_generic_type_consistency(Oid *actual_arg_types, * * When allow_poly is false, we are not expecting any of the actual_arg_types * to be polymorphic, and we should not return a polymorphic result type - * either. When allow_poly is true, it is okay to have polymorphic "actual" + * either. When allow_poly is true, it is okay to have polymorphic "actual" * arg types, and we can return ANYARRAY or ANYELEMENT as the result. (This * case is currently used only to check compatibility of an aggregate's * declaration with the underlying transfn.) * * A special case is that we could see ANYARRAY as an actual_arg_type even * when allow_poly is false (this is possible only because pg_statistic has - * columns shown as anyarray in the catalogs). We allow this to match a + * columns shown as anyarray in the catalogs). We allow this to match a * declared ANYARRAY argument, but only if there is no ANYELEMENT argument * or result (since we can't determine a specific element type to match to * ANYELEMENT). Note this means that functions taking ANYARRAY had better @@ -1995,8 +1996,8 @@ find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId, /* * If we still haven't found a possibility, consider automatic casting - * using I/O functions. We allow assignment casts to string types - * and explicit casts from string types to be handled this way. (The + * using I/O functions. We allow assignment casts to string types and + * explicit casts from string types to be handled this way. (The * CoerceViaIO mechanism is a lot more general than that, but this is * all we want to allow in the absence of a pg_cast entry.) It would * probably be better to insist on explicit casts in both directions, diff --git a/src/backend/parser/parse_cte.c b/src/backend/parser/parse_cte.c index 7da578c22f..c18b4336ad 100644 --- a/src/backend/parser/parse_cte.c +++ b/src/backend/parser/parse_cte.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_cte.c,v 2.5 2009/01/01 17:23:45 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_cte.c,v 2.6 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -25,7 +25,7 @@ typedef enum { RECURSION_OK, - RECURSION_NONRECURSIVETERM, /* inside the left-hand term */ + RECURSION_NONRECURSIVETERM, /* inside the left-hand term */ RECURSION_SUBLINK, /* inside a sublink */ RECURSION_OUTERJOIN, /* inside nullable side of an outer join */ RECURSION_INTERSECT, /* underneath INTERSECT (ALL) */ @@ -33,7 +33,7 @@ typedef enum } RecursionContext; /* Associated error messages --- each must have one %s for CTE name */ -static const char * const recursion_errormsgs[] = { +static const char *const recursion_errormsgs[] = { /* RECURSION_OK */ NULL, /* RECURSION_NONRECURSIVETERM */ @@ -56,10 +56,11 @@ static const char * const recursion_errormsgs[] = { */ typedef struct CteItem { - CommonTableExpr *cte; /* One CTE to examine */ - int id; /* Its ID number for dependencies */ - Node *non_recursive_term; /* Its nonrecursive part, if identified */ - Bitmapset *depends_on; /* CTEs depended on (not including self) */ + CommonTableExpr *cte; /* One CTE to examine */ + int id; /* Its ID number for dependencies */ + Node *non_recursive_term; /* Its nonrecursive part, if + * identified */ + Bitmapset *depends_on; /* CTEs depended on (not including self) */ } CteItem; /* CteState is what we need to pass around in the tree walkers */ @@ -67,7 +68,7 @@ typedef struct CteState { /* global state: */ ParseState *pstate; /* global parse state */ - CteItem *items; /* array of CTEs and extra data */ + CteItem *items; /* array of CTEs and extra data */ int numitems; /* number of CTEs */ /* working state during a tree walk: */ int curitem; /* index of item currently being examined */ @@ -94,8 +95,8 @@ static void checkWellFormedSelectStmt(SelectStmt *stmt, CteState *cstate); /* * transformWithClause - - * Transform the list of WITH clause "common table expressions" into - * Query nodes. + * Transform the list of WITH clause "common table expressions" into + * Query nodes. * * The result is the list of transformed CTEs to be put into the output * Query. (This is in fact the same as the ending value of p_ctenamespace, @@ -111,11 +112,11 @@ transformWithClause(ParseState *pstate, WithClause *withClause) Assert(pstate->p_future_ctes == NIL); /* - * For either type of WITH, there must not be duplicate CTE names in - * the list. Check this right away so we needn't worry later. + * For either type of WITH, there must not be duplicate CTE names in the + * list. Check this right away so we needn't worry later. * - * Also, tentatively mark each CTE as non-recursive, and initialize - * its reference count to zero. + * Also, tentatively mark each CTE as non-recursive, and initialize its + * reference count to zero. */ foreach(lc, withClause->ctes) { @@ -129,8 +130,8 @@ transformWithClause(ParseState *pstate, WithClause *withClause) if (strcmp(cte->ctename, cte2->ctename) == 0) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_ALIAS), - errmsg("WITH query name \"%s\" specified more than once", - cte2->ctename), + errmsg("WITH query name \"%s\" specified more than once", + cte2->ctename), parser_errposition(pstate, cte2->location))); } @@ -141,12 +142,12 @@ transformWithClause(ParseState *pstate, WithClause *withClause) if (withClause->recursive) { /* - * For WITH RECURSIVE, we rearrange the list elements if needed - * to eliminate forward references. First, build a work array - * and set up the data structure needed by the tree walkers. + * For WITH RECURSIVE, we rearrange the list elements if needed to + * eliminate forward references. First, build a work array and set up + * the data structure needed by the tree walkers. */ - CteState cstate; - int i; + CteState cstate; + int i; cstate.pstate = pstate; cstate.numitems = list_length(withClause->ctes); @@ -171,10 +172,10 @@ transformWithClause(ParseState *pstate, WithClause *withClause) checkWellFormedRecursion(&cstate); /* - * Set up the ctenamespace for parse analysis. Per spec, all - * the WITH items are visible to all others, so stuff them all in - * before parse analysis. We build the list in safe processing - * order so that the planner can process the queries in sequence. + * Set up the ctenamespace for parse analysis. Per spec, all the WITH + * items are visible to all others, so stuff them all in before parse + * analysis. We build the list in safe processing order so that the + * planner can process the queries in sequence. */ for (i = 0; i < cstate.numitems; i++) { @@ -191,14 +192,14 @@ transformWithClause(ParseState *pstate, WithClause *withClause) CommonTableExpr *cte = cstate.items[i].cte; /* - * If it's recursive, we have to do a throwaway parse analysis - * of the non-recursive term in order to determine the set of - * output columns for the recursive CTE. + * If it's recursive, we have to do a throwaway parse analysis of + * the non-recursive term in order to determine the set of output + * columns for the recursive CTE. */ if (cte->cterecursive) { - Node *nrt; - Query *nrq; + Node *nrt; + Query *nrq; if (!cstate.items[i].non_recursive_term) elog(ERROR, "could not find non-recursive term for %s", @@ -216,11 +217,10 @@ transformWithClause(ParseState *pstate, WithClause *withClause) { /* * For non-recursive WITH, just analyze each CTE in sequence and then - * add it to the ctenamespace. This corresponds to the spec's - * definition of the scope of each WITH name. However, to allow - * error reports to be aware of the possibility of an erroneous - * reference, we maintain a list in p_future_ctes of the - * not-yet-visible CTEs. + * add it to the ctenamespace. This corresponds to the spec's + * definition of the scope of each WITH name. However, to allow error + * reports to be aware of the possibility of an erroneous reference, + * we maintain a list in p_future_ctes of the not-yet-visible CTEs. */ pstate->p_future_ctes = list_copy(withClause->ctes); @@ -232,7 +232,7 @@ transformWithClause(ParseState *pstate, WithClause *withClause) pstate->p_ctenamespace = lappend(pstate->p_ctenamespace, cte); pstate->p_future_ctes = list_delete_first(pstate->p_future_ctes); } - } + } return pstate->p_ctenamespace; } @@ -246,7 +246,7 @@ transformWithClause(ParseState *pstate, WithClause *withClause) static void analyzeCTE(ParseState *pstate, CommonTableExpr *cte) { - Query *query; + Query *query; /* Analysis not done already */ Assert(IsA(cte->ctequery, SelectStmt)); @@ -268,7 +268,7 @@ analyzeCTE(ParseState *pstate, CommonTableExpr *cte) (errcode(ERRCODE_SYNTAX_ERROR), errmsg("subquery in WITH cannot have SELECT INTO"), parser_errposition(pstate, - exprLocation((Node *) query->intoClause)))); + exprLocation((Node *) query->intoClause)))); if (!cte->cterecursive) { @@ -279,9 +279,9 @@ analyzeCTE(ParseState *pstate, CommonTableExpr *cte) { /* * Verify that the previously determined output column types match - * what the query really produced. We have to check this because - * the recursive term could have overridden the non-recursive term, - * and we don't have any easy way to fix that. + * what the query really produced. We have to check this because the + * recursive term could have overridden the non-recursive term, and we + * don't have any easy way to fix that. */ ListCell *lctlist, *lctyp, @@ -294,7 +294,7 @@ analyzeCTE(ParseState *pstate, CommonTableExpr *cte) foreach(lctlist, query->targetList) { TargetEntry *te = (TargetEntry *) lfirst(lctlist); - Node *texpr; + Node *texpr; if (te->resjunk) continue; @@ -310,7 +310,7 @@ analyzeCTE(ParseState *pstate, CommonTableExpr *cte) errmsg("recursive query \"%s\" column %d has type %s in non-recursive term but type %s overall", cte->ctename, varattno, format_type_with_typemod(lfirst_oid(lctyp), - lfirst_int(lctypmod)), + lfirst_int(lctypmod)), format_type_with_typemod(exprType(texpr), exprTypmod(texpr))), errhint("Cast the output of the non-recursive term to the correct type."), @@ -318,7 +318,7 @@ analyzeCTE(ParseState *pstate, CommonTableExpr *cte) lctyp = lnext(lctyp); lctypmod = lnext(lctypmod); } - if (lctyp != NULL || lctypmod != NULL) /* shouldn't happen */ + if (lctyp != NULL || lctypmod != NULL) /* shouldn't happen */ elog(ERROR, "wrong number of output columns in WITH"); } } @@ -335,10 +335,10 @@ analyzeCTETargetList(ParseState *pstate, CommonTableExpr *cte, List *tlist) /* * We need to determine column names and types. The alias column names - * override anything coming from the query itself. (Note: the SQL spec - * says that the alias list must be empty or exactly as long as the - * output column set; but we allow it to be shorter for consistency - * with Alias handling.) + * override anything coming from the query itself. (Note: the SQL spec + * says that the alias list must be empty or exactly as long as the output + * column set; but we allow it to be shorter for consistency with Alias + * handling.) */ cte->ctecolnames = copyObject(cte->aliascolnames); cte->ctecoltypes = cte->ctecoltypmods = NIL; @@ -363,13 +363,14 @@ analyzeCTETargetList(ParseState *pstate, CommonTableExpr *cte, List *tlist) } coltype = exprType((Node *) te->expr); coltypmod = exprTypmod((Node *) te->expr); + /* * If the CTE is recursive, force the exposed column type of any - * "unknown" column to "text". This corresponds to the fact that - * SELECT 'foo' UNION SELECT 'bar' will ultimately produce text. - * We might see "unknown" as a result of an untyped literal in - * the non-recursive term's select list, and if we don't convert - * to text then we'll have a mismatch against the UNION result. + * "unknown" column to "text". This corresponds to the fact that + * SELECT 'foo' UNION SELECT 'bar' will ultimately produce text. We + * might see "unknown" as a result of an untyped literal in the + * non-recursive term's select list, and if we don't convert to text + * then we'll have a mismatch against the UNION result. */ if (cte->cterecursive && coltype == UNKNOWNOID) { @@ -426,21 +427,21 @@ makeDependencyGraphWalker(Node *node, CteState *cstate) /* If unqualified name, might be a CTE reference */ if (!rv->schemaname) { - ListCell *lc; - int i; + ListCell *lc; + int i; /* ... but first see if it's captured by an inner WITH */ foreach(lc, cstate->innerwiths) { - List *withlist = (List *) lfirst(lc); - ListCell *lc2; + List *withlist = (List *) lfirst(lc); + ListCell *lc2; foreach(lc2, withlist) { CommonTableExpr *cte = (CommonTableExpr *) lfirst(lc2); if (strcmp(rv->relname, cte->ctename) == 0) - return false; /* yes, so bail out */ + return false; /* yes, so bail out */ } } @@ -451,7 +452,7 @@ makeDependencyGraphWalker(Node *node, CteState *cstate) if (strcmp(rv->relname, cte->ctename) == 0) { - int myindex = cstate->curitem; + int myindex = cstate->curitem; if (i != myindex) { @@ -474,7 +475,7 @@ makeDependencyGraphWalker(Node *node, CteState *cstate) if (IsA(node, SelectStmt)) { SelectStmt *stmt = (SelectStmt *) node; - ListCell *lc; + ListCell *lc; if (stmt->withClause) { @@ -482,8 +483,8 @@ makeDependencyGraphWalker(Node *node, CteState *cstate) { /* * In the RECURSIVE case, all query names of the WITH are - * visible to all WITH items as well as the main query. - * So push them all on, process, pop them all off. + * visible to all WITH items as well as the main query. So + * push them all on, process, pop them all off. */ cstate->innerwiths = lcons(stmt->withClause->ctes, cstate->innerwiths); @@ -501,8 +502,8 @@ makeDependencyGraphWalker(Node *node, CteState *cstate) else { /* - * In the non-RECURSIVE case, query names are visible to - * the WITH items after them and to the main query. + * In the non-RECURSIVE case, query names are visible to the + * WITH items after them and to the main query. */ ListCell *cell1; @@ -528,9 +529,9 @@ makeDependencyGraphWalker(Node *node, CteState *cstate) if (IsA(node, WithClause)) { /* - * Prevent raw_expression_tree_walker from recursing directly into - * a WITH clause. We need that to happen only under the control - * of the code above. + * Prevent raw_expression_tree_walker from recursing directly into a + * WITH clause. We need that to happen only under the control of the + * code above. */ return false; } @@ -545,7 +546,8 @@ makeDependencyGraphWalker(Node *node, CteState *cstate) static void TopologicalSort(ParseState *pstate, CteItem *items, int numitems) { - int i, j; + int i, + j; /* for each position in sequence ... */ for (i = 0; i < numitems; i++) @@ -561,24 +563,25 @@ TopologicalSort(ParseState *pstate, CteItem *items, int numitems) if (j >= numitems) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("mutual recursion between WITH items is not implemented"), + errmsg("mutual recursion between WITH items is not implemented"), parser_errposition(pstate, items[i].cte->location))); /* - * Found one. Move it to front and remove it from every other - * item's dependencies. + * Found one. Move it to front and remove it from every other item's + * dependencies. */ if (i != j) { - CteItem tmp; - + CteItem tmp; + tmp = items[i]; items[i] = items[j]; items[j] = tmp; } + /* - * Items up through i are known to have no dependencies left, - * so we can skip them in this loop. + * Items up through i are known to have no dependencies left, so we + * can skip them in this loop. */ for (j = i + 1; j < numitems; j++) { @@ -600,9 +603,9 @@ checkWellFormedRecursion(CteState *cstate) for (i = 0; i < cstate->numitems; i++) { CommonTableExpr *cte = cstate->items[i].cte; - SelectStmt *stmt = (SelectStmt *) cte->ctequery; + SelectStmt *stmt = (SelectStmt *) cte->ctequery; - Assert(IsA(stmt, SelectStmt)); /* not analyzed yet */ + Assert(IsA(stmt, SelectStmt)); /* not analyzed yet */ /* Ignore items that weren't found to be recursive */ if (!cte->cterecursive) @@ -631,22 +634,22 @@ checkWellFormedRecursion(CteState *cstate) cstate->context = RECURSION_OK; checkWellFormedRecursionWalker((Node *) stmt->rarg, cstate); Assert(cstate->innerwiths == NIL); - if (cstate->selfrefcount != 1) /* shouldn't happen */ + if (cstate->selfrefcount != 1) /* shouldn't happen */ elog(ERROR, "missing recursive reference"); /* - * Disallow ORDER BY and similar decoration atop the UNION. - * These don't make sense because it's impossible to figure out what - * they mean when we have only part of the recursive query's results. - * (If we did allow them, we'd have to check for recursive references + * Disallow ORDER BY and similar decoration atop the UNION. These + * don't make sense because it's impossible to figure out what they + * mean when we have only part of the recursive query's results. (If + * we did allow them, we'd have to check for recursive references * inside these subtrees.) */ if (stmt->sortClause) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("ORDER BY in a recursive query is not implemented"), + errmsg("ORDER BY in a recursive query is not implemented"), parser_errposition(cstate->pstate, - exprLocation((Node *) stmt->sortClause)))); + exprLocation((Node *) stmt->sortClause)))); if (stmt->limitOffset) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), @@ -664,7 +667,7 @@ checkWellFormedRecursion(CteState *cstate) (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("FOR UPDATE/SHARE in a recursive query is not implemented"), parser_errposition(cstate->pstate, - exprLocation((Node *) stmt->lockingClause)))); + exprLocation((Node *) stmt->lockingClause)))); /* * Save non_recursive_term. @@ -690,21 +693,21 @@ checkWellFormedRecursionWalker(Node *node, CteState *cstate) /* If unqualified name, might be a CTE reference */ if (!rv->schemaname) { - ListCell *lc; + ListCell *lc; CommonTableExpr *mycte; /* ... but first see if it's captured by an inner WITH */ foreach(lc, cstate->innerwiths) { - List *withlist = (List *) lfirst(lc); - ListCell *lc2; + List *withlist = (List *) lfirst(lc); + ListCell *lc2; foreach(lc2, withlist) { CommonTableExpr *cte = (CommonTableExpr *) lfirst(lc2); if (strcmp(rv->relname, cte->ctename) == 0) - return false; /* yes, so bail out */ + return false; /* yes, so bail out */ } } @@ -735,7 +738,7 @@ checkWellFormedRecursionWalker(Node *node, CteState *cstate) if (IsA(node, SelectStmt)) { SelectStmt *stmt = (SelectStmt *) node; - ListCell *lc; + ListCell *lc; if (stmt->withClause) { @@ -743,8 +746,8 @@ checkWellFormedRecursionWalker(Node *node, CteState *cstate) { /* * In the RECURSIVE case, all query names of the WITH are - * visible to all WITH items as well as the main query. - * So push them all on, process, pop them all off. + * visible to all WITH items as well as the main query. So + * push them all on, process, pop them all off. */ cstate->innerwiths = lcons(stmt->withClause->ctes, cstate->innerwiths); @@ -760,8 +763,8 @@ checkWellFormedRecursionWalker(Node *node, CteState *cstate) else { /* - * In the non-RECURSIVE case, query names are visible to - * the WITH items after them and to the main query. + * In the non-RECURSIVE case, query names are visible to the + * WITH items after them and to the main query. */ ListCell *cell1; @@ -779,22 +782,22 @@ checkWellFormedRecursionWalker(Node *node, CteState *cstate) } } else - checkWellFormedSelectStmt(stmt, cstate); + checkWellFormedSelectStmt(stmt, cstate); /* We're done examining the SelectStmt */ return false; } if (IsA(node, WithClause)) { /* - * Prevent raw_expression_tree_walker from recursing directly into - * a WITH clause. We need that to happen only under the control - * of the code above. + * Prevent raw_expression_tree_walker from recursing directly into a + * WITH clause. We need that to happen only under the control of the + * code above. */ return false; } if (IsA(node, JoinExpr)) { - JoinExpr *j = (JoinExpr *) node; + JoinExpr *j = (JoinExpr *) node; switch (j->jointype) { @@ -835,7 +838,7 @@ checkWellFormedRecursionWalker(Node *node, CteState *cstate) } if (IsA(node, SubLink)) { - SubLink *sl = (SubLink *) node; + SubLink *sl = (SubLink *) node; /* * we intentionally override outer context, since subquery is diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c index 2bf6174866..08e062d311 100644 --- a/src/backend/parser/parse_expr.c +++ b/src/backend/parser/parse_expr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.240 2009/01/22 20:16:05 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.241 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -147,10 +147,10 @@ transformExpr(ParseState *pstate, Node *expr) TypeCast *tc = (TypeCast *) expr; /* - * If the subject of the typecast is an ARRAY[] construct - * and the target type is an array type, we invoke - * transformArrayExpr() directly so that we can pass down - * the type information. This avoids some cases where + * If the subject of the typecast is an ARRAY[] construct and + * the target type is an array type, we invoke + * transformArrayExpr() directly so that we can pass down the + * type information. This avoids some cases where * transformArrayExpr() might not infer the correct type. */ if (IsA(tc->arg, A_ArrayExpr)) @@ -173,8 +173,8 @@ transformExpr(ParseState *pstate, Node *expr) } /* - * Corner case: ARRAY[] cast to a non-array type. - * Fall through to do it the standard way. + * Corner case: ARRAY[] cast to a non-array type. Fall + * through to do it the standard way. */ } @@ -961,10 +961,10 @@ transformAExprIn(ParseState *pstate, A_Expr *a) * We try to generate a ScalarArrayOpExpr from IN/NOT IN, but this is only * possible if the inputs are all scalars (no RowExprs) and there is a * suitable array type available. If not, we fall back to a boolean - * condition tree with multiple copies of the lefthand expression. - * Also, any IN-list items that contain Vars are handled as separate - * boolean conditions, because that gives the planner more scope for - * optimization on such clauses. + * condition tree with multiple copies of the lefthand expression. Also, + * any IN-list items that contain Vars are handled as separate boolean + * conditions, because that gives the planner more scope for optimization + * on such clauses. * * First step: transform all the inputs, and detect whether any are * RowExprs or contain Vars. @@ -985,8 +985,8 @@ transformAExprIn(ParseState *pstate, A_Expr *a) } /* - * ScalarArrayOpExpr is only going to be useful if there's more than - * one non-Var righthand item. Also, it won't work for RowExprs. + * ScalarArrayOpExpr is only going to be useful if there's more than one + * non-Var righthand item. Also, it won't work for RowExprs. */ if (!haveRowExpr && list_length(rnonvars) > 1) { @@ -995,7 +995,7 @@ transformAExprIn(ParseState *pstate, A_Expr *a) Oid array_type; /* - * Try to select a common type for the array elements. Note that + * Try to select a common type for the array elements. Note that * since the LHS' type is first in the list, it will be preferred when * there is doubt (eg, when all the RHS items are unknown literals). * @@ -1266,7 +1266,7 @@ transformSubLink(ParseState *pstate, SubLink *sublink) (errcode(ERRCODE_SYNTAX_ERROR), errmsg("subquery cannot have SELECT INTO"), parser_errposition(pstate, - exprLocation((Node *) qtree->intoClause)))); + exprLocation((Node *) qtree->intoClause)))); sublink->subselect = (Node *) qtree; @@ -1398,12 +1398,12 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a, Oid coerce_type; bool coerce_hard; - /* - * Transform the element expressions + /* + * Transform the element expressions * - * Assume that the array is one-dimensional unless we find an - * array-type element expression. - */ + * Assume that the array is one-dimensional unless we find an array-type + * element expression. + */ newa->multidims = false; foreach(element, a->elements) { @@ -1411,8 +1411,8 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a, Node *newe; /* - * If an element is itself an A_ArrayExpr, recurse directly so that - * we can pass down any target type we were given. + * If an element is itself an A_ArrayExpr, recurse directly so that we + * can pass down any target type we were given. */ if (IsA(e, A_ArrayExpr)) { @@ -1428,9 +1428,10 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a, else { newe = transformExpr(pstate, e); + /* - * Check for sub-array expressions, if we haven't already - * found one. + * Check for sub-array expressions, if we haven't already found + * one. */ if (!newa->multidims && type_is_array(exprType(newe))) newa->multidims = true; @@ -1439,7 +1440,7 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a, newelems = lappend(newelems, newe); } - /* + /* * Select a target type for the elements. * * If we haven't been given a target array type, we must try to deduce a @@ -1473,8 +1474,8 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a, if (!OidIsValid(element_type)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("could not find element type for data type %s", - format_type_be(array_type)), + errmsg("could not find element type for data type %s", + format_type_be(array_type)), parser_errposition(pstate, a->location))); } else @@ -1492,7 +1493,7 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a, } /* - * Coerce elements to target type + * Coerce elements to target type * * If the array has been explicitly cast, then the elements are in turn * explicitly coerced. @@ -1500,7 +1501,7 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a, * If the array's type was merely derived from the common type of its * elements, then the elements are implicitly coerced to the common type. * This is consistent with other uses of select_common_type(). - */ + */ foreach(element, newelems) { Node *e = (Node *) lfirst(element); @@ -1508,9 +1509,9 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a, if (coerce_hard) { - newe = coerce_to_target_type(pstate, e, + newe = coerce_to_target_type(pstate, e, exprType(e), - coerce_type, + coerce_type, typmod, COERCION_EXPLICIT, COERCE_EXPLICIT_CAST, @@ -1671,8 +1672,8 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), x->op == IS_XMLELEMENT - ? errmsg("unnamed XML attribute value must be a column reference") - : errmsg("unnamed XML element value must be a column reference"), + ? errmsg("unnamed XML attribute value must be a column reference") + : errmsg("unnamed XML element value must be a column reference"), parser_errposition(pstate, r->location))); argname = NULL; /* keep compiler quiet */ } @@ -1687,8 +1688,8 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x) if (strcmp(argname, strVal(lfirst(lc2))) == 0) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("XML attribute name \"%s\" appears more than once", - argname), + errmsg("XML attribute name \"%s\" appears more than once", + argname), parser_errposition(pstate, r->location))); } } diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c index 260f74d595..fd0706e960 100644 --- a/src/backend/parser/parse_func.c +++ b/src/backend/parser/parse_func.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.215 2009/06/04 18:33:07 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.216 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -85,10 +85,10 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, if (list_length(fargs) > FUNC_MAX_ARGS) ereport(ERROR, (errcode(ERRCODE_TOO_MANY_ARGUMENTS), - errmsg_plural("cannot pass more than %d argument to a function", - "cannot pass more than %d arguments to a function", - FUNC_MAX_ARGS, - FUNC_MAX_ARGS), + errmsg_plural("cannot pass more than %d argument to a function", + "cannot pass more than %d arguments to a function", + FUNC_MAX_ARGS, + FUNC_MAX_ARGS), parser_errposition(pstate, location))); /* @@ -198,7 +198,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("OVER specified, but %s is not a window function nor an aggregate function", - NameListToString(funcname)), + NameListToString(funcname)), parser_errposition(pstate, location))); } else if (!(fdresult == FUNCDETAIL_AGGREGATE || @@ -245,22 +245,22 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, * If there are default arguments, we have to include their types in * actual_arg_types for the purpose of checking generic type consistency. * However, we do NOT put them into the generated parse node, because - * their actual values might change before the query gets run. The + * their actual values might change before the query gets run. The * planner has to insert the up-to-date values at plan time. */ nargsplusdefs = nargs; foreach(l, argdefaults) { - Node *expr = (Node *) lfirst(l); + Node *expr = (Node *) lfirst(l); /* probably shouldn't happen ... */ if (nargsplusdefs >= FUNC_MAX_ARGS) ereport(ERROR, (errcode(ERRCODE_TOO_MANY_ARGUMENTS), - errmsg_plural("cannot pass more than %d argument to a function", - "cannot pass more than %d arguments to a function", - FUNC_MAX_ARGS, - FUNC_MAX_ARGS), + errmsg_plural("cannot pass more than %d argument to a function", + "cannot pass more than %d arguments to a function", + FUNC_MAX_ARGS, + FUNC_MAX_ARGS), parser_errposition(pstate, location))); actual_arg_types[nargsplusdefs++] = exprType(expr); @@ -286,9 +286,9 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, */ if (nvargs > 0 && declared_arg_types[nargs - 1] != ANYOID) { - ArrayExpr *newa = makeNode(ArrayExpr); - int non_var_args = nargs - nvargs; - List *vargs; + ArrayExpr *newa = makeNode(ArrayExpr); + int non_var_args = nargs - nvargs; + List *vargs; Assert(non_var_args >= 0); vargs = list_copy_tail(fargs, non_var_args); @@ -303,7 +303,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("could not find array type for data type %s", format_type_be(newa->element_typeid)), - parser_errposition(pstate, exprLocation((Node *) vargs)))); + parser_errposition(pstate, exprLocation((Node *) vargs)))); newa->multidims = false; newa->location = exprLocation((Node *) vargs); @@ -386,7 +386,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, if (agg_distinct) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("DISTINCT is not implemented for window functions"), + errmsg("DISTINCT is not implemented for window functions"), parser_errposition(pstate, location))); /* @@ -528,7 +528,7 @@ func_select_candidate(int nargs, int nbestMatch, nmatch; Oid input_base_typeids[FUNC_MAX_ARGS]; - TYPCATEGORY slot_category[FUNC_MAX_ARGS], + TYPCATEGORY slot_category[FUNC_MAX_ARGS], current_category; bool current_is_preferred; bool slot_has_preferred_type[FUNC_MAX_ARGS]; @@ -538,10 +538,10 @@ func_select_candidate(int nargs, if (nargs > FUNC_MAX_ARGS) ereport(ERROR, (errcode(ERRCODE_TOO_MANY_ARGUMENTS), - errmsg_plural("cannot pass more than %d argument to a function", - "cannot pass more than %d arguments to a function", - FUNC_MAX_ARGS, - FUNC_MAX_ARGS))); + errmsg_plural("cannot pass more than %d argument to a function", + "cannot pass more than %d arguments to a function", + FUNC_MAX_ARGS, + FUNC_MAX_ARGS))); /* * If any input types are domains, reduce them to their base types. This @@ -830,7 +830,7 @@ func_get_detail(List *funcname, *nvargs = 0; *true_typeids = NULL; if (argdefaults) - *argdefaults = NIL; + *argdefaults = NIL; /* Get list of possible candidates from namespace search */ raw_candidates = FuncnameGetCandidates(funcname, nargs, @@ -968,8 +968,8 @@ func_get_detail(List *funcname, /* * If expanding variadics or defaults, the "best candidate" might - * represent multiple equivalently good functions; treat this case - * as ambiguous. + * represent multiple equivalently good functions; treat this case as + * ambiguous. */ if (!OidIsValid(best_candidate->oid)) return FUNCDETAIL_MULTIPLE; diff --git a/src/backend/parser/parse_node.c b/src/backend/parser/parse_node.c index 17500f5545..f775850e04 100644 --- a/src/backend/parser/parse_node.c +++ b/src/backend/parser/parse_node.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_node.c,v 1.104 2009/01/01 17:23:45 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_node.c,v 1.105 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -122,7 +122,7 @@ parser_errposition(ParseState *pstate, int location) * Sometimes the parser calls functions that aren't part of the parser * subsystem and can't reasonably be passed a ParseState; yet we would * like any errors thrown in those functions to be tagged with a parse - * error location. Use this function to set up an error context stack + * error location. Use this function to set up an error context stack * entry that will accomplish that. Usage pattern: * * declare a local variable "ParseCallbackState pcbstate" @@ -311,7 +311,7 @@ transformArraySubscripts(ParseState *pstate, ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("array subscript must have type integer"), - parser_errposition(pstate, exprLocation(ai->lidx)))); + parser_errposition(pstate, exprLocation(ai->lidx)))); } else { @@ -364,7 +364,7 @@ transformArraySubscripts(ParseState *pstate, " but expression is of type %s", format_type_be(typeneeded), format_type_be(typesource)), - errhint("You will need to rewrite or cast the expression."), + errhint("You will need to rewrite or cast the expression."), parser_errposition(pstate, exprLocation(assignFrom)))); assignFrom = newFrom; } @@ -447,7 +447,7 @@ make_const(ParseState *pstate, Value *value, int location) typeid = INT8OID; typelen = sizeof(int64); - typebyval = FLOAT8PASSBYVAL; /* int8 and float8 alike */ + typebyval = FLOAT8PASSBYVAL; /* int8 and float8 alike */ } } else diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c index 871a6b9f23..b8555c4615 100644 --- a/src/backend/parser/parse_oper.c +++ b/src/backend/parser/parse_oper.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.107 2009/01/01 17:23:45 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.108 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -59,7 +59,7 @@ typedef struct OprCacheKey typedef struct OprCacheEntry { /* the hash lookup key MUST BE FIRST */ - OprCacheKey key; + OprCacheKey key; Oid opr_oid; /* OID of the resolved operator */ } OprCacheEntry; @@ -76,7 +76,7 @@ static void op_error(ParseState *pstate, List *op, char oprkind, Oid arg1, Oid arg2, FuncDetailCode fdresult, int location); static bool make_oper_cache_key(OprCacheKey *key, List *opname, - Oid ltypeId, Oid rtypeId); + Oid ltypeId, Oid rtypeId); static Oid find_oper_cache_entry(OprCacheKey *key); static void make_oper_cache_entry(OprCacheKey *key, Oid opr_oid); static void InvalidateOprCacheCallBack(Datum arg, int cacheid, ItemPointer tuplePtr); @@ -194,7 +194,7 @@ get_sort_group_operators(Oid argtype, * are consistent, ie all from the same opclass. */ typentry = lookup_type_cache(argtype, - TYPECACHE_LT_OPR | TYPECACHE_EQ_OPR | TYPECACHE_GT_OPR); + TYPECACHE_LT_OPR | TYPECACHE_EQ_OPR | TYPECACHE_GT_OPR); lt_opr = typentry->lt_opr; eq_opr = typentry->eq_opr; gt_opr = typentry->gt_opr; @@ -202,8 +202,8 @@ get_sort_group_operators(Oid argtype, /* * If the datatype is an array, then we can use array_lt and friends ... * but only if there are suitable operators for the element type. (This - * check is not in the raw typcache.c code ... should it be?) Testing - * all three operator IDs here should be redundant. + * check is not in the raw typcache.c code ... should it be?) Testing all + * three operator IDs here should be redundant. */ if (lt_opr == ARRAY_LT_OP || eq_opr == ARRAY_EQ_OP || @@ -214,7 +214,7 @@ get_sort_group_operators(Oid argtype, if (OidIsValid(elem_type)) { typentry = lookup_type_cache(elem_type, - TYPECACHE_LT_OPR | TYPECACHE_EQ_OPR | TYPECACHE_GT_OPR); + TYPECACHE_LT_OPR | TYPECACHE_EQ_OPR | TYPECACHE_GT_OPR); if (!OidIsValid(typentry->lt_opr)) lt_opr = InvalidOid; /* element type has no "<" */ if (!OidIsValid(typentry->eq_opr)) @@ -223,7 +223,7 @@ get_sort_group_operators(Oid argtype, gt_opr = InvalidOid; /* element type has no ">" */ } else - lt_opr = eq_opr = gt_opr = InvalidOid; /* bogus array type? */ + lt_opr = eq_opr = gt_opr = InvalidOid; /* bogus array type? */ } /* Report errors if needed */ @@ -388,7 +388,7 @@ oper(ParseState *pstate, List *opname, Oid ltypeId, Oid rtypeId, bool noError, int location) { Oid operOid; - OprCacheKey key; + OprCacheKey key; bool key_ok; FuncDetailCode fdresult = FUNCDETAIL_NOTFOUND; HeapTuple tup = NULL; @@ -538,7 +538,7 @@ Operator right_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location) { Oid operOid; - OprCacheKey key; + OprCacheKey key; bool key_ok; FuncDetailCode fdresult = FUNCDETAIL_NOTFOUND; HeapTuple tup = NULL; @@ -620,7 +620,7 @@ Operator left_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location) { Oid operOid; - OprCacheKey key; + OprCacheKey key; bool key_ok; FuncDetailCode fdresult = FUNCDETAIL_NOTFOUND; HeapTuple tup = NULL; @@ -1003,7 +1003,7 @@ make_scalar_array_op(ParseState *pstate, List *opname, * mapping is pretty expensive to compute, especially for ambiguous operators; * this is mainly because there are a *lot* of instances of popular operator * names such as "=", and we have to check each one to see which is the - * best match. So once we have identified the correct mapping, we save it + * best match. So once we have identified the correct mapping, we save it * in a cache that need only be flushed on pg_operator or pg_cast change. * (pg_cast must be considered because changes in the set of implicit casts * affect the set of applicable operators for any given input datatype.) @@ -1056,7 +1056,7 @@ make_oper_cache_key(OprCacheKey *key, List *opname, Oid ltypeId, Oid rtypeId) { /* get the active search path */ if (fetch_search_path_array(key->search_path, - MAX_CACHED_PATH_LEN) > MAX_CACHED_PATH_LEN) + MAX_CACHED_PATH_LEN) > MAX_CACHED_PATH_LEN) return false; /* oops, didn't fit */ } @@ -1087,7 +1087,7 @@ find_oper_cache_entry(OprCacheKey *key) ctl.entrysize = sizeof(OprCacheEntry); ctl.hash = tag_hash; OprCacheHash = hash_create("Operator lookup cache", 256, - &ctl, HASH_ELEM | HASH_FUNCTION); + &ctl, HASH_ELEM | HASH_FUNCTION); /* Arrange to flush cache on pg_operator and pg_cast changes */ CacheRegisterSyscacheCallback(OPERNAMENSP, diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c index eb98f470ee..b506c042c5 100644 --- a/src/backend/parser/parse_relation.c +++ b/src/backend/parser/parse_relation.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.141 2009/01/22 20:16:05 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.142 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -38,9 +38,9 @@ bool add_missing_from; static RangeTblEntry *scanNameSpaceForRefname(ParseState *pstate, const char *refname, int location); static RangeTblEntry *scanNameSpaceForRelid(ParseState *pstate, Oid relid, - int location); + int location); static void markRTEForSelectPriv(ParseState *pstate, RangeTblEntry *rte, - int rtindex, AttrNumber col); + int rtindex, AttrNumber col); static bool isLockedRel(ParseState *pstate, char *refname); static void expandRelation(Oid relid, Alias *eref, int rtindex, int sublevels_up, @@ -194,13 +194,13 @@ CommonTableExpr * scanNameSpaceForCTE(ParseState *pstate, const char *refname, Index *ctelevelsup) { - Index levelsup; + Index levelsup; for (levelsup = 0; pstate != NULL; pstate = pstate->parentParseState, levelsup++) { - ListCell *lc; + ListCell *lc; foreach(lc, pstate->p_ctenamespace) { @@ -226,7 +226,7 @@ isFutureCTE(ParseState *pstate, const char *refname) { for (; pstate != NULL; pstate = pstate->parentParseState) { - ListCell *lc; + ListCell *lc; foreach(lc, pstate->p_future_ctes) { @@ -264,9 +264,9 @@ searchRangeTable(ParseState *pstate, RangeVar *relation) Index levelsup; /* - * If it's an unqualified name, check for possible CTE matches. - * A CTE hides any real relation matches. If no CTE, look for - * a matching relation. + * If it's an unqualified name, check for possible CTE matches. A CTE + * hides any real relation matches. If no CTE, look for a matching + * relation. */ if (!relation->schemaname) cte = scanNameSpaceForCTE(pstate, refname, &ctelevelsup); @@ -616,15 +616,15 @@ markRTEForSelectPriv(ParseState *pstate, RangeTblEntry *rte, rte->requiredPerms |= ACL_SELECT; /* Must offset the attnum to fit in a bitmapset */ rte->selectedCols = bms_add_member(rte->selectedCols, - col - FirstLowInvalidHeapAttributeNumber); + col - FirstLowInvalidHeapAttributeNumber); } else if (rte->rtekind == RTE_JOIN) { if (col == InvalidAttrNumber) { /* - * A whole-row reference to a join has to be treated as - * whole-row references to the two inputs. + * A whole-row reference to a join has to be treated as whole-row + * references to the two inputs. */ JoinExpr *j; @@ -639,13 +639,13 @@ markRTEForSelectPriv(ParseState *pstate, RangeTblEntry *rte, /* Note: we can't see FromExpr here */ if (IsA(j->larg, RangeTblRef)) { - int varno = ((RangeTblRef *) j->larg)->rtindex; + int varno = ((RangeTblRef *) j->larg)->rtindex; markRTEForSelectPriv(pstate, NULL, varno, InvalidAttrNumber); } else if (IsA(j->larg, JoinExpr)) { - int varno = ((JoinExpr *) j->larg)->rtindex; + int varno = ((JoinExpr *) j->larg)->rtindex; markRTEForSelectPriv(pstate, NULL, varno, InvalidAttrNumber); } @@ -654,13 +654,13 @@ markRTEForSelectPriv(ParseState *pstate, RangeTblEntry *rte, (int) nodeTag(j->larg)); if (IsA(j->rarg, RangeTblRef)) { - int varno = ((RangeTblRef *) j->rarg)->rtindex; + int varno = ((RangeTblRef *) j->rarg)->rtindex; markRTEForSelectPriv(pstate, NULL, varno, InvalidAttrNumber); } else if (IsA(j->rarg, JoinExpr)) { - int varno = ((JoinExpr *) j->rarg)->rtindex; + int varno = ((JoinExpr *) j->rarg)->rtindex; markRTEForSelectPriv(pstate, NULL, varno, InvalidAttrNumber); } @@ -676,10 +676,10 @@ markRTEForSelectPriv(ParseState *pstate, RangeTblEntry *rte, * The aliasvar could be either a Var or a COALESCE expression, * but in the latter case we should already have marked the two * referent variables as being selected, due to their use in the - * JOIN clause. So we need only be concerned with the simple - * Var case. + * JOIN clause. So we need only be concerned with the simple Var + * case. */ - Var *aliasvar; + Var *aliasvar; Assert(col > 0 && col <= list_length(rte->joinaliasvars)); aliasvar = (Var *) list_nth(rte->joinaliasvars, col - 1); @@ -700,7 +700,7 @@ markRTEForSelectPriv(ParseState *pstate, RangeTblEntry *rte, void markVarForSelectPriv(ParseState *pstate, Var *var, RangeTblEntry *rte) { - Index lv; + Index lv; Assert(IsA(var, Var)); /* Find the appropriate pstate if it's an uplevel Var */ @@ -1325,8 +1325,8 @@ addRangeTableEntryForJoin(ParseState *pstate, int numaliases; /* - * Fail if join has too many columns --- we must be able to reference - * any of the columns with an AttrNumber. + * Fail if join has too many columns --- we must be able to reference any + * of the columns with an AttrNumber. */ if (list_length(aliasvars) > MaxAttrNumber) ereport(ERROR, @@ -1816,8 +1816,8 @@ expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up, varattno = 0; forboth(lct, rte->ctecoltypes, lcm, rte->ctecoltypmods) { - Oid coltype = lfirst_oid(lct); - int32 coltypmod = lfirst_int(lcm); + Oid coltype = lfirst_oid(lct); + int32 coltypmod = lfirst_int(lcm); varattno++; @@ -1971,7 +1971,7 @@ expandRelAttrs(ParseState *pstate, RangeTblEntry *rte, markVarForSelectPriv(pstate, varnode, rte); } - Assert(name == NULL && var == NULL); /* lists not the same length? */ + Assert(name == NULL && var == NULL); /* lists not the same length? */ return te_list; } @@ -2457,8 +2457,8 @@ warnAutoRange(ParseState *pstate, RangeVar *relation) if (rte) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_TABLE), - errmsg("invalid reference to FROM-clause entry for table \"%s\"", - relation->relname), + errmsg("invalid reference to FROM-clause entry for table \"%s\"", + relation->relname), (badAlias ? errhint("Perhaps you meant to reference the table alias \"%s\".", badAlias) : diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c index 3f804472c7..c9ec7c33e2 100644 --- a/src/backend/parser/parse_target.c +++ b/src/backend/parser/parse_target.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.170 2009/01/22 20:16:06 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.171 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -297,14 +297,14 @@ markTargetListOrigin(ParseState *pstate, TargetEntry *tle, /* not a simple relation, leave it unmarked */ break; case RTE_CTE: + /* - * CTE reference: copy up from the subquery, if possible. - * If the RTE is a recursive self-reference then we can't do - * anything because we haven't finished analyzing it yet. - * However, it's no big loss because we must be down inside - * the recursive term of a recursive CTE, and so any markings - * on the current targetlist are not going to affect the results - * anyway. + * CTE reference: copy up from the subquery, if possible. If the + * RTE is a recursive self-reference then we can't do anything + * because we haven't finished analyzing it yet. However, it's no + * big loss because we must be down inside the recursive term of a + * recursive CTE, and so any markings on the current targetlist + * are not going to affect the results anyway. */ if (attnum != InvalidAttrNumber && !rte->self_reference) { @@ -346,7 +346,7 @@ markTargetListOrigin(ParseState *pstate, TargetEntry *tle, * * Note: location points at the target column name (SET target or INSERT * column name list entry), and must therefore be -1 in an INSERT that - * omits the column name list. So we should usually prefer to use + * omits the column name list. So we should usually prefer to use * exprLocation(expr) for errors that can happen in a default INSERT. */ Expr * @@ -451,7 +451,7 @@ transformAssignedExpr(ParseState *pstate, * For normal non-qualified target column, do type checking and * coercion. */ - Node *orig_expr = (Node *) expr; + Node *orig_expr = (Node *) expr; expr = (Expr *) coerce_to_target_type(pstate, @@ -957,7 +957,7 @@ ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref, /* Require read access to each column */ foreach(l, vars) { - Var *var = (Var *) lfirst(l); + Var *var = (Var *) lfirst(l); markVarForSelectPriv(pstate, var, rte); } diff --git a/src/backend/parser/parse_type.c b/src/backend/parser/parse_type.c index a74f597259..295763fc48 100644 --- a/src/backend/parser/parse_type.c +++ b/src/backend/parser/parse_type.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_type.c,v 1.102 2009/01/01 17:23:46 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_type.c,v 1.103 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -498,15 +498,16 @@ stringTypeDatum(Type tp, char *string, int32 atttypmod) typioparam, atttypmod); #ifdef RANDOMIZE_ALLOCATED_MEMORY + /* * For pass-by-reference data types, repeat the conversion to see if the * input function leaves any uninitialized bytes in the result. We can - * only detect that reliably if RANDOMIZE_ALLOCATED_MEMORY is enabled, - * so we don't bother testing otherwise. The reason we don't want any + * only detect that reliably if RANDOMIZE_ALLOCATED_MEMORY is enabled, so + * we don't bother testing otherwise. The reason we don't want any * instability in the input function is that comparison of Const nodes * relies on bytewise comparison of the datums, so if the input function * leaves garbage then subexpressions that should be identical may not get - * recognized as such. See pgsql-hackers discussion of 2008-04-04. + * recognized as such. See pgsql-hackers discussion of 2008-04-04. */ if (string && !typform->typbyval) { diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index e011208ad8..e5a3621cce 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -19,7 +19,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.20 2009/01/01 17:23:46 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.21 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -287,9 +287,9 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt, } /* - * We have to reject "serial[]" explicitly, because once we've - * set typeid, LookupTypeName won't notice arrayBounds. We don't - * need any special coding for serial(typmod) though. + * We have to reject "serial[]" explicitly, because once we've set + * typeid, LookupTypeName won't notice arrayBounds. We don't need any + * special coding for serial(typmod) though. */ if (is_serial && column->typename->arrayBounds != NIL) ereport(ERROR, @@ -800,9 +800,9 @@ generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx, index->idxname = NULL; /* - * If the index is marked PRIMARY, it's certainly from a constraint; - * else, if it's not marked UNIQUE, it certainly isn't; else, we have - * to search pg_depend to see if there's an associated unique constraint. + * If the index is marked PRIMARY, it's certainly from a constraint; else, + * if it's not marked UNIQUE, it certainly isn't; else, we have to search + * pg_depend to see if there's an associated unique constraint. */ if (index->primary) index->isconstraint = true; @@ -876,10 +876,10 @@ generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx, if (amrec->amcanorder) { /* - * If it supports sort ordering, copy DESC and NULLS opts. - * Don't set non-default settings unnecessarily, though, - * so as to improve the chance of recognizing equivalence - * to constraint indexes. + * If it supports sort ordering, copy DESC and NULLS opts. Don't + * set non-default settings unnecessarily, though, so as to + * improve the chance of recognizing equivalence to constraint + * indexes. */ if (opt & INDOPTION_DESC) { @@ -1042,6 +1042,7 @@ transformIndexConstraints(ParseState *pstate, CreateStmtContext *cxt) strcmp(index->accessMethod, priorindex->accessMethod) == 0) { priorindex->unique |= index->unique; + /* * If the prior index is as yet unnamed, and this one is * named, then transfer the name to the prior index. This @@ -1475,7 +1476,7 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString, if (pstate->p_hasWindowFuncs) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), - errmsg("cannot use window function in rule WHERE condition"))); + errmsg("cannot use window function in rule WHERE condition"))); /* * 'instead nothing' rules with a qualification need a query rangetable so diff --git a/src/backend/parser/parser.c b/src/backend/parser/parser.c index 2e42b6f668..ee77c38f86 100644 --- a/src/backend/parser/parser.c +++ b/src/backend/parser/parser.c @@ -14,7 +14,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parser.c,v 1.77 2009/04/19 21:50:08 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parser.c,v 1.78 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -77,7 +77,7 @@ raw_parser(const char *str) char * pg_parse_string_token(const char *token) { - int ctoken; + int ctoken; scanner_init(token); diff --git a/src/backend/port/darwin/system.c b/src/backend/port/darwin/system.c index f6586505ba..9cdcbddae5 100644 --- a/src/backend/port/darwin/system.c +++ b/src/backend/port/darwin/system.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/backend/port/darwin/system.c,v 1.7 2008/05/17 01:28:22 adunstan Exp $ + * $PostgreSQL: pgsql/src/backend/port/darwin/system.c,v 1.8 2009/06/11 14:49:00 momjian Exp $ * * only needed in OS X 10.1 and possibly early 10.2 releases */ #include <AvailabilityMacros.h> diff --git a/src/backend/port/dynloader/sco.c b/src/backend/port/dynloader/sco.c index da09a25591..0d108cbff5 100644 --- a/src/backend/port/dynloader/sco.c +++ b/src/backend/port/dynloader/sco.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/backend/port/dynloader/sco.c,v 1.2 2008/05/17 01:28:23 adunstan Exp $ + * $PostgreSQL: pgsql/src/backend/port/dynloader/sco.c,v 1.3 2009/06/11 14:49:00 momjian Exp $ * * Dummy file used for nothing at this point * diff --git a/src/backend/port/dynloader/solaris.c b/src/backend/port/dynloader/solaris.c index 27f555e1b4..9f5b5cfbde 100644 --- a/src/backend/port/dynloader/solaris.c +++ b/src/backend/port/dynloader/solaris.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/backend/port/dynloader/solaris.c,v 1.2 2008/05/17 01:28:23 adunstan Exp $ + * $PostgreSQL: pgsql/src/backend/port/dynloader/solaris.c,v 1.3 2009/06/11 14:49:00 momjian Exp $ * * Dummy file used for nothing at this point * diff --git a/src/backend/port/dynloader/sunos4.c b/src/backend/port/dynloader/sunos4.c index 659964cdca..a354b0dad4 100644 --- a/src/backend/port/dynloader/sunos4.c +++ b/src/backend/port/dynloader/sunos4.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/backend/port/dynloader/sunos4.c,v 1.2 2008/05/17 01:28:23 adunstan Exp $ + * $PostgreSQL: pgsql/src/backend/port/dynloader/sunos4.c,v 1.3 2009/06/11 14:49:00 momjian Exp $ * * Dummy file used for nothing at this point * diff --git a/src/backend/port/dynloader/svr4.c b/src/backend/port/dynloader/svr4.c index 2cafa40e55..290367060e 100644 --- a/src/backend/port/dynloader/svr4.c +++ b/src/backend/port/dynloader/svr4.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/backend/port/dynloader/svr4.c,v 1.2 2008/05/17 01:28:23 adunstan Exp $ + * $PostgreSQL: pgsql/src/backend/port/dynloader/svr4.c,v 1.3 2009/06/11 14:49:00 momjian Exp $ * * Dummy file used for nothing at this point * diff --git a/src/backend/port/dynloader/univel.c b/src/backend/port/dynloader/univel.c index 0f6cc80fe1..95d40f015d 100644 --- a/src/backend/port/dynloader/univel.c +++ b/src/backend/port/dynloader/univel.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/backend/port/dynloader/univel.c,v 1.4 2008/05/17 01:28:23 adunstan Exp $ + * $PostgreSQL: pgsql/src/backend/port/dynloader/univel.c,v 1.5 2009/06/11 14:49:00 momjian Exp $ * * Dummy file used for nothing at this point * diff --git a/src/backend/port/dynloader/univel.h b/src/backend/port/dynloader/univel.h index 0c72aef1b8..f5ca7205df 100644 --- a/src/backend/port/dynloader/univel.h +++ b/src/backend/port/dynloader/univel.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/backend/port/dynloader/univel.h,v 1.23 2009/01/01 17:23:46 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/port/dynloader/univel.h,v 1.24 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- * diff --git a/src/backend/port/dynloader/unixware.c b/src/backend/port/dynloader/unixware.c index 2db3fa9367..682340c694 100644 --- a/src/backend/port/dynloader/unixware.c +++ b/src/backend/port/dynloader/unixware.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/backend/port/dynloader/unixware.c,v 1.2 2008/05/17 01:28:23 adunstan Exp $ + * $PostgreSQL: pgsql/src/backend/port/dynloader/unixware.c,v 1.3 2009/06/11 14:49:00 momjian Exp $ * * Dummy file used for nothing at this point * diff --git a/src/backend/port/dynloader/unixware.h b/src/backend/port/dynloader/unixware.h index 53baa47bf9..259fca3e95 100644 --- a/src/backend/port/dynloader/unixware.h +++ b/src/backend/port/dynloader/unixware.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/backend/port/dynloader/unixware.h,v 1.21 2009/01/01 17:23:46 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/port/dynloader/unixware.h,v 1.22 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- * diff --git a/src/backend/port/dynloader/win32.h b/src/backend/port/dynloader/win32.h index fa44b7f54e..c6952dfda3 100644 --- a/src/backend/port/dynloader/win32.h +++ b/src/backend/port/dynloader/win32.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/backend/port/dynloader/win32.h,v 1.4 2008/05/17 01:28:23 adunstan Exp $ + * $PostgreSQL: pgsql/src/backend/port/dynloader/win32.h,v 1.5 2009/06/11 14:49:00 momjian Exp $ */ #ifndef PORT_PROTOS_H #define PORT_PROTOS_H diff --git a/src/backend/port/nextstep/port.c b/src/backend/port/nextstep/port.c index abeb70546d..fd5461c321 100644 --- a/src/backend/port/nextstep/port.c +++ b/src/backend/port/nextstep/port.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/backend/port/nextstep/port.c,v 1.11 2008/05/17 01:28:23 adunstan Exp $ + * $PostgreSQL: pgsql/src/backend/port/nextstep/port.c,v 1.12 2009/06/11 14:49:00 momjian Exp $ */ #include "postgres.h" diff --git a/src/backend/port/posix_sema.c b/src/backend/port/posix_sema.c index e6f3ce80b4..5b829149ed 100644 --- a/src/backend/port/posix_sema.c +++ b/src/backend/port/posix_sema.c @@ -11,7 +11,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/port/posix_sema.c,v 1.21 2009/01/01 17:23:46 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/port/posix_sema.c,v 1.22 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -241,10 +241,10 @@ PGSemaphoreLock(PGSemaphore sema, bool interruptOK) int errStatus; /* - * See notes in sysv_sema.c's implementation of PGSemaphoreLock. - * Just as that code does for semop(), we handle both the case where - * sem_wait() returns errno == EINTR after a signal, and the case - * where it just keeps waiting. + * See notes in sysv_sema.c's implementation of PGSemaphoreLock. Just as + * that code does for semop(), we handle both the case where sem_wait() + * returns errno == EINTR after a signal, and the case where it just keeps + * waiting. */ do { diff --git a/src/backend/port/sysv_sema.c b/src/backend/port/sysv_sema.c index 41ac4329a9..3cb31baa69 100644 --- a/src/backend/port/sysv_sema.c +++ b/src/backend/port/sysv_sema.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/port/sysv_sema.c,v 1.24 2009/01/01 17:23:46 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/port/sysv_sema.c,v 1.25 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -377,11 +377,11 @@ PGSemaphoreLock(PGSemaphore sema, bool interruptOK) * from the operation prematurely because we were sent a signal. So we * try and lock the semaphore again. * - * Each time around the loop, we check for a cancel/die interrupt. On - * some platforms, if such an interrupt comes in while we are waiting, - * it will cause the semop() call to exit with errno == EINTR, allowing - * us to service the interrupt (if not in a critical section already) - * during the next loop iteration. + * Each time around the loop, we check for a cancel/die interrupt. On + * some platforms, if such an interrupt comes in while we are waiting, it + * will cause the semop() call to exit with errno == EINTR, allowing us to + * service the interrupt (if not in a critical section already) during the + * next loop iteration. * * Once we acquire the lock, we do NOT check for an interrupt before * returning. The caller needs to be able to record ownership of the lock @@ -407,10 +407,10 @@ PGSemaphoreLock(PGSemaphore sema, bool interruptOK) * * On some platforms, signals marked SA_RESTART (which is most, for us) * will not interrupt the semop(); it will just keep waiting. Therefore - * it's necessary for cancel/die interrupts to be serviced directly by - * the signal handler. On these platforms the behavior is really the same + * it's necessary for cancel/die interrupts to be serviced directly by the + * signal handler. On these platforms the behavior is really the same * whether the signal arrives just before the semop() begins, or while it - * is waiting. The loop on EINTR is thus important only for other types + * is waiting. The loop on EINTR is thus important only for other types * of interrupts. */ do diff --git a/src/backend/port/win32/mingwcompat.c b/src/backend/port/win32/mingwcompat.c index fe185f8f6c..a9b38d5320 100644 --- a/src/backend/port/win32/mingwcompat.c +++ b/src/backend/port/win32/mingwcompat.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/port/win32/mingwcompat.c,v 1.5 2009/01/01 17:23:46 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/port/win32/mingwcompat.c,v 1.6 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -45,8 +45,8 @@ LoadKernel32() * kernel32.dll· */ typedef -BOOL(WINAPI * __RegisterWaitForSingleObject) -(PHANDLE, HANDLE, WAITORTIMERCALLBACK, PVOID, ULONG, ULONG); +BOOL (WINAPI * __RegisterWaitForSingleObject) + (PHANDLE, HANDLE, WAITORTIMERCALLBACK, PVOID, ULONG, ULONG); static __RegisterWaitForSingleObject _RegisterWaitForSingleObject = NULL; BOOL WINAPI diff --git a/src/backend/port/win32/socket.c b/src/backend/port/win32/socket.c index 49631fa793..a8fa0e0806 100644 --- a/src/backend/port/win32/socket.c +++ b/src/backend/port/win32/socket.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/port/win32/socket.c,v 1.21 2009/01/01 17:23:46 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/port/win32/socket.c,v 1.22 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -434,7 +434,8 @@ pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, c r = WSASend(writefds->fd_array[i], &buf, 1, &sent, 0, NULL, NULL); if (r == 0) /* Completed - means things are fine! */ - FD_SET(writefds->fd_array[i], &outwritefds); + FD_SET (writefds->fd_array[i], &outwritefds); + else { /* Not completed */ if (WSAGetLastError() != WSAEWOULDBLOCK) @@ -443,7 +444,7 @@ pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, c * Not completed, and not just "would block", so an error * occured */ - FD_SET(writefds->fd_array[i], &outwritefds); + FD_SET (writefds->fd_array[i], &outwritefds); } } if (outwritefds.fd_count > 0) @@ -530,7 +531,8 @@ pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, c (resEvents.lNetworkEvents & FD_ACCEPT) || (resEvents.lNetworkEvents & FD_CLOSE)) { - FD_SET(sockets[i], &outreadfds); + FD_SET (sockets[i], &outreadfds); + nummatches++; } } @@ -540,7 +542,8 @@ pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, c if ((resEvents.lNetworkEvents & FD_WRITE) || (resEvents.lNetworkEvents & FD_CLOSE)) { - FD_SET(sockets[i], &outwritefds); + FD_SET (sockets[i], &outwritefds); + nummatches++; } } diff --git a/src/backend/port/win32/timer.c b/src/backend/port/win32/timer.c index bf315bd652..8dd0e91a23 100644 --- a/src/backend/port/win32/timer.c +++ b/src/backend/port/win32/timer.c @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/port/win32/timer.c,v 1.16 2009/01/01 17:23:46 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/port/win32/timer.c,v 1.17 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -27,7 +27,7 @@ typedef struct timerCA struct itimerval value; HANDLE event; CRITICAL_SECTION crit_sec; -} timerCA; +} timerCA; static timerCA timerCommArea; static HANDLE timerThreadHandle = INVALID_HANDLE_VALUE; diff --git a/src/backend/port/win32_sema.c b/src/backend/port/win32_sema.c index bf68b4c60e..2942ff138b 100644 --- a/src/backend/port/win32_sema.c +++ b/src/backend/port/win32_sema.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/port/win32_sema.c,v 1.8 2009/01/01 17:23:46 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/port/win32_sema.c,v 1.9 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -125,10 +125,10 @@ PGSemaphoreLock(PGSemaphore sema, bool interruptOK) wh[1] = pgwin32_signal_event; /* - * As in other implementations of PGSemaphoreLock, we need to check - * for cancel/die interrupts each time through the loop. But here, - * there is no hidden magic about whether the syscall will internally - * service a signal --- we do that ourselves. + * As in other implementations of PGSemaphoreLock, we need to check for + * cancel/die interrupts each time through the loop. But here, there is + * no hidden magic about whether the syscall will internally service a + * signal --- we do that ourselves. */ do { diff --git a/src/backend/port/win32_shmem.c b/src/backend/port/win32_shmem.c index 5651a31e44..4e819d0c65 100644 --- a/src/backend/port/win32_shmem.c +++ b/src/backend/port/win32_shmem.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/port/win32_shmem.c,v 1.10 2009/05/05 21:51:46 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/port/win32_shmem.c,v 1.11 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -57,11 +57,11 @@ GetSharedMemName(void) elog(FATAL, "could not generate full pathname for datadir %s: %lu", DataDir, GetLastError()); - /* + /* * XXX: Intentionally overwriting the Global\ part here. This was not the * original approach, but putting it in the actual Global\ namespace - * causes permission errors in a lot of cases, so we leave it in - * the default namespace for now. + * causes permission errors in a lot of cases, so we leave it in the + * default namespace for now. */ for (cp = retptr; *cp; cp++) if (*cp == '\\') @@ -135,19 +135,22 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port) /* * When recycling a shared memory segment, it may take a short while * before it gets dropped from the global namespace. So re-try after - * sleeping for a second, and continue retrying 10 times. - * (both the 1 second time and the 10 retries are completely arbitrary) + * sleeping for a second, and continue retrying 10 times. (both the 1 + * second time and the 10 retries are completely arbitrary) */ for (i = 0; i < 10; i++) { - /* In case CreateFileMapping() doesn't set the error code to 0 on success */ + /* + * In case CreateFileMapping() doesn't set the error code to 0 on + * success + */ SetLastError(0); - hmap = CreateFileMapping((HANDLE) 0xFFFFFFFF, /* Use the pagefile */ - NULL, /* Default security attrs */ - PAGE_READWRITE, /* Memory is Read/Write */ + hmap = CreateFileMapping((HANDLE) 0xFFFFFFFF, /* Use the pagefile */ + NULL, /* Default security attrs */ + PAGE_READWRITE, /* Memory is Read/Write */ 0L, /* Size Upper 32 Bits */ - (DWORD) size, /* Size Lower 32 bits */ + (DWORD) size, /* Size Lower 32 bits */ szShareMem); if (!hmap) @@ -162,8 +165,8 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port) */ if (GetLastError() == ERROR_ALREADY_EXISTS) { - CloseHandle(hmap); /* Close the handle, since we got a valid - * one to the previous segment. */ + CloseHandle(hmap); /* Close the handle, since we got a valid one + * to the previous segment. */ hmap = NULL; Sleep(1000); continue; @@ -177,8 +180,8 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port) */ if (!hmap) ereport(FATAL, - (errmsg("pre-existing shared memory block is still in use"), - errhint("Check if there are any old server processes still running, and terminate them."))); + (errmsg("pre-existing shared memory block is still in use"), + errhint("Check if there are any old server processes still running, and terminate them."))); free(szShareMem); diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 2e63e9bbfa..7584dc3906 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -55,7 +55,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.97 2009/06/09 19:36:28 alvherre Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.98 2009/06/11 14:49:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -124,7 +124,7 @@ int Log_autovacuum_min_duration = -1; #define STATS_READ_DELAY 1000 /* the minimum allowed time between two awakenings of the launcher */ -#define MIN_AUTOVAC_SLEEPTIME 100.0 /* milliseconds */ +#define MIN_AUTOVAC_SLEEPTIME 100.0 /* milliseconds */ /* Flags to tell if we are in an autovacuum process */ static bool am_autovacuum_launcher = false; @@ -168,8 +168,8 @@ typedef struct av_relation Oid ar_toastrelid; /* hash key - must be first */ Oid ar_relid; bool ar_hasrelopts; - AutoVacOpts ar_reloptions; /* copy of AutoVacOpts from the main table's - reloptions, or NULL if none */ + AutoVacOpts ar_reloptions; /* copy of AutoVacOpts from the main table's + * reloptions, or NULL if none */ } av_relation; /* struct to keep track of tables to vacuum and/or analyze, after rechecking */ @@ -362,7 +362,7 @@ StartAutoVacLauncher(void) { case -1: ereport(LOG, - (errmsg("could not fork autovacuum launcher process: %m"))); + (errmsg("could not fork autovacuum launcher process: %m"))); return 0; #ifndef EXEC_BACKEND @@ -1000,8 +1000,8 @@ rebuild_database_list(Oid newdb) qsort(dbary, nelems, sizeof(avl_dbase), db_comparator); /* - * Determine the time interval between databases in the schedule. - * If we see that the configured naptime would take us to sleep times + * Determine the time interval between databases in the schedule. If + * we see that the configured naptime would take us to sleep times * lower than our min sleep time (which launcher_determine_sleep is * coded not to allow), silently use a larger naptime (but don't touch * the GUC variable). @@ -1362,8 +1362,8 @@ avl_quickdie(SIGNAL_ARGS) * system reset cycle if some idiot DBA sends a manual SIGQUIT to a random * backend. This is necessary precisely because we don't clean up our * shared memory state. (The "dead man switch" mechanism in pmsignal.c - * should ensure the postmaster sees this as a crash, too, but no harm - * in being doubly sure.) + * should ensure the postmaster sees this as a crash, too, but no harm in + * being doubly sure.) */ exit(2); } @@ -1849,7 +1849,7 @@ do_autovacuum(void) PgStat_StatDBEntry *shared; PgStat_StatDBEntry *dbentry; BufferAccessStrategy bstrategy; - ScanKeyData key; + ScanKeyData key; TupleDesc pg_class_desc; /* @@ -1881,8 +1881,8 @@ do_autovacuum(void) pgstat_vacuum_stat(); /* - * Find the pg_database entry and select the default freeze ages. We - * use zero in template and nonconnectable databases, else the system-wide + * Find the pg_database entry and select the default freeze ages. We use + * zero in template and nonconnectable databases, else the system-wide * default. */ tuple = SearchSysCache(DATABASEOID, @@ -1930,12 +1930,12 @@ do_autovacuum(void) /* * Scan pg_class to determine which tables to vacuum. * - * We do this in two passes: on the first one we collect the list of - * plain relations, and on the second one we collect TOAST tables. - * The reason for doing the second pass is that during it we want to use - * the main relation's pg_class.reloptions entry if the TOAST table does - * not have any, and we cannot obtain it unless we know beforehand what's - * the main table OID. + * We do this in two passes: on the first one we collect the list of plain + * relations, and on the second one we collect TOAST tables. The reason + * for doing the second pass is that during it we want to use the main + * relation's pg_class.reloptions entry if the TOAST table does not have + * any, and we cannot obtain it unless we know beforehand what's the main + * table OID. * * We need to check TOAST tables separately because in cases with short, * wide tables there might be proportionally much more activity in the @@ -1949,8 +1949,8 @@ do_autovacuum(void) relScan = heap_beginscan(classRel, SnapshotNow, 1, &key); /* - * On the first pass, we collect main tables to vacuum, and also the - * main table relid to TOAST relid mapping. + * On the first pass, we collect main tables to vacuum, and also the main + * table relid to TOAST relid mapping. */ while ((tuple = heap_getnext(relScan, ForwardScanDirection)) != NULL) { @@ -1998,7 +1998,7 @@ do_autovacuum(void) ereport(LOG, (errmsg("autovacuum: dropping orphan temp table \"%s\".\"%s\" in database \"%s\"", - get_namespace_name(classForm->relnamespace), + get_namespace_name(classForm->relnamespace), NameStr(classForm->relname), get_database_name(MyDatabaseId)))); object.classId = RelationRelationId; @@ -2010,7 +2010,7 @@ do_autovacuum(void) { ereport(LOG, (errmsg("autovacuum: found orphan temp table \"%s\".\"%s\" in database \"%s\"", - get_namespace_name(classForm->relnamespace), + get_namespace_name(classForm->relnamespace), NameStr(classForm->relname), get_database_name(MyDatabaseId)))); } @@ -2065,7 +2065,7 @@ do_autovacuum(void) { Form_pg_class classForm = (Form_pg_class) GETSTRUCT(tuple); PgStat_StatTabEntry *tabentry; - Oid relid; + Oid relid; AutoVacOpts *relopts = NULL; bool dovacuum; bool doanalyze; @@ -2080,14 +2080,14 @@ do_autovacuum(void) relid = HeapTupleGetOid(tuple); /* - * fetch reloptions -- if this toast table does not have them, - * try the main rel + * fetch reloptions -- if this toast table does not have them, try the + * main rel */ relopts = extract_autovac_opts(tuple, pg_class_desc); if (relopts == NULL) { - av_relation *hentry; - bool found; + av_relation *hentry; + bool found; hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); if (found && hentry->ar_hasrelopts) @@ -2187,10 +2187,10 @@ do_autovacuum(void) * It could have changed if something else processed the table while * we weren't looking. * - * Note: we have a special case in pgstat code to ensure that the stats - * we read are as up-to-date as possible, to avoid the problem that - * somebody just finished vacuuming this table. The window to the race - * condition is not closed but it is very small. + * Note: we have a special case in pgstat code to ensure that the + * stats we read are as up-to-date as possible, to avoid the problem + * that somebody just finished vacuuming this table. The window to + * the race condition is not closed but it is very small. */ MemoryContextSwitchTo(AutovacMemCxt); tab = table_recheck_autovac(relid, table_toast_map, pg_class_desc); @@ -2231,7 +2231,7 @@ do_autovacuum(void) /* * Save the relation name for a possible error message, to avoid a - * catalog lookup in case of an error. If any of these return NULL, + * catalog lookup in case of an error. If any of these return NULL, * then the relation has been dropped since last we checked; skip it. * Note: they must live in a long-lived memory context because we call * vacuum and analyze in different transactions. @@ -2307,8 +2307,8 @@ deleted: } /* - * We leak table_toast_map here (among other things), but since we're going - * away soon, it's not a problem. + * We leak table_toast_map here (among other things), but since we're + * going away soon, it's not a problem. */ /* @@ -2339,7 +2339,7 @@ extract_autovac_opts(HeapTuple tup, TupleDesc pg_class_desc) relopts = extractRelOptions(tup, pg_class_desc, InvalidOid); if (relopts == NULL) return NULL; - + av = palloc(sizeof(AutoVacOpts)); memcpy(av, &(((StdRdOptions *) relopts)->autovacuum), sizeof(AutoVacOpts)); pfree(relopts); @@ -2392,7 +2392,7 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, PgStat_StatDBEntry *shared; PgStat_StatDBEntry *dbentry; bool wraparound; - AutoVacOpts *avopts; + AutoVacOpts *avopts; /* use fresh stats */ autovac_refresh_stats(); @@ -2408,16 +2408,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, return NULL; classForm = (Form_pg_class) GETSTRUCT(classTup); - /* + /* * Get the applicable reloptions. If it is a TOAST table, try to get the * main table reloptions if the toast table itself doesn't have. */ avopts = extract_autovac_opts(classTup, pg_class_desc); - if (classForm->relkind == RELKIND_TOASTVALUE && + if (classForm->relkind == RELKIND_TOASTVALUE && avopts == NULL && table_toast_map != NULL) { - av_relation *hentry; - bool found; + av_relation *hentry; + bool found; hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found); if (found && hentry->ar_hasrelopts) @@ -2516,7 +2516,7 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, * * A table whose autovacuum_enabled option is false is * automatically skipped (unless we have to vacuum it due to freeze_max_age). - * Thus autovacuum can be disabled for specific tables. Also, when the stats + * Thus autovacuum can be disabled for specific tables. Also, when the stats * collector does not have data about a table, it will be skipped. * * A table whose vac_base_thresh value is < 0 takes the base value from the @@ -2684,8 +2684,8 @@ static void autovac_report_activity(autovac_table *tab) { #define MAX_AUTOVAC_ACTIV_LEN (NAMEDATALEN * 2 + 56) - char activity[MAX_AUTOVAC_ACTIV_LEN]; - int len; + char activity[MAX_AUTOVAC_ACTIV_LEN]; + int len; /* Report the command and possible options */ if (tab->at_dovacuum) @@ -2703,7 +2703,7 @@ autovac_report_activity(autovac_table *tab) snprintf(activity + len, MAX_AUTOVAC_ACTIV_LEN - len, " %s.%s%s", tab->at_nspname, tab->at_relname, - tab->at_wraparound ? " (to prevent wraparound)" : ""); + tab->at_wraparound ? " (to prevent wraparound)" : ""); /* Set statement_timestamp() to current time for pg_stat_activity */ SetCurrentStatementStartTimestamp(); diff --git a/src/backend/postmaster/bgwriter.c b/src/backend/postmaster/bgwriter.c index b2a90528b6..629565a810 100644 --- a/src/backend/postmaster/bgwriter.c +++ b/src/backend/postmaster/bgwriter.c @@ -37,7 +37,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/postmaster/bgwriter.c,v 1.59 2009/06/04 18:33:07 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/bgwriter.c,v 1.60 2009/06/11 14:49:01 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -113,7 +113,7 @@ typedef struct { RelFileNode rnode; - ForkNumber forknum; + ForkNumber forknum; BlockNumber segno; /* see md.c for special values */ /* might add a real request-type field later; not needed yet */ } BgWriterRequest; @@ -424,16 +424,16 @@ BackgroundWriterMain(void) */ if (do_checkpoint) { - bool ckpt_performed = false; - bool do_restartpoint; + bool ckpt_performed = false; + bool do_restartpoint; /* use volatile pointer to prevent code rearrangement */ volatile BgWriterShmemStruct *bgs = BgWriterShmem; /* - * Check if we should perform a checkpoint or a restartpoint. - * As a side-effect, RecoveryInProgress() initializes - * TimeLineID if it's not set yet. + * Check if we should perform a checkpoint or a restartpoint. As a + * side-effect, RecoveryInProgress() initializes TimeLineID if + * it's not set yet. */ do_restartpoint = RecoveryInProgress(); @@ -460,7 +460,7 @@ BackgroundWriterMain(void) elapsed_secs < CheckPointWarning) ereport(LOG, (errmsg_plural("checkpoints are occurring too frequently (%d second apart)", - "checkpoints are occurring too frequently (%d seconds apart)", + "checkpoints are occurring too frequently (%d seconds apart)", elapsed_secs, elapsed_secs), errhint("Consider increasing the configuration parameter \"checkpoint_segments\"."))); @@ -812,8 +812,8 @@ bg_quickdie(SIGNAL_ARGS) * system reset cycle if some idiot DBA sends a manual SIGQUIT to a random * backend. This is necessary precisely because we don't clean up our * shared memory state. (The "dead man switch" mechanism in pmsignal.c - * should ensure the postmaster sees this as a crash, too, but no harm - * in being doubly sure.) + * should ensure the postmaster sees this as a crash, too, but no harm in + * being doubly sure.) */ exit(2); } @@ -952,25 +952,25 @@ RequestCheckpoint(int flags) /* * Send signal to request checkpoint. It's possible that the bgwriter - * hasn't started yet, or is in process of restarting, so we will retry - * a few times if needed. Also, if not told to wait for the checkpoint - * to occur, we consider failure to send the signal to be nonfatal and - * merely LOG it. + * hasn't started yet, or is in process of restarting, so we will retry a + * few times if needed. Also, if not told to wait for the checkpoint to + * occur, we consider failure to send the signal to be nonfatal and merely + * LOG it. */ - for (ntries = 0; ; ntries++) + for (ntries = 0;; ntries++) { if (BgWriterShmem->bgwriter_pid == 0) { - if (ntries >= 20) /* max wait 2.0 sec */ + if (ntries >= 20) /* max wait 2.0 sec */ { elog((flags & CHECKPOINT_WAIT) ? ERROR : LOG, - "could not request checkpoint because bgwriter not running"); + "could not request checkpoint because bgwriter not running"); break; } } else if (kill(BgWriterShmem->bgwriter_pid, SIGINT) != 0) { - if (ntries >= 20) /* max wait 2.0 sec */ + if (ntries >= 20) /* max wait 2.0 sec */ { elog((flags & CHECKPOINT_WAIT) ? ERROR : LOG, "could not signal for checkpoint: %m"); diff --git a/src/backend/postmaster/pgarch.c b/src/backend/postmaster/pgarch.c index 5ed6c02cb7..28306729ac 100644 --- a/src/backend/postmaster/pgarch.c +++ b/src/backend/postmaster/pgarch.c @@ -19,7 +19,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.39 2009/01/01 17:23:46 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.40 2009/06/11 14:49:01 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -348,8 +348,8 @@ pgarch_MainLoop(void) * If we've gotten SIGTERM, we normally just sit and do nothing until * SIGUSR2 arrives. However, that means a random SIGTERM would * disable archiving indefinitely, which doesn't seem like a good - * idea. If more than 60 seconds pass since SIGTERM, exit anyway, - * so that the postmaster can start a new archiver if needed. + * idea. If more than 60 seconds pass since SIGTERM, exit anyway, so + * that the postmaster can start a new archiver if needed. */ if (got_SIGTERM) { @@ -432,10 +432,10 @@ pgarch_ArchiverCopyLoop(void) { /* * Do not initiate any more archive commands after receiving - * SIGTERM, nor after the postmaster has died unexpectedly. - * The first condition is to try to keep from having init - * SIGKILL the command, and the second is to avoid conflicts - * with another archiver spawned by a newer postmaster. + * SIGTERM, nor after the postmaster has died unexpectedly. The + * first condition is to try to keep from having init SIGKILL the + * command, and the second is to avoid conflicts with another + * archiver spawned by a newer postmaster. */ if (got_SIGTERM || !PostmasterIsAlive(true)) return; @@ -549,7 +549,7 @@ pgarch_archiveXlog(char *xlog) * Per the Single Unix Spec, shells report exit status > 128 when a * called command died on a signal. */ - int lev = (WIFSIGNALED(rc) || WEXITSTATUS(rc) > 128) ? FATAL : LOG; + int lev = (WIFSIGNALED(rc) || WEXITSTATUS(rc) > 128) ? FATAL : LOG; if (WIFEXITED(rc)) { @@ -563,16 +563,16 @@ pgarch_archiveXlog(char *xlog) { #if defined(WIN32) ereport(lev, - (errmsg("archive command was terminated by exception 0x%X", - WTERMSIG(rc)), - errhint("See C include file \"ntstatus.h\" for a description of the hexadecimal value."), - errdetail("The failed archive command was: %s", - xlogarchcmd))); + (errmsg("archive command was terminated by exception 0x%X", + WTERMSIG(rc)), + errhint("See C include file \"ntstatus.h\" for a description of the hexadecimal value."), + errdetail("The failed archive command was: %s", + xlogarchcmd))); #elif defined(HAVE_DECL_SYS_SIGLIST) && HAVE_DECL_SYS_SIGLIST ereport(lev, (errmsg("archive command was terminated by signal %d: %s", WTERMSIG(rc), - WTERMSIG(rc) < NSIG ? sys_siglist[WTERMSIG(rc)] : "(unknown)"), + WTERMSIG(rc) < NSIG ? sys_siglist[WTERMSIG(rc)] : "(unknown)"), errdetail("The failed archive command was: %s", xlogarchcmd))); #else @@ -586,10 +586,10 @@ pgarch_archiveXlog(char *xlog) else { ereport(lev, - (errmsg("archive command exited with unrecognized status %d", - rc), - errdetail("The failed archive command was: %s", - xlogarchcmd))); + (errmsg("archive command exited with unrecognized status %d", + rc), + errdetail("The failed archive command was: %s", + xlogarchcmd))); } snprintf(activitymsg, sizeof(activitymsg), "failed on %s", xlog); diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index 4925e6b3b8..37808735c9 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -13,7 +13,7 @@ * * Copyright (c) 2001-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.188 2009/06/06 22:13:51 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.189 2009/06/11 14:49:01 momjian Exp $ * ---------- */ #include "postgres.h" @@ -217,6 +217,7 @@ static PgStat_GlobalStats globalStats; /* Last time the collector successfully wrote the stats file */ static TimestampTz last_statwrite; + /* Latest statistics request time from backends */ static TimestampTz last_statrequest; @@ -425,7 +426,8 @@ retry1: for (;;) /* need a loop to handle EINTR */ { FD_ZERO(&rset); - FD_SET(pgStatSock, &rset); + FD_SET (pgStatSock, &rset); + tv.tv_sec = 0; tv.tv_usec = 500000; sel_res = select(pgStatSock + 1, &rset, NULL, NULL, &tv); @@ -1213,14 +1215,14 @@ pgstat_report_analyze(Relation rel, PgStat_Counter livetuples, return; /* - * Unlike VACUUM, ANALYZE might be running inside a transaction that - * has already inserted and/or deleted rows in the target table. - * ANALYZE will have counted such rows as live or dead respectively. - * Because we will report our counts of such rows at transaction end, - * we should subtract off these counts from what we send to the collector - * now, else they'll be double-counted after commit. (This approach also - * ensures that the collector ends up with the right numbers if we abort - * instead of committing.) + * Unlike VACUUM, ANALYZE might be running inside a transaction that has + * already inserted and/or deleted rows in the target table. ANALYZE will + * have counted such rows as live or dead respectively. Because we will + * report our counts of such rows at transaction end, we should subtract + * off these counts from what we send to the collector now, else they'll + * be double-counted after commit. (This approach also ensures that the + * collector ends up with the right numbers if we abort instead of + * committing.) */ if (rel->pgstat_info != NULL) { @@ -1241,7 +1243,7 @@ pgstat_report_analyze(Relation rel, PgStat_Counter livetuples, pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_ANALYZE); msg.m_databaseid = rel->rd_rel->relisshared ? InvalidOid : MyDatabaseId; msg.m_tableoid = RelationGetRelid(rel); - msg.m_autovacuum = IsAutoVacuumWorkerProcess(); /* is this autovacuum? */ + msg.m_autovacuum = IsAutoVacuumWorkerProcess(); /* is this autovacuum? */ msg.m_analyzetime = GetCurrentTimestamp(); msg.m_live_tuples = livetuples; msg.m_dead_tuples = deadtuples; @@ -1294,7 +1296,7 @@ pgstat_init_function_usage(FunctionCallInfoData *fcinfo, PgStat_FunctionCallUsage *fcu) { PgStat_BackendFunctionEntry *htabent; - bool found; + bool found; if (pgstat_track_functions <= fcinfo->flinfo->fn_stats) { @@ -1374,8 +1376,8 @@ pgstat_end_function_usage(PgStat_FunctionCallUsage *fcu, bool finalize) * Compute the new total f_time as the total elapsed time added to the * pre-call value of f_time. This is necessary to avoid double-counting * any time taken by recursive calls of myself. (We do not need any - * similar kluge for self time, since that already excludes any - * recursive calls.) + * similar kluge for self time, since that already excludes any recursive + * calls.) */ INSTR_TIME_ADD(f_total, fcu->save_f_time); @@ -2068,7 +2070,7 @@ pgstat_fetch_global(void) static PgBackendStatus *BackendStatusArray = NULL; static PgBackendStatus *MyBEEntry = NULL; -static char *BackendActivityBuffer = NULL; +static char *BackendActivityBuffer = NULL; /* @@ -2111,7 +2113,7 @@ CreateSharedBackendStatus(void) /* Create or attach to the shared activity buffer */ size = mul_size(pgstat_track_activity_query_size, MaxBackends); - BackendActivityBuffer = (char*) + BackendActivityBuffer = (char *) ShmemInitStruct("Backend Activity Buffer", size, &found); if (!found) @@ -2120,7 +2122,8 @@ CreateSharedBackendStatus(void) /* Initialize st_activity pointers. */ buffer = BackendActivityBuffer; - for (i = 0; i < MaxBackends; i++) { + for (i = 0; i < MaxBackends; i++) + { BackendStatusArray[i].st_activity = buffer; buffer += pgstat_track_activity_query_size; } @@ -2350,7 +2353,7 @@ pgstat_read_current_status(void) volatile PgBackendStatus *beentry; PgBackendStatus *localtable; PgBackendStatus *localentry; - char *localactivity; + char *localactivity; int i; Assert(!pgStatRunningInCollector); @@ -2386,6 +2389,7 @@ pgstat_read_current_status(void) if (localentry->st_procpid > 0) { memcpy(localentry, (char *) beentry, sizeof(PgBackendStatus)); + /* * strcpy is safe even if the string is modified concurrently, * because there's always a \0 at the end of the buffer. @@ -2421,12 +2425,12 @@ pgstat_read_current_status(void) * pgstat_get_backend_current_activity() - * * Return a string representing the current activity of the backend with - * the specified PID. This looks directly at the BackendStatusArray, + * the specified PID. This looks directly at the BackendStatusArray, * and so will provide current information regardless of the age of our * transaction's snapshot of the status array. * * It is the caller's responsibility to invoke this only for backends whose - * state is expected to remain stable while the result is in use. The + * state is expected to remain stable while the result is in use. The * only current use is in deadlock reporting, where we can expect that * the target backend is blocked on a lock. (There are corner cases * where the target's wait could get aborted while we are looking at it, @@ -2452,11 +2456,11 @@ pgstat_get_backend_current_activity(int pid, bool checkUser) * must follow the protocol of retrying if st_changecount changes * while we examine the entry, or if it's odd. (This might be * unnecessary, since fetching or storing an int is almost certainly - * atomic, but let's play it safe.) We use a volatile pointer here - * to ensure the compiler doesn't try to get cute. + * atomic, but let's play it safe.) We use a volatile pointer here to + * ensure the compiler doesn't try to get cute. */ volatile PgBackendStatus *vbeentry = beentry; - bool found; + bool found; for (;;) { @@ -2664,7 +2668,7 @@ PgstatCollectorMain(int argc, char *argv[]) * * For performance reasons, we don't want to do a PostmasterIsAlive() test * after every message; instead, do it only when select()/poll() is - * interrupted by timeout. In essence, we'll stay alive as long as + * interrupted by timeout. In essence, we'll stay alive as long as * backends keep sending us stuff often, even if the postmaster is gone. */ for (;;) @@ -2722,7 +2726,7 @@ PgstatCollectorMain(int argc, char *argv[]) got_data = (input_fd.revents != 0); #else /* !HAVE_POLL */ - FD_SET(pgStatSock, &rfds); + FD_SET (pgStatSock, &rfds); /* * timeout struct is modified by select() on some operating systems, @@ -2821,9 +2825,9 @@ PgstatCollectorMain(int argc, char *argv[]) pgstat_recv_bgwriter((PgStat_MsgBgWriter *) &msg, len); break; - case PGSTAT_MTYPE_FUNCSTAT: - pgstat_recv_funcstat((PgStat_MsgFuncstat *) &msg, len); - break; + case PGSTAT_MTYPE_FUNCSTAT: + pgstat_recv_funcstat((PgStat_MsgFuncstat *) &msg, len); + break; case PGSTAT_MTYPE_FUNCPURGE: pgstat_recv_funcpurge((PgStat_MsgFuncpurge *) &msg, len); @@ -2949,8 +2953,8 @@ pgstat_write_statsfile(bool permanent) PgStat_StatFuncEntry *funcentry; FILE *fpout; int32 format_id; - const char *tmpfile = permanent?PGSTAT_STAT_PERMANENT_TMPFILE:pgstat_stat_tmpname; - const char *statfile = permanent?PGSTAT_STAT_PERMANENT_FILENAME:pgstat_stat_filename; + const char *tmpfile = permanent ? PGSTAT_STAT_PERMANENT_TMPFILE : pgstat_stat_tmpname; + const char *statfile = permanent ? PGSTAT_STAT_PERMANENT_FILENAME : pgstat_stat_filename; /* * Open the statistics temp file to write out the current values. @@ -2989,8 +2993,8 @@ pgstat_write_statsfile(bool permanent) { /* * Write out the DB entry including the number of live backends. We - * don't write the tables or functions pointers, since they're of - * no use to any other process. + * don't write the tables or functions pointers, since they're of no + * use to any other process. */ fputc('D', fpout); fwrite(dbentry, offsetof(PgStat_StatDBEntry, tables), 1, fpout); @@ -3098,7 +3102,7 @@ pgstat_read_statsfile(Oid onlydb, bool permanent) FILE *fpin; int32 format_id; bool found; - const char *statfile = permanent?PGSTAT_STAT_PERMANENT_FILENAME:pgstat_stat_filename; + const char *statfile = permanent ? PGSTAT_STAT_PERMANENT_FILENAME : pgstat_stat_filename; /* * The tables will live in pgStatLocalContext. @@ -3220,6 +3224,7 @@ pgstat_read_statsfile(Oid onlydb, bool permanent) PGSTAT_FUNCTION_HASH_SIZE, &hash_ctl, HASH_ELEM | HASH_FUNCTION | HASH_CONTEXT); + /* * Arrange that following records add entries to this * database's hash tables. @@ -3287,7 +3292,7 @@ pgstat_read_statsfile(Oid onlydb, bool permanent) break; funcentry = (PgStat_StatFuncEntry *) hash_search(funchash, - (void *) &funcbuf.functionid, + (void *) &funcbuf.functionid, HASH_ENTER, &found); if (found) @@ -3335,7 +3340,7 @@ pgstat_read_statsfile_timestamp(bool permanent, TimestampTz *ts) PgStat_GlobalStats myGlobalStats; FILE *fpin; int32 format_id; - const char *statfile = permanent?PGSTAT_STAT_PERMANENT_FILENAME:pgstat_stat_filename; + const char *statfile = permanent ? PGSTAT_STAT_PERMANENT_FILENAME : pgstat_stat_filename; /* * Try to open the status file. @@ -3386,14 +3391,14 @@ backend_read_statsfile(void) /* * We set the minimum acceptable timestamp to PGSTAT_STAT_INTERVAL msec - * before now. This indirectly ensures that the collector needn't write + * before now. This indirectly ensures that the collector needn't write * the file more often than PGSTAT_STAT_INTERVAL. In an autovacuum * worker, however, we want a lower delay to avoid using stale data, so we * use PGSTAT_RETRY_DELAY (since the number of worker is low, this * shouldn't be a problem). * * Note that we don't recompute min_ts after sleeping; so we might end up - * accepting a file a bit older than PGSTAT_STAT_INTERVAL. In practice + * accepting a file a bit older than PGSTAT_STAT_INTERVAL. In practice * that shouldn't happen, though, as long as the sleep time is less than * PGSTAT_STAT_INTERVAL; and we don't want to lie to the collector about * what our cutoff time really is. @@ -3407,7 +3412,8 @@ backend_read_statsfile(void) /* * Loop until fresh enough stats file is available or we ran out of time. - * The stats inquiry message is sent repeatedly in case collector drops it. + * The stats inquiry message is sent repeatedly in case collector drops + * it. */ for (count = 0; count < PGSTAT_POLL_LOOP_COUNT; count++) { @@ -3871,8 +3877,8 @@ pgstat_recv_funcstat(PgStat_MsgFuncstat *msg, int len) for (i = 0; i < msg->m_nentries; i++, funcmsg++) { funcentry = (PgStat_StatFuncEntry *) hash_search(dbentry->functions, - (void *) &(funcmsg->f_id), - HASH_ENTER, &found); + (void *) &(funcmsg->f_id), + HASH_ENTER, &found); if (!found) { diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index fbeb342a90..c9b0e0ab2e 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -37,7 +37,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.581 2009/05/05 19:59:00 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.582 2009/06/11 14:49:01 momjian Exp $ * * NOTES * @@ -219,7 +219,7 @@ static pid_t StartupPID = 0, static int Shutdown = NoShutdown; static bool FatalError = false; /* T if recovering from backend crash */ -static bool RecoveryError = false; /* T if WAL recovery failed */ +static bool RecoveryError = false; /* T if WAL recovery failed */ /* * We use a simple state machine to control startup, shutdown, and @@ -230,8 +230,8 @@ static bool RecoveryError = false; /* T if WAL recovery failed */ * reading the control file and other preliminary initialization steps. When * it's ready to start WAL redo, it signals postmaster, and we switch to * PM_RECOVERY phase. The background writer is launched, while the startup - * process continues applying WAL. - * + * process continues applying WAL. + * * After reaching a consistent point in WAL redo, startup process signals * us again, and we switch to PM_RECOVERY_CONSISTENT phase. There's currently * no difference between PM_RECOVERY and PM_RECOVERY_CONSISTENT, but we @@ -365,7 +365,7 @@ typedef struct HANDLE waitHandle; HANDLE procHandle; DWORD procId; -} win32_deadchild_waitinfo; +} win32_deadchild_waitinfo; HANDLE PostmasterHandle; #endif @@ -380,7 +380,7 @@ typedef struct SOCKET origsocket; /* Original socket value, or -1 if not a * socket */ WSAPROTOCOL_INFO wsainfo; -} InheritableSocket; +} InheritableSocket; #else typedef int InheritableSocket; #endif @@ -425,15 +425,15 @@ typedef struct char ExtraOptions[MAXPGPATH]; char lc_collate[NAMEDATALEN]; char lc_ctype[NAMEDATALEN]; -} BackendParameters; +} BackendParameters; static void read_backend_variables(char *id, Port *port); -static void restore_backend_variables(BackendParameters * param, Port *port); +static void restore_backend_variables(BackendParameters *param, Port *port); #ifndef WIN32 -static bool save_backend_variables(BackendParameters * param, Port *port); +static bool save_backend_variables(BackendParameters *param, Port *port); #else -static bool save_backend_variables(BackendParameters * param, Port *port, +static bool save_backend_variables(BackendParameters *param, Port *port, HANDLE childProcess, pid_t childPid); #endif @@ -898,8 +898,8 @@ PostmasterMain(int argc, char *argv[]) */ if (!load_hba()) { - /* - * It makes no sense continue if we fail to load the HBA file, since + /* + * It makes no sense continue if we fail to load the HBA file, since * there is no way to connect to the database in this case. */ ereport(FATAL, @@ -1076,11 +1076,11 @@ getInstallationPaths(const char *argv0) get_pkglib_path(my_exec_path, pkglib_path); /* - * Verify that there's a readable directory there; otherwise the - * Postgres installation is incomplete or corrupt. (A typical cause - * of this failure is that the postgres executable has been moved or - * hardlinked to some directory that's not a sibling of the installation - * lib/ directory.) + * Verify that there's a readable directory there; otherwise the Postgres + * installation is incomplete or corrupt. (A typical cause of this + * failure is that the postgres executable has been moved or hardlinked to + * some directory that's not a sibling of the installation lib/ + * directory.) */ pdir = AllocateDir(pkglib_path); if (pdir == NULL) @@ -1093,8 +1093,8 @@ getInstallationPaths(const char *argv0) FreeDir(pdir); /* - * XXX is it worth similarly checking the share/ directory? If the - * lib/ directory is there, then share/ probably is too. + * XXX is it worth similarly checking the share/ directory? If the lib/ + * directory is there, then share/ probably is too. */ } @@ -1363,7 +1363,7 @@ ServerLoop(void) * fails, we'll just try again later. */ if (BgWriterPID == 0 && - (pmState == PM_RUN || pmState == PM_RECOVERY || + (pmState == PM_RUN || pmState == PM_RECOVERY || pmState == PM_RECOVERY_CONSISTENT)) BgWriterPID = StartBackgroundWriter(); @@ -1426,7 +1426,8 @@ initMasks(fd_set *rmask) if (fd == -1) break; - FD_SET(fd, rmask); + FD_SET (fd, rmask); + if (fd > maxsock) maxsock = fd; } @@ -1811,7 +1812,7 @@ canAcceptConnections(void) if (pmState != PM_RUN) { if (pmState == PM_WAIT_BACKUP) - return CAC_WAITBACKUP; /* allow superusers only */ + return CAC_WAITBACKUP; /* allow superusers only */ if (Shutdown > NoShutdown) return CAC_SHUTDOWN; /* shutdown is pending */ if (!FatalError && @@ -2064,9 +2065,9 @@ pmdie(SIGNAL_ARGS) } /* - * Now wait for online backup mode to end and - * backends to exit. If that is already the case, - * PostmasterStateMachine will take the next step. + * Now wait for online backup mode to end and backends to exit. + * If that is already the case, PostmasterStateMachine will take + * the next step. */ PostmasterStateMachine(); break; @@ -2194,8 +2195,8 @@ reaper(SIGNAL_ARGS) /* * Unexpected exit of startup process (including FATAL exit) - * during PM_STARTUP is treated as catastrophic. There is no - * other processes running yet, so we can just exit. + * during PM_STARTUP is treated as catastrophic. There is no other + * processes running yet, so we can just exit. */ if (pmState == PM_STARTUP && !EXIT_STATUS_0(exitstatus)) { @@ -2205,9 +2206,10 @@ reaper(SIGNAL_ARGS) (errmsg("aborting startup due to startup process failure"))); ExitPostmaster(1); } + /* - * Startup process exited in response to a shutdown request (or - * it completed normally regardless of the shutdown request). + * Startup process exited in response to a shutdown request (or it + * completed normally regardless of the shutdown request). */ if (Shutdown > NoShutdown && (EXIT_STATUS_0(exitstatus) || EXIT_STATUS_1(exitstatus))) @@ -2216,10 +2218,11 @@ reaper(SIGNAL_ARGS) /* PostmasterStateMachine logic does the rest */ continue; } + /* * Any unexpected exit (including FATAL exit) of the startup - * process is treated as a crash, except that we don't want - * to reinitialize. + * process is treated as a crash, except that we don't want to + * reinitialize. */ if (!EXIT_STATUS_0(exitstatus)) { @@ -2454,8 +2457,8 @@ CleanupBackend(int pid, if (!ReleasePostmasterChildSlot(bp->child_slot)) { /* - * Uh-oh, the child failed to clean itself up. Treat - * as a crash after all. + * Uh-oh, the child failed to clean itself up. Treat as a + * crash after all. */ HandleChildCrash(pid, exitstatus, _("server process")); return; @@ -2733,8 +2736,8 @@ PostmasterStateMachine(void) pmState = PM_WAIT_DEAD_END; /* - * We already SIGQUIT'd the archiver and stats processes, - * if any, when we entered FatalError state. + * We already SIGQUIT'd the archiver and stats processes, if + * any, when we entered FatalError state. */ } else @@ -2825,8 +2828,8 @@ PostmasterStateMachine(void) else { /* - * Terminate backup mode to avoid recovery after a - * clean fast shutdown. + * Terminate backup mode to avoid recovery after a clean fast + * shutdown. */ CancelBackup(); @@ -2836,17 +2839,17 @@ PostmasterStateMachine(void) } /* - * If recovery failed, wait for all non-syslogger children to exit, - * and then exit postmaster. We don't try to reinitialize when recovery - * fails, because more than likely it will just fail again and we will - * keep trying forever. + * If recovery failed, wait for all non-syslogger children to exit, and + * then exit postmaster. We don't try to reinitialize when recovery fails, + * because more than likely it will just fail again and we will keep + * trying forever. */ if (RecoveryError && pmState == PM_NO_CHILDREN) - ExitPostmaster(1); + ExitPostmaster(1); /* - * If we need to recover from a crash, wait for all non-syslogger - * children to exit, then reset shmem and StartupDataBase. + * If we need to recover from a crash, wait for all non-syslogger children + * to exit, then reset shmem and StartupDataBase. */ if (FatalError && pmState == PM_NO_CHILDREN) { @@ -2940,8 +2943,8 @@ BackendStartup(Port *port) pid_t pid; /* - * Create backend data structure. Better before the fork() so we - * can handle failure cleanly. + * Create backend data structure. Better before the fork() so we can + * handle failure cleanly. */ bn = (Backend *) malloc(sizeof(Backend)); if (!bn) @@ -3225,8 +3228,8 @@ BackendInitialize(Port *port) if (!load_hba()) { - /* - * It makes no sense continue if we fail to load the HBA file, since + /* + * It makes no sense continue if we fail to load the HBA file, since * there is no way to connect to the database in this case. */ ereport(FATAL, @@ -3800,10 +3803,10 @@ SubPostmasterMain(int argc, char *argv[]) read_nondefault_variables(); /* - * Reload any libraries that were preloaded by the postmaster. Since - * we exec'd this process, those libraries didn't come along with us; - * but we should load them into all child processes to be consistent - * with the non-EXEC_BACKEND behavior. + * Reload any libraries that were preloaded by the postmaster. Since we + * exec'd this process, those libraries didn't come along with us; but we + * should load them into all child processes to be consistent with the + * non-EXEC_BACKEND behavior. */ process_shared_preload_libraries(); @@ -3991,8 +3994,8 @@ sigusr1_handler(SIGNAL_ARGS) FatalError = false; /* - * Crank up the background writer. It doesn't matter if this - * fails, we'll just try again later. + * Crank up the background writer. It doesn't matter if this fails, + * we'll just try again later. */ Assert(BgWriterPID == 0); BgWriterPID = StartBackgroundWriter(); @@ -4005,7 +4008,7 @@ sigusr1_handler(SIGNAL_ARGS) /* * Load the flat authorization file into postmaster's cache. The * startup process won't have recomputed this from the database yet, - * so we it may change following recovery. + * so we it may change following recovery. */ load_role(); @@ -4292,10 +4295,10 @@ StartAutovacuumWorker(void) if (bn) { /* - * Compute the cancel key that will be assigned to this session. We - * probably don't need cancel keys for autovac workers, but we'd - * better have something random in the field to prevent unfriendly - * people from sending cancels to them. + * Compute the cancel key that will be assigned to this session. + * We probably don't need cancel keys for autovac workers, but + * we'd better have something random in the field to prevent + * unfriendly people from sending cancels to them. */ MyCancelKey = PostmasterRandom(); bn->cancel_key = MyCancelKey; @@ -4379,9 +4382,9 @@ CreateOptsFile(int argc, char *argv[], char *fullprogname) * This reports the number of entries needed in per-child-process arrays * (the PMChildFlags array, and if EXEC_BACKEND the ShmemBackendArray). * These arrays include regular backends and autovac workers, but not special - * children nor dead_end children. This allows the arrays to have a fixed + * children nor dead_end children. This allows the arrays to have a fixed * maximum size, to wit the same too-many-children limit enforced by - * canAcceptConnections(). The exact value isn't too critical as long as + * canAcceptConnections(). The exact value isn't too critical as long as * it's more than MaxBackends. */ int @@ -4409,20 +4412,20 @@ extern int pgStatSock; #define write_inheritable_socket(dest, src, childpid) (*(dest) = (src)) #define read_inheritable_socket(dest, src) (*(dest) = *(src)) #else -static void write_duplicated_handle(HANDLE * dest, HANDLE src, HANDLE child); -static void write_inheritable_socket(InheritableSocket * dest, SOCKET src, +static void write_duplicated_handle(HANDLE *dest, HANDLE src, HANDLE child); +static void write_inheritable_socket(InheritableSocket *dest, SOCKET src, pid_t childPid); -static void read_inheritable_socket(SOCKET * dest, InheritableSocket * src); +static void read_inheritable_socket(SOCKET *dest, InheritableSocket *src); #endif /* Save critical backend variables into the BackendParameters struct */ #ifndef WIN32 static bool -save_backend_variables(BackendParameters * param, Port *port) +save_backend_variables(BackendParameters *param, Port *port) #else static bool -save_backend_variables(BackendParameters * param, Port *port, +save_backend_variables(BackendParameters *param, Port *port, HANDLE childProcess, pid_t childPid) #endif { @@ -4484,7 +4487,7 @@ save_backend_variables(BackendParameters * param, Port *port, * process instance of the handle to the parameter file. */ static void -write_duplicated_handle(HANDLE * dest, HANDLE src, HANDLE childProcess) +write_duplicated_handle(HANDLE *dest, HANDLE src, HANDLE childProcess) { HANDLE hChild = INVALID_HANDLE_VALUE; @@ -4510,7 +4513,7 @@ write_duplicated_handle(HANDLE * dest, HANDLE src, HANDLE childProcess) * straight socket inheritance. */ static void -write_inheritable_socket(InheritableSocket * dest, SOCKET src, pid_t childpid) +write_inheritable_socket(InheritableSocket *dest, SOCKET src, pid_t childpid) { dest->origsocket = src; if (src != 0 && src != -1) @@ -4527,7 +4530,7 @@ write_inheritable_socket(InheritableSocket * dest, SOCKET src, pid_t childpid) * Read a duplicate socket structure back, and get the socket descriptor. */ static void -read_inheritable_socket(SOCKET * dest, InheritableSocket * src) +read_inheritable_socket(SOCKET *dest, InheritableSocket *src) { SOCKET s; @@ -4632,7 +4635,7 @@ read_backend_variables(char *id, Port *port) /* Restore critical backend variables from the BackendParameters struct */ static void -restore_backend_variables(BackendParameters * param, Port *port) +restore_backend_variables(BackendParameters *param, Port *port) { memcpy(port, ¶m->port, sizeof(Port)); read_inheritable_socket(&port->sock, ¶m->portsocket); @@ -4717,7 +4720,6 @@ ShmemBackendArrayRemove(Backend *bn) /* Mark the slot as empty */ ShmemBackendArray[i].pid = 0; } - #endif /* EXEC_BACKEND */ diff --git a/src/backend/postmaster/syslogger.c b/src/backend/postmaster/syslogger.c index 8475bdbd88..e6577c944d 100644 --- a/src/backend/postmaster/syslogger.c +++ b/src/backend/postmaster/syslogger.c @@ -18,7 +18,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.50 2009/03/18 08:44:49 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.51 2009/06/11 14:49:01 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -368,7 +368,8 @@ SysLoggerMain(int argc, char *argv[]) * Wait for some data, timing out after 1 second */ FD_ZERO(&rfds); - FD_SET(syslogPipe[0], &rfds); + FD_SET (syslogPipe[0], &rfds); + timeout.tv_sec = 1; timeout.tv_usec = 0; @@ -1194,7 +1195,7 @@ logfile_getname(pg_time_t timestamp, char *suffix) /* treat it as a strftime pattern */ pg_strftime(filename + len, MAXPGPATH - len, Log_filename, - pg_localtime(×tamp, log_timezone)); + pg_localtime(×tamp, log_timezone)); if (suffix != NULL) { diff --git a/src/backend/postmaster/walwriter.c b/src/backend/postmaster/walwriter.c index 414731ebc5..9e08a5b710 100644 --- a/src/backend/postmaster/walwriter.c +++ b/src/backend/postmaster/walwriter.c @@ -34,7 +34,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/postmaster/walwriter.c,v 1.6 2009/05/15 15:56:39 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/walwriter.c,v 1.7 2009/06/11 14:49:01 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -302,8 +302,8 @@ wal_quickdie(SIGNAL_ARGS) * system reset cycle if some idiot DBA sends a manual SIGQUIT to a random * backend. This is necessary precisely because we don't clean up our * shared memory state. (The "dead man switch" mechanism in pmsignal.c - * should ensure the postmaster sees this as a crash, too, but no harm - * in being doubly sure.) + * should ensure the postmaster sees this as a crash, too, but no harm in + * being doubly sure.) */ exit(2); } diff --git a/src/backend/regex/regc_lex.c b/src/backend/regex/regc_lex.c index d2fc591ed8..782c0085c2 100644 --- a/src/backend/regex/regc_lex.c +++ b/src/backend/regex/regc_lex.c @@ -28,7 +28,7 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $PostgreSQL: pgsql/src/backend/regex/regc_lex.c,v 1.8 2008/02/14 17:33:37 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/regex/regc_lex.c,v 1.9 2009/06/11 14:49:01 momjian Exp $ * */ @@ -214,47 +214,47 @@ lexnest(struct vars * v, /* * string constants to interpolate as expansions of things like \d */ -static const chr backd[] = { /* \d */ +static const chr backd[] = { /* \d */ CHR('['), CHR('['), CHR(':'), CHR('d'), CHR('i'), CHR('g'), CHR('i'), CHR('t'), CHR(':'), CHR(']'), CHR(']') }; -static const chr backD[] = { /* \D */ +static const chr backD[] = { /* \D */ CHR('['), CHR('^'), CHR('['), CHR(':'), CHR('d'), CHR('i'), CHR('g'), CHR('i'), CHR('t'), CHR(':'), CHR(']'), CHR(']') }; -static const chr brbackd[] = { /* \d within brackets */ +static const chr brbackd[] = { /* \d within brackets */ CHR('['), CHR(':'), CHR('d'), CHR('i'), CHR('g'), CHR('i'), CHR('t'), CHR(':'), CHR(']') }; -static const chr backs[] = { /* \s */ +static const chr backs[] = { /* \s */ CHR('['), CHR('['), CHR(':'), CHR('s'), CHR('p'), CHR('a'), CHR('c'), CHR('e'), CHR(':'), CHR(']'), CHR(']') }; -static const chr backS[] = { /* \S */ +static const chr backS[] = { /* \S */ CHR('['), CHR('^'), CHR('['), CHR(':'), CHR('s'), CHR('p'), CHR('a'), CHR('c'), CHR('e'), CHR(':'), CHR(']'), CHR(']') }; -static const chr brbacks[] = { /* \s within brackets */ +static const chr brbacks[] = { /* \s within brackets */ CHR('['), CHR(':'), CHR('s'), CHR('p'), CHR('a'), CHR('c'), CHR('e'), CHR(':'), CHR(']') }; -static const chr backw[] = { /* \w */ +static const chr backw[] = { /* \w */ CHR('['), CHR('['), CHR(':'), CHR('a'), CHR('l'), CHR('n'), CHR('u'), CHR('m'), CHR(':'), CHR(']'), CHR('_'), CHR(']') }; -static const chr backW[] = { /* \W */ +static const chr backW[] = { /* \W */ CHR('['), CHR('^'), CHR('['), CHR(':'), CHR('a'), CHR('l'), CHR('n'), CHR('u'), CHR('m'), CHR(':'), CHR(']'), CHR('_'), CHR(']') }; -static const chr brbackw[] = { /* \w within brackets */ +static const chr brbackw[] = { /* \w within brackets */ CHR('['), CHR(':'), CHR('a'), CHR('l'), CHR('n'), CHR('u'), CHR('m'), CHR(':'), CHR(']'), CHR('_') diff --git a/src/backend/regex/regc_nfa.c b/src/backend/regex/regc_nfa.c index 4e307f5c15..ef56630173 100644 --- a/src/backend/regex/regc_nfa.c +++ b/src/backend/regex/regc_nfa.c @@ -28,7 +28,7 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $PostgreSQL: pgsql/src/backend/regex/regc_nfa.c,v 1.6 2008/02/14 17:33:37 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/regex/regc_nfa.c,v 1.7 2009/06/11 14:49:01 momjian Exp $ * * * One or two things that technically ought to be in here @@ -93,7 +93,7 @@ newnfa(struct vars * v, * TooManyStates - checks if the max states exceeds the compile-time value */ static int -TooManyStates(struct nfa *nfa) +TooManyStates(struct nfa * nfa) { struct nfa *parent = nfa->parent; size_t sz = nfa->size; @@ -112,7 +112,7 @@ TooManyStates(struct nfa *nfa) * IncrementSize - increases the tracked size of the NFA and its parents. */ static void -IncrementSize(struct nfa *nfa) +IncrementSize(struct nfa * nfa) { struct nfa *parent = nfa->parent; @@ -128,7 +128,7 @@ IncrementSize(struct nfa *nfa) * DecrementSize - decreases the tracked size of the NFA and its parents. */ static void -DecrementSize(struct nfa *nfa) +DecrementSize(struct nfa * nfa) { struct nfa *parent = nfa->parent; @@ -856,7 +856,8 @@ pull(struct nfa * nfa, /* * DGP 2007-11-15: Cloning a state with a circular constraint on its list - * of outs can lead to trouble [Tcl Bug 1810038], so get rid of them first. + * of outs can lead to trouble [Tcl Bug 1810038], so get rid of them + * first. */ for (a = from->outs; a != NULL; a = nexta) { @@ -998,12 +999,12 @@ push(struct nfa * nfa, } /* - * DGP 2007-11-15: Here we duplicate the same protections as appear - * in pull() above to avoid troubles with cloning a state with a - * circular constraint on its list of ins. It is not clear whether - * this is necessary, or is protecting against a "can't happen". - * Any test case that actually leads to a freearc() call here would - * be a welcome addition to the test suite. + * DGP 2007-11-15: Here we duplicate the same protections as appear in + * pull() above to avoid troubles with cloning a state with a circular + * constraint on its list of ins. It is not clear whether this is + * necessary, or is protecting against a "can't happen". Any test case + * that actually leads to a freearc() call here would be a welcome + * addition to the test suite. */ for (a = to->ins; a != NULL; a = nexta) { @@ -1143,7 +1144,7 @@ fixempties(struct nfa * nfa, { progress = 0; for (s = nfa->states; s != NULL && !NISERR() && - s->no != FREESTATE; s = nexts) + s->no != FREESTATE; s = nexts) { nexts = s->next; for (a = s->outs; a != NULL && !NISERR(); a = nexta) diff --git a/src/backend/rewrite/rewriteDefine.c b/src/backend/rewrite/rewriteDefine.c index b1f8c6e3ff..77a889412f 100644 --- a/src/backend/rewrite/rewriteDefine.c +++ b/src/backend/rewrite/rewriteDefine.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.137 2009/05/13 22:32:55 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.138 2009/06/11 14:49:01 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -120,7 +120,7 @@ InsertRule(char *rulname, replaces[Anum_pg_rewrite_ev_action - 1] = true; tup = heap_modify_tuple(oldtup, RelationGetDescr(pg_rewrite_desc), - values, nulls, replaces); + values, nulls, replaces); simple_heap_update(pg_rewrite_desc, &tup->t_self, tup); @@ -388,9 +388,9 @@ DefineQueryRewrite(char *rulename, * * If so, check that the relation is empty because the storage for the * relation is going to be deleted. Also insist that the rel not have - * any triggers, indexes, or child tables. (Note: these tests are - * too strict, because they will reject relations that once had such - * but don't anymore. But we don't really care, because this whole + * any triggers, indexes, or child tables. (Note: these tests are too + * strict, because they will reject relations that once had such but + * don't anymore. But we don't really care, because this whole * business of converting relations to views is just a kluge to allow * loading ancient pg_dump files.) */ diff --git a/src/backend/rewrite/rewriteHandler.c b/src/backend/rewrite/rewriteHandler.c index 336ae829ce..c1233b6357 100644 --- a/src/backend/rewrite/rewriteHandler.c +++ b/src/backend/rewrite/rewriteHandler.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.185 2009/01/27 12:40:15 petere Exp $ + * $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.186 2009/06/11 14:49:01 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -381,7 +381,7 @@ rewriteRuleAction(Query *parsetree, break; } if (sub_action->hasSubLinks) - break; /* no need to keep scanning rtable */ + break; /* no need to keep scanning rtable */ } } @@ -501,7 +501,7 @@ rewriteRuleAction(Query *parsetree, */ if (parsetree->hasSubLinks && !rule_action->hasSubLinks) rule_action->hasSubLinks = - checkExprHasSubLink((Node *) rule_action->returningList); + checkExprHasSubLink((Node *) rule_action->returningList); } return rule_action; @@ -1261,7 +1261,7 @@ markQueryForLocking(Query *qry, Node *jtnode, bool forUpdate, bool noWait) if (strcmp(cte->ctename, rte->ctename) == 0) break; } - if (lc == NULL) /* shouldn't happen */ + if (lc == NULL) /* shouldn't happen */ elog(ERROR, "could not find CTE \"%s\"", rte->ctename); /* should be analyzed by now */ Assert(IsA(cte->ctequery, Query)); diff --git a/src/backend/rewrite/rewriteManip.c b/src/backend/rewrite/rewriteManip.c index 72cddaaa34..570434ed83 100644 --- a/src/backend/rewrite/rewriteManip.c +++ b/src/backend/rewrite/rewriteManip.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.121 2009/02/25 03:30:37 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.122 2009/06/11 14:49:01 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -40,12 +40,12 @@ typedef struct } locate_windowfunc_context; static bool contain_aggs_of_level_walker(Node *node, - contain_aggs_of_level_context *context); + contain_aggs_of_level_context *context); static bool locate_agg_of_level_walker(Node *node, - locate_agg_of_level_context *context); + locate_agg_of_level_context *context); static bool contain_windowfuncs_walker(Node *node, void *context); static bool locate_windowfunc_walker(Node *node, - locate_windowfunc_context *context); + locate_windowfunc_context *context); static bool checkExprHasSubLink_walker(Node *node, void *context); static Relids offset_relid_set(Relids relids, int offset); static Relids adjust_relid_set(Relids relids, int oldrelid, int newrelid); @@ -68,7 +68,7 @@ checkExprHasAggs(Node *node) * specified query level. * * The objective of this routine is to detect whether there are aggregates - * belonging to the given query level. Aggregates belonging to subqueries + * belonging to the given query level. Aggregates belonging to subqueries * or outer queries do NOT cause a true result. We must recurse into * subqueries to detect outer-reference aggregates that logically belong to * the specified query level. @@ -123,7 +123,7 @@ contain_aggs_of_level_walker(Node *node, * Find the parse location of any aggregate of the specified query level. * * Returns -1 if no such agg is in the querytree, or if they all have - * unknown parse location. (The former case is probably caller error, + * unknown parse location. (The former case is probably caller error, * but we don't bother to distinguish it from the latter case.) * * Note: it might seem appropriate to merge this functionality into @@ -136,7 +136,7 @@ locate_agg_of_level(Node *node, int levelsup) { locate_agg_of_level_context context; - context.agg_location = -1; /* in case we find nothing */ + context.agg_location = -1; /* in case we find nothing */ context.sublevels_up = levelsup; /* @@ -207,7 +207,7 @@ contain_windowfuncs_walker(Node *node, void *context) if (node == NULL) return false; if (IsA(node, WindowFunc)) - return true; /* abort the tree traversal and return true */ + return true; /* abort the tree traversal and return true */ /* Mustn't recurse into subselects */ return expression_tree_walker(node, contain_windowfuncs_walker, (void *) context); @@ -218,7 +218,7 @@ contain_windowfuncs_walker(Node *node, void *context) * Find the parse location of any windowfunc of the current query level. * * Returns -1 if no such windowfunc is in the querytree, or if they all have - * unknown parse location. (The former case is probably caller error, + * unknown parse location. (The former case is probably caller error, * but we don't bother to distinguish it from the latter case.) * * Note: it might seem appropriate to merge this functionality into @@ -231,7 +231,7 @@ locate_windowfunc(Node *node) { locate_windowfunc_context context; - context.win_location = -1; /* in case we find nothing */ + context.win_location = -1; /* in case we find nothing */ /* * Must be prepared to start with a Query or a bare expression tree; if @@ -1169,7 +1169,7 @@ ResolveNew_mutator(Node *node, ResolveNew_context *context) * If generating an expansion for a var of a named rowtype * (ie, this is a plain relation RTE), then we must include * dummy items for dropped columns. If the var is RECORD (ie, - * this is a JOIN), then omit dropped columns. Either way, + * this is a JOIN), then omit dropped columns. Either way, * attach column names to the RowExpr for use of ruleutils.c. */ expandRTE(context->target_rte, diff --git a/src/backend/rewrite/rewriteRemove.c b/src/backend/rewrite/rewriteRemove.c index a7b4413e3e..f40b207718 100644 --- a/src/backend/rewrite/rewriteRemove.c +++ b/src/backend/rewrite/rewriteRemove.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/rewrite/rewriteRemove.c,v 1.77 2009/01/27 12:40:15 petere Exp $ + * $PostgreSQL: pgsql/src/backend/rewrite/rewriteRemove.c,v 1.78 2009/06/11 14:49:01 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -126,9 +126,9 @@ RemoveRewriteRuleById(Oid ruleOid) elog(ERROR, "could not find tuple for rule %u", ruleOid); /* - * We had better grab AccessExclusiveLock to ensure that no queries - * are going on that might depend on this rule. (Note: a weaker lock - * would suffice if it's not an ON SELECT rule.) + * We had better grab AccessExclusiveLock to ensure that no queries are + * going on that might depend on this rule. (Note: a weaker lock would + * suffice if it's not an ON SELECT rule.) */ eventRelationOid = ((Form_pg_rewrite) GETSTRUCT(tuple))->ev_class; event_relation = heap_open(eventRelationOid, AccessExclusiveLock); diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index da5f8a7414..be4c86bd38 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.251 2009/04/03 18:17:43 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.252 2009/06/11 14:49:01 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -81,9 +81,9 @@ static volatile BufferDesc *PinCountWaitBuf = NULL; static Buffer ReadBuffer_common(SMgrRelation reln, bool isLocalBuf, - ForkNumber forkNum, BlockNumber blockNum, - ReadBufferMode mode , BufferAccessStrategy strategy, - bool *hit); + ForkNumber forkNum, BlockNumber blockNum, + ReadBufferMode mode, BufferAccessStrategy strategy, + bool *hit); static bool PinBuffer(volatile BufferDesc *buf, BufferAccessStrategy strategy); static void PinBuffer_Locked(volatile BufferDesc *buf); static void UnpinBuffer(volatile BufferDesc *buf, bool fixOwner); @@ -106,7 +106,7 @@ static void AtProcExit_Buffers(int code, Datum arg); * PrefetchBuffer -- initiate asynchronous read of a block of a relation * * This is named by analogy to ReadBuffer but doesn't actually allocate a - * buffer. Instead it tries to ensure that a future ReadBuffer for the given + * buffer. Instead it tries to ensure that a future ReadBuffer for the given * block will not be delayed by the I/O. Prefetching is optional. * No-op if prefetching isn't compiled in. */ @@ -126,16 +126,16 @@ PrefetchBuffer(Relation reln, ForkNumber forkNum, BlockNumber blockNum) if (RELATION_IS_OTHER_TEMP(reln)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot access temporary tables of other sessions"))); + errmsg("cannot access temporary tables of other sessions"))); /* pass it off to localbuf.c */ LocalPrefetchBuffer(reln->rd_smgr, forkNum, blockNum); } else { - BufferTag newTag; /* identity of requested block */ - uint32 newHash; /* hash value for newTag */ - LWLockId newPartitionLock; /* buffer partition lock for it */ + BufferTag newTag; /* identity of requested block */ + uint32 newHash; /* hash value for newTag */ + LWLockId newPartitionLock; /* buffer partition lock for it */ int buf_id; /* create a tag so we can lookup the buffer */ @@ -156,17 +156,17 @@ PrefetchBuffer(Relation reln, ForkNumber forkNum, BlockNumber blockNum) /* * If the block *is* in buffers, we do nothing. This is not really - * ideal: the block might be just about to be evicted, which would - * be stupid since we know we are going to need it soon. But the - * only easy answer is to bump the usage_count, which does not seem - * like a great solution: when the caller does ultimately touch the - * block, usage_count would get bumped again, resulting in too much - * favoritism for blocks that are involved in a prefetch sequence. - * A real fix would involve some additional per-buffer state, and - * it's not clear that there's enough of a problem to justify that. + * ideal: the block might be just about to be evicted, which would be + * stupid since we know we are going to need it soon. But the only + * easy answer is to bump the usage_count, which does not seem like a + * great solution: when the caller does ultimately touch the block, + * usage_count would get bumped again, resulting in too much + * favoritism for blocks that are involved in a prefetch sequence. A + * real fix would involve some additional per-buffer state, and it's + * not clear that there's enough of a problem to justify that. */ } -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ } @@ -202,7 +202,7 @@ ReadBuffer(Relation reln, BlockNumber blockNum) * for non-critical data, where the caller is prepared to repair errors. * * In RBM_ZERO mode, if the page isn't in buffer cache already, it's filled - * with zeros instead of reading it from disk. Useful when the caller is + * with zeros instead of reading it from disk. Useful when the caller is * going to fill the page from scratch, since this saves I/O and avoids * unnecessary failure if the page-on-disk has corrupt page headers. * Caution: do not use this mode to read a page that is beyond the relation's @@ -216,16 +216,16 @@ Buffer ReadBufferExtended(Relation reln, ForkNumber forkNum, BlockNumber blockNum, ReadBufferMode mode, BufferAccessStrategy strategy) { - bool hit; - Buffer buf; + bool hit; + Buffer buf; /* Open it at the smgr level if not already done */ RelationOpenSmgr(reln); /* - * Reject attempts to read non-local temporary relations; we would - * be likely to get wrong data since we have no visibility into the - * owning session's local buffers. + * Reject attempts to read non-local temporary relations; we would be + * likely to get wrong data since we have no visibility into the owning + * session's local buffers. */ if (RELATION_IS_OTHER_TEMP(reln)) ereport(ERROR, @@ -233,8 +233,8 @@ ReadBufferExtended(Relation reln, ForkNumber forkNum, BlockNumber blockNum, errmsg("cannot access temporary tables of other sessions"))); /* - * Read the buffer, and update pgstat counters to reflect a cache - * hit or miss. + * Read the buffer, and update pgstat counters to reflect a cache hit or + * miss. */ pgstat_count_buffer_read(reln); buf = ReadBuffer_common(reln->rd_smgr, reln->rd_istemp, forkNum, blockNum, @@ -256,9 +256,10 @@ ReadBufferWithoutRelcache(RelFileNode rnode, bool isTemp, ForkNumber forkNum, BlockNumber blockNum, ReadBufferMode mode, BufferAccessStrategy strategy) { - bool hit; + bool hit; SMgrRelation smgr = smgropen(rnode); + return ReadBuffer_common(smgr, isTemp, forkNum, blockNum, mode, strategy, &hit); } @@ -357,9 +358,9 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, ForkNumber forkNum, bufBlock = isLocalBuf ? LocalBufHdrGetBlock(bufHdr) : BufHdrGetBlock(bufHdr); if (!PageIsNew((Page) bufBlock)) ereport(ERROR, - (errmsg("unexpected data beyond EOF in block %u of relation %s", - blockNum, relpath(smgr->smgr_rnode, forkNum)), - errhint("This has been seen to occur with buggy kernels; consider updating your system."))); + (errmsg("unexpected data beyond EOF in block %u of relation %s", + blockNum, relpath(smgr->smgr_rnode, forkNum)), + errhint("This has been seen to occur with buggy kernels; consider updating your system."))); /* * We *must* do smgrextend before succeeding, else the page will not @@ -439,9 +440,9 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, ForkNumber forkNum, else ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), - errmsg("invalid page header in block %u of relation %s", - blockNum, - relpath(smgr->smgr_rnode, forkNum)))); + errmsg("invalid page header in block %u of relation %s", + blockNum, + relpath(smgr->smgr_rnode, forkNum)))); } } } @@ -631,17 +632,17 @@ BufferAlloc(SMgrRelation smgr, ForkNumber forkNum, /* OK, do the I/O */ TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_START(forkNum, blockNum, - smgr->smgr_rnode.spcNode, - smgr->smgr_rnode.dbNode, - smgr->smgr_rnode.relNode); + smgr->smgr_rnode.spcNode, + smgr->smgr_rnode.dbNode, + smgr->smgr_rnode.relNode); FlushBuffer(buf, NULL); LWLockRelease(buf->content_lock); TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_DONE(forkNum, blockNum, - smgr->smgr_rnode.spcNode, + smgr->smgr_rnode.spcNode, smgr->smgr_rnode.dbNode, - smgr->smgr_rnode.relNode); + smgr->smgr_rnode.relNode); } else { @@ -983,7 +984,7 @@ ReleaseAndReadBuffer(Buffer buffer, Relation relation, BlockNumber blockNum) { - ForkNumber forkNum = MAIN_FORKNUM; + ForkNumber forkNum = MAIN_FORKNUM; volatile BufferDesc *bufHdr; if (BufferIsValid(buffer)) @@ -2708,7 +2709,8 @@ AbortBufferIO(void) if (sv_flags & BM_IO_ERROR) { /* Buffer is pinned, so we can read tag without spinlock */ - char *path = relpath(buf->tag.rnode, buf->tag.forkNum); + char *path = relpath(buf->tag.rnode, buf->tag.forkNum); + ereport(WARNING, (errcode(ERRCODE_IO_ERROR), errmsg("could not write block %u of %s", @@ -2732,7 +2734,8 @@ buffer_write_error_callback(void *arg) /* Buffer is pinned, so we can read the tag without locking the spinlock */ if (bufHdr != NULL) { - char *path = relpath(bufHdr->tag.rnode, bufHdr->tag.forkNum); + char *path = relpath(bufHdr->tag.rnode, bufHdr->tag.forkNum); + errcontext("writing block %u of relation %s", bufHdr->tag.blockNum, path); pfree(path); diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c index 5431419cfe..3caa42a1a6 100644 --- a/src/backend/storage/buffer/localbuf.c +++ b/src/backend/storage/buffer/localbuf.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.86 2009/01/12 05:10:44 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.87 2009/06/11 14:49:01 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -85,7 +85,7 @@ LocalPrefetchBuffer(SMgrRelation smgr, ForkNumber forkNum, /* Not in buffers, so initiate prefetch */ smgrprefetch(smgr, forkNum, blockNum); -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ } @@ -149,7 +149,7 @@ LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum, #ifdef LBDEBUG fprintf(stderr, "LB ALLOC (%u,%d,%d) %d\n", - smgr->smgr_rnode.relNode, forkNum, blockNum, -nextFreeLocalBuf - 1); + smgr->smgr_rnode.relNode, forkNum, blockNum, -nextFreeLocalBuf - 1); #endif /* diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index 3779a28d3d..9516c88acd 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/file/buffile.c,v 1.33 2009/01/01 17:23:47 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/storage/file/buffile.c,v 1.34 2009/06/11 14:49:01 momjian Exp $ * * NOTES: * @@ -125,7 +125,7 @@ extendBufFile(BufFile *file) file->files = (File *) repalloc(file->files, (file->numFiles + 1) * sizeof(File)); file->offsets = (off_t *) repalloc(file->offsets, - (file->numFiles + 1) * sizeof(off_t)); + (file->numFiles + 1) * sizeof(off_t)); file->files[file->numFiles] = pfile; file->offsets[file->numFiles] = 0L; file->numFiles++; diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c index 7749d5a405..e0742701f1 100644 --- a/src/backend/storage/file/fd.c +++ b/src/backend/storage/file/fd.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.148 2009/03/04 09:12:49 petere Exp $ + * $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.149 2009/06/11 14:49:01 momjian Exp $ * * NOTES: * @@ -128,13 +128,13 @@ static int max_safe_fds = 32; /* default if not changed */ * Flag to tell whether it's worth scanning VfdCache looking for temp files to * close */ -static bool have_xact_temporary_files = false; +static bool have_xact_temporary_files = false; typedef struct vfd { int fd; /* current FD, or VFD_CLOSED if none */ unsigned short fdstate; /* bitflags for VFD's state */ - SubTransactionId create_subid; /* for TEMPORARY fds, creating subxact */ + SubTransactionId create_subid; /* for TEMPORARY fds, creating subxact */ File nextFree; /* link to next free VFD, if in freelist */ File lruMoreRecently; /* doubly linked recency-of-use list */ File lruLessRecently; @@ -364,6 +364,7 @@ count_usable_fds(int max_to_probe, int *usable_fds, int *already_open) int used = 0; int highestfd = 0; int j; + #ifdef HAVE_GETRLIMIT struct rlimit rlim; int getrlimit_status; @@ -373,14 +374,14 @@ count_usable_fds(int max_to_probe, int *usable_fds, int *already_open) fd = (int *) palloc(size * sizeof(int)); #ifdef HAVE_GETRLIMIT -# ifdef RLIMIT_NOFILE /* most platforms use RLIMIT_NOFILE */ +#ifdef RLIMIT_NOFILE /* most platforms use RLIMIT_NOFILE */ getrlimit_status = getrlimit(RLIMIT_NOFILE, &rlim); -# else /* but BSD doesn't ... */ +#else /* but BSD doesn't ... */ getrlimit_status = getrlimit(RLIMIT_OFILE, &rlim); -# endif /* RLIMIT_NOFILE */ +#endif /* RLIMIT_NOFILE */ if (getrlimit_status != 0) ereport(WARNING, (errmsg("getrlimit failed: %m"))); -#endif /* HAVE_GETRLIMIT */ +#endif /* HAVE_GETRLIMIT */ /* dup until failure or probe limit reached */ for (;;) @@ -388,7 +389,11 @@ count_usable_fds(int max_to_probe, int *usable_fds, int *already_open) int thisfd; #ifdef HAVE_GETRLIMIT - /* don't go beyond RLIMIT_NOFILE; causes irritating kernel logs on some platforms */ + + /* + * don't go beyond RLIMIT_NOFILE; causes irritating kernel logs on + * some platforms + */ if (getrlimit_status == 0 && highestfd >= rlim.rlim_cur - 1) break; #endif @@ -1069,7 +1074,7 @@ FilePrefetch(File file, off_t offset, int amount) int returnCode; Assert(FileIsValid(file)); - + DO_DB(elog(LOG, "FilePrefetch: %d (%s) " INT64_FORMAT " %d", file, VfdCache[file].fileName, (int64) offset, amount)); diff --git a/src/backend/storage/freespace/freespace.c b/src/backend/storage/freespace/freespace.c index 558c56f80d..f61c5143ba 100644 --- a/src/backend/storage/freespace/freespace.c +++ b/src/backend/storage/freespace/freespace.c @@ -8,16 +8,16 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/freespace/freespace.c,v 1.72 2009/01/20 18:59:37 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/storage/freespace/freespace.c,v 1.73 2009/06/11 14:49:01 momjian Exp $ * * * NOTES: * - * Free Space Map keeps track of the amount of free space on pages, and - * allows quickly searching for a page with enough free space. The FSM is - * stored in a dedicated relation fork of all heap relations, and those - * index access methods that need it (see also indexfsm.c). See README for - * more information. + * Free Space Map keeps track of the amount of free space on pages, and + * allows quickly searching for a page with enough free space. The FSM is + * stored in a dedicated relation fork of all heap relations, and those + * index access methods that need it (see also indexfsm.c). See README for + * more information. * *------------------------------------------------------------------------- */ @@ -49,10 +49,10 @@ * look like this * * - * Range Category - * 0 - 31 0 - * 32 - 63 1 - * ... ... ... + * Range Category + * 0 - 31 0 + * 32 - 63 1 + * ... ... ... * 8096 - 8127 253 * 8128 - 8163 254 * 8164 - 8192 255 @@ -86,12 +86,12 @@ */ typedef struct { - int level; /* level */ - int logpageno; /* page number within the level */ + int level; /* level */ + int logpageno; /* page number within the level */ } FSMAddress; /* Address of the root page. */ -static const FSMAddress FSM_ROOT_ADDRESS = { FSM_ROOT_LEVEL, 0 }; +static const FSMAddress FSM_ROOT_ADDRESS = {FSM_ROOT_LEVEL, 0}; /* functions to navigate the tree */ static FSMAddress fsm_get_child(FSMAddress parent, uint16 slot); @@ -106,11 +106,11 @@ static void fsm_extend(Relation rel, BlockNumber fsm_nblocks); /* functions to convert amount of free space to a FSM category */ static uint8 fsm_space_avail_to_cat(Size avail); static uint8 fsm_space_needed_to_cat(Size needed); -static Size fsm_space_cat_to_avail(uint8 cat); +static Size fsm_space_cat_to_avail(uint8 cat); /* workhorse functions for various operations */ static int fsm_set_and_search(Relation rel, FSMAddress addr, uint16 slot, - uint8 newValue, uint8 minValue); + uint8 newValue, uint8 minValue); static BlockNumber fsm_search(Relation rel, uint8 min_cat); static uint8 fsm_vacuum_page(Relation rel, FSMAddress addr, bool *eof); @@ -133,7 +133,8 @@ static uint8 fsm_vacuum_page(Relation rel, FSMAddress addr, bool *eof); BlockNumber GetPageWithFreeSpace(Relation rel, Size spaceNeeded) { - uint8 min_cat = fsm_space_needed_to_cat(spaceNeeded); + uint8 min_cat = fsm_space_needed_to_cat(spaceNeeded); + return fsm_search(rel, min_cat); } @@ -259,7 +260,7 @@ GetRecordedFreeSpace(Relation rel, BlockNumber heapBlk) void FreeSpaceMapTruncateRel(Relation rel, BlockNumber nblocks) { - BlockNumber new_nfsmblocks; + BlockNumber new_nfsmblocks; FSMAddress first_removed_address; uint16 first_removed_slot; Buffer buf; @@ -278,15 +279,15 @@ FreeSpaceMapTruncateRel(Relation rel, BlockNumber nblocks) /* * Zero out the tail of the last remaining FSM page. If the slot - * representing the first removed heap block is at a page boundary, as - * the first slot on the FSM page that first_removed_address points to, - * we can just truncate that page altogether. + * representing the first removed heap block is at a page boundary, as the + * first slot on the FSM page that first_removed_address points to, we can + * just truncate that page altogether. */ if (first_removed_slot > 0) { buf = fsm_readbuf(rel, first_removed_address, false); if (!BufferIsValid(buf)) - return; /* nothing to do; the FSM was already smaller */ + return; /* nothing to do; the FSM was already smaller */ LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE); fsm_truncate_avail(BufferGetPage(buf), first_removed_slot); MarkBufferDirty(buf); @@ -298,15 +299,15 @@ FreeSpaceMapTruncateRel(Relation rel, BlockNumber nblocks) { new_nfsmblocks = fsm_logical_to_physical(first_removed_address); if (smgrnblocks(rel->rd_smgr, FSM_FORKNUM) <= new_nfsmblocks) - return; /* nothing to do; the FSM was already smaller */ + return; /* nothing to do; the FSM was already smaller */ } /* Truncate the unused FSM pages */ smgrtruncate(rel->rd_smgr, FSM_FORKNUM, new_nfsmblocks, rel->rd_istemp); /* - * Need to invalidate the relcache entry, because rd_fsm_nblocks - * seen by other backends is no longer valid. + * Need to invalidate the relcache entry, because rd_fsm_nblocks seen by + * other backends is no longer valid. */ if (!InRecovery) CacheInvalidateRelcache(rel); @@ -320,7 +321,7 @@ FreeSpaceMapTruncateRel(Relation rel, BlockNumber nblocks) void FreeSpaceMapVacuum(Relation rel) { - bool dummy; + bool dummy; /* * Traverse the tree in depth-first order. The tree is stored physically @@ -337,7 +338,7 @@ FreeSpaceMapVacuum(Relation rel) static uint8 fsm_space_avail_to_cat(Size avail) { - int cat; + int cat; Assert(avail < BLCKSZ); @@ -377,12 +378,12 @@ fsm_space_cat_to_avail(uint8 cat) static uint8 fsm_space_needed_to_cat(Size needed) { - int cat; + int cat; /* Can't ask for more space than the highest category represents */ if (needed > MaxFSMRequestSize) - elog(ERROR, "invalid FSM request size %lu", - (unsigned long) needed); + elog(ERROR, "invalid FSM request size %lu", + (unsigned long) needed); if (needed == 0) return 1; @@ -402,8 +403,8 @@ static BlockNumber fsm_logical_to_physical(FSMAddress addr) { BlockNumber pages; - int leafno; - int l; + int leafno; + int l; /* * Calculate the logical page number of the first leaf page below the @@ -422,8 +423,8 @@ fsm_logical_to_physical(FSMAddress addr) } /* - * If the page we were asked for wasn't at the bottom level, subtract - * the additional lower level pages we counted above. + * If the page we were asked for wasn't at the bottom level, subtract the + * additional lower level pages we counted above. */ pages -= addr.level; @@ -437,7 +438,7 @@ fsm_logical_to_physical(FSMAddress addr) static FSMAddress fsm_get_location(BlockNumber heapblk, uint16 *slot) { - FSMAddress addr; + FSMAddress addr; addr.level = FSM_BOTTOM_LEVEL; addr.logpageno = heapblk / SlotsPerFSMPage; @@ -463,7 +464,7 @@ fsm_get_heap_blk(FSMAddress addr, uint16 slot) static FSMAddress fsm_get_parent(FSMAddress child, uint16 *slot) { - FSMAddress parent; + FSMAddress parent; Assert(child.level < FSM_ROOT_LEVEL); @@ -481,7 +482,7 @@ fsm_get_parent(FSMAddress child, uint16 *slot) static FSMAddress fsm_get_child(FSMAddress parent, uint16 slot) { - FSMAddress child; + FSMAddress child; Assert(parent.level > FSM_BOTTOM_LEVEL); @@ -501,7 +502,7 @@ static Buffer fsm_readbuf(Relation rel, FSMAddress addr, bool extend) { BlockNumber blkno = fsm_logical_to_physical(addr); - Buffer buf; + Buffer buf; RelationOpenSmgr(rel); @@ -545,20 +546,20 @@ static void fsm_extend(Relation rel, BlockNumber fsm_nblocks) { BlockNumber fsm_nblocks_now; - Page pg; + Page pg; pg = (Page) palloc(BLCKSZ); PageInit(pg, BLCKSZ, 0); /* - * We use the relation extension lock to lock out other backends - * trying to extend the FSM at the same time. It also locks out - * extension of the main fork, unnecessarily, but extending the - * FSM happens seldom enough that it doesn't seem worthwhile to - * have a separate lock tag type for it. + * We use the relation extension lock to lock out other backends trying to + * extend the FSM at the same time. It also locks out extension of the + * main fork, unnecessarily, but extending the FSM happens seldom enough + * that it doesn't seem worthwhile to have a separate lock tag type for + * it. * - * Note that another backend might have extended or created the - * relation before we get the lock. + * Note that another backend might have extended or created the relation + * before we get the lock. */ LockRelationForExtension(rel, ExclusiveLock); @@ -631,14 +632,14 @@ fsm_set_and_search(Relation rel, FSMAddress addr, uint16 slot, static BlockNumber fsm_search(Relation rel, uint8 min_cat) { - int restarts = 0; - FSMAddress addr = FSM_ROOT_ADDRESS; + int restarts = 0; + FSMAddress addr = FSM_ROOT_ADDRESS; for (;;) { - int slot; - Buffer buf; - uint8 max_avail = 0; + int slot; + Buffer buf; + uint8 max_avail = 0; /* Read the FSM page. */ buf = fsm_readbuf(rel, addr, false); @@ -678,8 +679,8 @@ fsm_search(Relation rel, uint8 min_cat) } else { - uint16 parentslot; - FSMAddress parent; + uint16 parentslot; + FSMAddress parent; /* * At lower level, failure can happen if the value in the upper- @@ -697,11 +698,11 @@ fsm_search(Relation rel, uint8 min_cat) fsm_set_and_search(rel, parent, parentslot, max_avail, 0); /* - * If the upper pages are badly out of date, we might need to - * loop quite a few times, updating them as we go. Any - * inconsistencies should eventually be corrected and the loop - * should end. Looping indefinitely is nevertheless scary, so - * provide an emergency valve. + * If the upper pages are badly out of date, we might need to loop + * quite a few times, updating them as we go. Any inconsistencies + * should eventually be corrected and the loop should end. Looping + * indefinitely is nevertheless scary, so provide an emergency + * valve. */ if (restarts++ > 10000) return InvalidBlockNumber; @@ -719,9 +720,9 @@ fsm_search(Relation rel, uint8 min_cat) static uint8 fsm_vacuum_page(Relation rel, FSMAddress addr, bool *eof_p) { - Buffer buf; - Page page; - uint8 max_avail; + Buffer buf; + Page page; + uint8 max_avail; /* Read the page if it exists, or return EOF */ buf = fsm_readbuf(rel, addr, false); @@ -736,17 +737,17 @@ fsm_vacuum_page(Relation rel, FSMAddress addr, bool *eof_p) page = BufferGetPage(buf); /* - * Recurse into children, and fix the information stored about them - * at this level. + * Recurse into children, and fix the information stored about them at + * this level. */ if (addr.level > FSM_BOTTOM_LEVEL) { - int slot; - bool eof = false; + int slot; + bool eof = false; for (slot = 0; slot < SlotsPerFSMPage; slot++) { - int child_avail; + int child_avail; /* After we hit end-of-file, just clear the rest of the slots */ if (!eof) diff --git a/src/backend/storage/freespace/fsmpage.c b/src/backend/storage/freespace/fsmpage.c index 13fe0015a1..e8feaf0aa2 100644 --- a/src/backend/storage/freespace/fsmpage.c +++ b/src/backend/storage/freespace/fsmpage.c @@ -8,15 +8,15 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/freespace/fsmpage.c,v 1.4 2009/01/01 17:23:47 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/storage/freespace/fsmpage.c,v 1.5 2009/06/11 14:49:01 momjian Exp $ * * NOTES: * - * The public functions in this file form an API that hides the internal - * structure of a FSM page. This allows freespace.c to treat each FSM page - * as a black box with SlotsPerPage "slots". fsm_set_avail() and - * fsm_get_avail() let you get/set the value of a slot, and - * fsm_search_avail() lets you search for a slot with value >= X. + * The public functions in this file form an API that hides the internal + * structure of a FSM page. This allows freespace.c to treat each FSM page + * as a black box with SlotsPerPage "slots". fsm_set_avail() and + * fsm_get_avail() let you get/set the value of a slot, and + * fsm_search_avail() lets you search for a slot with value >= X. * *------------------------------------------------------------------------- */ @@ -43,9 +43,9 @@ rightneighbor(int x) x++; /* - * Check if we stepped to the leftmost node at next level, and correct - * if so. The leftmost nodes at each level are numbered x = 2^level - 1, - * so check if (x + 1) is a power of two, using a standard + * Check if we stepped to the leftmost node at next level, and correct if + * so. The leftmost nodes at each level are numbered x = 2^level - 1, so + * check if (x + 1) is a power of two, using a standard * twos-complement-arithmetic trick. */ if (((x + 1) & x) == 0) @@ -62,9 +62,9 @@ rightneighbor(int x) bool fsm_set_avail(Page page, int slot, uint8 value) { - int nodeno = NonLeafNodesPerPage + slot; - FSMPage fsmpage = (FSMPage) PageGetContents(page); - uint8 oldvalue; + int nodeno = NonLeafNodesPerPage + slot; + FSMPage fsmpage = (FSMPage) PageGetContents(page); + uint8 oldvalue; Assert(slot < LeafNodesPerPage); @@ -77,14 +77,14 @@ fsm_set_avail(Page page, int slot, uint8 value) fsmpage->fp_nodes[nodeno] = value; /* - * Propagate up, until we hit the root or a node that doesn't - * need to be updated. + * Propagate up, until we hit the root or a node that doesn't need to be + * updated. */ do { - uint8 newvalue = 0; - int lchild; - int rchild; + uint8 newvalue = 0; + int lchild; + int rchild; nodeno = parentof(nodeno); lchild = leftchild(nodeno); @@ -103,8 +103,8 @@ fsm_set_avail(Page page, int slot, uint8 value) } while (nodeno > 0); /* - * sanity check: if the new value is (still) higher than the value - * at the top, the tree is corrupt. If so, rebuild. + * sanity check: if the new value is (still) higher than the value at the + * top, the tree is corrupt. If so, rebuild. */ if (value > fsmpage->fp_nodes[0]) fsm_rebuild_page(page); @@ -121,7 +121,7 @@ fsm_set_avail(Page page, int slot, uint8 value) uint8 fsm_get_avail(Page page, int slot) { - FSMPage fsmpage = (FSMPage) PageGetContents(page); + FSMPage fsmpage = (FSMPage) PageGetContents(page); Assert(slot < LeafNodesPerPage); @@ -137,7 +137,7 @@ fsm_get_avail(Page page, int slot) uint8 fsm_get_max_avail(Page page) { - FSMPage fsmpage = (FSMPage) PageGetContents(page); + FSMPage fsmpage = (FSMPage) PageGetContents(page); return fsmpage->fp_nodes[0]; } @@ -158,16 +158,17 @@ int fsm_search_avail(Buffer buf, uint8 minvalue, bool advancenext, bool exclusive_lock_held) { - Page page = BufferGetPage(buf); - FSMPage fsmpage = (FSMPage) PageGetContents(page); - int nodeno; - int target; - uint16 slot; + Page page = BufferGetPage(buf); + FSMPage fsmpage = (FSMPage) PageGetContents(page); + int nodeno; + int target; + uint16 slot; + +restart: - restart: /* - * Check the root first, and exit quickly if there's no leaf with - * enough free space + * Check the root first, and exit quickly if there's no leaf with enough + * free space */ if (fsmpage->fp_nodes[0] < minvalue) return -1; @@ -184,13 +185,13 @@ fsm_search_avail(Buffer buf, uint8 minvalue, bool advancenext, /*---------- * Start the search from the target slot. At every step, move one - * node to the right, then climb up to the parent. Stop when we reach + * node to the right, then climb up to the parent. Stop when we reach * a node with enough free space (as we must, since the root has enough * space). * * The idea is to gradually expand our "search triangle", that is, all * nodes covered by the current node, and to be sure we search to the - * right from the start point. At the first step, only the target slot + * right from the start point. At the first step, only the target slot * is examined. When we move up from a left child to its parent, we are * adding the right-hand subtree of that parent to the search triangle. * When we move right then up from a right child, we are dropping the @@ -207,11 +208,11 @@ fsm_search_avail(Buffer buf, uint8 minvalue, bool advancenext, * * For example, consider this tree: * - * 7 - * 7 6 - * 5 7 6 5 - * 4 5 5 7 2 6 5 2 - * T + * 7 + * 7 6 + * 5 7 6 5 + * 4 5 5 7 2 6 5 2 + * T * * Assume that the target node is the node indicated by the letter T, * and we're searching for a node with value of 6 or higher. The search @@ -230,8 +231,8 @@ fsm_search_avail(Buffer buf, uint8 minvalue, bool advancenext, break; /* - * Move to the right, wrapping around on same level if necessary, - * then climb up. + * Move to the right, wrapping around on same level if necessary, then + * climb up. */ nodeno = parentof(rightneighbor(nodeno)); } @@ -243,7 +244,7 @@ fsm_search_avail(Buffer buf, uint8 minvalue, bool advancenext, */ while (nodeno < NonLeafNodesPerPage) { - int childnodeno = leftchild(nodeno); + int childnodeno = leftchild(nodeno); if (childnodeno < NodesPerPage && fsmpage->fp_nodes[childnodeno] >= minvalue) @@ -260,17 +261,16 @@ fsm_search_avail(Buffer buf, uint8 minvalue, bool advancenext, else { /* - * Oops. The parent node promised that either left or right - * child has enough space, but neither actually did. This can - * happen in case of a "torn page", IOW if we crashed earlier - * while writing the page to disk, and only part of the page - * made it to disk. + * Oops. The parent node promised that either left or right child + * has enough space, but neither actually did. This can happen in + * case of a "torn page", IOW if we crashed earlier while writing + * the page to disk, and only part of the page made it to disk. * * Fix the corruption and restart. */ - RelFileNode rnode; + RelFileNode rnode; ForkNumber forknum; - BlockNumber blknum; + BlockNumber blknum; BufferGetTag(buf, &rnode, &forknum, &blknum); elog(DEBUG1, "fixing corrupt FSM block %u, relation %u/%u/%u", @@ -312,9 +312,9 @@ fsm_search_avail(Buffer buf, uint8 minvalue, bool advancenext, bool fsm_truncate_avail(Page page, int nslots) { - FSMPage fsmpage = (FSMPage) PageGetContents(page); - uint8 *ptr; - bool changed = false; + FSMPage fsmpage = (FSMPage) PageGetContents(page); + uint8 *ptr; + bool changed = false; Assert(nslots >= 0 && nslots < LeafNodesPerPage); @@ -341,9 +341,9 @@ fsm_truncate_avail(Page page, int nslots) bool fsm_rebuild_page(Page page) { - FSMPage fsmpage = (FSMPage) PageGetContents(page); - bool changed = false; - int nodeno; + FSMPage fsmpage = (FSMPage) PageGetContents(page); + bool changed = false; + int nodeno; /* * Start from the lowest non-leaf level, at last node, working our way @@ -351,9 +351,9 @@ fsm_rebuild_page(Page page) */ for (nodeno = NonLeafNodesPerPage - 1; nodeno >= 0; nodeno--) { - int lchild = leftchild(nodeno); - int rchild = lchild + 1; - uint8 newvalue = 0; + int lchild = leftchild(nodeno); + int rchild = lchild + 1; + uint8 newvalue = 0; /* The first few nodes we examine might have zero or one child. */ if (lchild < NodesPerPage) diff --git a/src/backend/storage/freespace/indexfsm.c b/src/backend/storage/freespace/indexfsm.c index ef396a00e7..616e6b1ffc 100644 --- a/src/backend/storage/freespace/indexfsm.c +++ b/src/backend/storage/freespace/indexfsm.c @@ -8,15 +8,15 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/freespace/indexfsm.c,v 1.4 2009/01/01 17:23:47 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/storage/freespace/indexfsm.c,v 1.5 2009/06/11 14:49:01 momjian Exp $ * * * NOTES: * - * This is similar to the FSM used for heap, in freespace.c, but instead - * of tracking the amount of free space on pages, we only track whether - * pages are completely free or in-use. We use the same FSM implementation - * as for heaps, using BLCKSZ - 1 to denote used pages, and 0 for unused. + * This is similar to the FSM used for heap, in freespace.c, but instead + * of tracking the amount of free space on pages, we only track whether + * pages are completely free or in-use. We use the same FSM implementation + * as for heaps, using BLCKSZ - 1 to denote used pages, and 0 for unused. * *------------------------------------------------------------------------- */ @@ -38,7 +38,7 @@ BlockNumber GetFreeIndexPage(Relation rel) { - BlockNumber blkno = GetPageWithFreeSpace(rel, BLCKSZ/2); + BlockNumber blkno = GetPageWithFreeSpace(rel, BLCKSZ / 2); if (blkno != InvalidBlockNumber) RecordUsedIndexPage(rel, blkno); diff --git a/src/backend/storage/ipc/ipc.c b/src/backend/storage/ipc/ipc.c index 5fa2d5d37c..2616ffb817 100644 --- a/src/backend/storage/ipc/ipc.c +++ b/src/backend/storage/ipc/ipc.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/ipc/ipc.c,v 1.104 2009/05/15 15:56:39 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/storage/ipc/ipc.c,v 1.105 2009/06/11 14:49:01 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -83,7 +83,7 @@ static int on_proc_exit_index, * -cim 2/6/90 * * Unfortunately, we can't really guarantee that add-on code - * obeys the rule of not calling exit() directly. So, while + * obeys the rule of not calling exit() directly. So, while * this is the preferred way out of the system, we also register * an atexit callback that will make sure cleanup happens. * ---------------------------------------------------------------- @@ -113,10 +113,10 @@ proc_exit(int code) * * Note that we do this here instead of in an on_proc_exit() callback * because we want to ensure that this code executes last - we don't - * want to interfere with any other on_proc_exit() callback. For - * the same reason, we do not include it in proc_exit_prepare ... - * so if you are exiting in the "wrong way" you won't drop your profile - * in a nice place. + * want to interfere with any other on_proc_exit() callback. For the + * same reason, we do not include it in proc_exit_prepare ... so if + * you are exiting in the "wrong way" you won't drop your profile in a + * nice place. */ char gprofDirName[32]; @@ -229,8 +229,7 @@ atexit_callback(void) /* ... too bad we don't know the real exit code ... */ proc_exit_prepare(-1); } - -#else /* assume we have on_exit instead */ +#else /* assume we have on_exit instead */ static void atexit_callback(int exitstatus, void *arg) @@ -238,8 +237,7 @@ atexit_callback(int exitstatus, void *arg) /* Clean up everything that must be cleaned up */ proc_exit_prepare(exitstatus); } - -#endif /* HAVE_ATEXIT */ +#endif /* HAVE_ATEXIT */ /* ---------------------------------------------------------------- * on_proc_exit diff --git a/src/backend/storage/ipc/pmsignal.c b/src/backend/storage/ipc/pmsignal.c index c77831dd25..1b77f463b6 100644 --- a/src/backend/storage/ipc/pmsignal.c +++ b/src/backend/storage/ipc/pmsignal.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/ipc/pmsignal.c,v 1.27 2009/05/05 19:59:00 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/storage/ipc/pmsignal.c,v 1.28 2009/06/11 14:49:01 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -41,7 +41,7 @@ * have three possible states: UNUSED, ASSIGNED, ACTIVE. An UNUSED slot is * available for assignment. An ASSIGNED slot is associated with a postmaster * child process, but either the process has not touched shared memory yet, - * or it has successfully cleaned up after itself. A ACTIVE slot means the + * or it has successfully cleaned up after itself. A ACTIVE slot means the * process is actively using shared memory. The slots are assigned to * child processes at random, and postmaster.c is responsible for tracking * which one goes with which PID. @@ -57,8 +57,8 @@ struct PMSignalData /* per-reason flags */ sig_atomic_t PMSignalFlags[NUM_PMSIGNALS]; /* per-child-process flags */ - int num_child_flags; /* # of entries in PMChildFlags[] */ - int next_child_flag; /* next slot to try to assign */ + int num_child_flags; /* # of entries in PMChildFlags[] */ + int next_child_flag; /* next slot to try to assign */ sig_atomic_t PMChildFlags[1]; /* VARIABLE LENGTH ARRAY */ }; @@ -181,6 +181,7 @@ ReleasePostmasterChildSlot(int slot) Assert(slot > 0 && slot <= PMSignalState->num_child_flags); slot--; + /* * Note: the slot state might already be unused, because the logic in * postmaster.c is such that this might get called twice when a child diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index 30f66c089c..e71b95c826 100644 --- a/src/backend/storage/ipc/procarray.c +++ b/src/backend/storage/ipc/procarray.c @@ -23,7 +23,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.49 2009/04/04 17:40:36 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.50 2009/06/11 14:49:02 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -829,8 +829,8 @@ GetSnapshotData(Snapshot snapshot) snapshot->curcid = GetCurrentCommandId(false); /* - * This is a new snapshot, so set both refcounts are zero, and mark it - * as not copied in persistent memory. + * This is a new snapshot, so set both refcounts are zero, and mark it as + * not copied in persistent memory. */ snapshot->active_count = 0; snapshot->regd_count = 0; @@ -1038,7 +1038,7 @@ IsBackendPid(int pid) * some snapshot we have. Since we examine the procarray with only shared * lock, there are race conditions: a backend could set its xmin just after * we look. Indeed, on multiprocessors with weak memory ordering, the - * other backend could have set its xmin *before* we look. We know however + * other backend could have set its xmin *before* we look. We know however * that such a backend must have held shared ProcArrayLock overlapping our * own hold of ProcArrayLock, else we would see its xmin update. Therefore, * any snapshot the other backend is taking concurrently with our scan cannot @@ -1133,9 +1133,9 @@ CountActiveBackends(void) * * If someone just decremented numProcs, 'proc' could also point to a * PGPROC entry that's no longer in the array. It still points to a - * PGPROC struct, though, because freed PGPPROC entries just go to - * the free list and are recycled. Its contents are nonsense in that - * case, but that's acceptable for this function. + * PGPROC struct, though, because freed PGPPROC entries just go to the + * free list and are recycled. Its contents are nonsense in that case, + * but that's acceptable for this function. */ if (proc != NULL) continue; @@ -1235,7 +1235,8 @@ bool CountOtherDBBackends(Oid databaseId, int *nbackends, int *nprepared) { ProcArrayStruct *arrayP = procArray; -#define MAXAUTOVACPIDS 10 /* max autovacs to SIGTERM per iteration */ + +#define MAXAUTOVACPIDS 10 /* max autovacs to SIGTERM per iteration */ int autovac_pids[MAXAUTOVACPIDS]; int tries; @@ -1280,10 +1281,10 @@ CountOtherDBBackends(Oid databaseId, int *nbackends, int *nprepared) return false; /* no conflicting backends, so done */ /* - * Send SIGTERM to any conflicting autovacuums before sleeping. - * We postpone this step until after the loop because we don't - * want to hold ProcArrayLock while issuing kill(). - * We have no idea what might block kill() inside the kernel... + * Send SIGTERM to any conflicting autovacuums before sleeping. We + * postpone this step until after the loop because we don't want to + * hold ProcArrayLock while issuing kill(). We have no idea what might + * block kill() inside the kernel... */ for (index = 0; index < nautovacs; index++) (void) kill(autovac_pids[index], SIGTERM); /* ignore any error */ diff --git a/src/backend/storage/ipc/sinval.c b/src/backend/storage/ipc/sinval.c index 2cd3530092..3f063989e0 100644 --- a/src/backend/storage/ipc/sinval.c +++ b/src/backend/storage/ipc/sinval.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/ipc/sinval.c,v 1.89 2009/01/01 17:23:47 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/storage/ipc/sinval.c,v 1.90 2009/06/11 14:49:02 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -65,7 +65,7 @@ SendSharedInvalidMessages(const SharedInvalidationMessage *msgs, int n) * NOTE: it is entirely possible for this routine to be invoked recursively * as a consequence of processing inside the invalFunction or resetFunction. * Furthermore, such a recursive call must guarantee that all outstanding - * inval messages have been processed before it exits. This is the reason + * inval messages have been processed before it exits. This is the reason * for the strange-looking choice to use a statically allocated buffer array * and counters; it's so that a recursive call can process messages already * sucked out of sinvaladt.c. @@ -77,9 +77,10 @@ ReceiveSharedInvalidMessages( { #define MAXINVALMSGS 32 static SharedInvalidationMessage messages[MAXINVALMSGS]; + /* - * We use volatile here to prevent bugs if a compiler doesn't realize - * that recursion is a possibility ... + * We use volatile here to prevent bugs if a compiler doesn't realize that + * recursion is a possibility ... */ static volatile int nextmsg = 0; static volatile int nummsgs = 0; @@ -121,18 +122,18 @@ ReceiveSharedInvalidMessages( } /* - * We only need to loop if the last SIGetDataEntries call (which - * might have been within a recursive call) returned a full buffer. + * We only need to loop if the last SIGetDataEntries call (which might + * have been within a recursive call) returned a full buffer. */ } while (nummsgs == MAXINVALMSGS); /* * We are now caught up. If we received a catchup signal, reset that - * flag, and call SICleanupQueue(). This is not so much because we - * need to flush dead messages right now, as that we want to pass on - * the catchup signal to the next slowest backend. "Daisy chaining" the - * catchup signal this way avoids creating spikes in system load for - * what should be just a background maintenance activity. + * flag, and call SICleanupQueue(). This is not so much because we need + * to flush dead messages right now, as that we want to pass on the + * catchup signal to the next slowest backend. "Daisy chaining" the + * catchup signal this way avoids creating spikes in system load for what + * should be just a background maintenance activity. */ if (catchupInterruptOccurred) { diff --git a/src/backend/storage/ipc/sinvaladt.c b/src/backend/storage/ipc/sinvaladt.c index cb911c468d..fcd1e42a7f 100644 --- a/src/backend/storage/ipc/sinvaladt.c +++ b/src/backend/storage/ipc/sinvaladt.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.77 2009/01/01 17:23:47 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.78 2009/06/11 14:49:02 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -57,7 +57,7 @@ * normal behavior is that at most one such interrupt is in flight at a time; * when a backend completes processing a catchup interrupt, it executes * SICleanupQueue, which will signal the next-furthest-behind backend if - * needed. This avoids undue contention from multiple backends all trying + * needed. This avoids undue contention from multiple backends all trying * to catch up at once. However, the furthest-back backend might be stuck * in a state where it can't catch up. Eventually it will get reset, so it * won't cause any more problems for anyone but itself. But we don't want @@ -88,7 +88,7 @@ * the writer wants to change maxMsgNum while readers need to read it. * We deal with that by having a spinlock that readers must take for just * long enough to read maxMsgNum, while writers take it for just long enough - * to write maxMsgNum. (The exact rule is that you need the spinlock to + * to write maxMsgNum. (The exact rule is that you need the spinlock to * read maxMsgNum if you are not holding SInvalWriteLock, and you need the * spinlock to write maxMsgNum unless you are holding both locks.) * @@ -146,8 +146,8 @@ typedef struct ProcState /* * Next LocalTransactionId to use for each idle backend slot. We keep * this here because it is indexed by BackendId and it is convenient to - * copy the value to and from local memory when MyBackendId is set. - * It's meaningless in an active ProcState entry. + * copy the value to and from local memory when MyBackendId is set. It's + * meaningless in an active ProcState entry. */ LocalTransactionId nextLXID; } ProcState; @@ -235,8 +235,8 @@ CreateSharedInvalidationState(void) /* Mark all backends inactive, and initialize nextLXID */ for (i = 0; i < shmInvalBuffer->maxBackends; i++) { - shmInvalBuffer->procState[i].procPid = 0; /* inactive */ - shmInvalBuffer->procState[i].nextMsgNum = 0; /* meaningless */ + shmInvalBuffer->procState[i].procPid = 0; /* inactive */ + shmInvalBuffer->procState[i].nextMsgNum = 0; /* meaningless */ shmInvalBuffer->procState[i].resetState = false; shmInvalBuffer->procState[i].signaled = false; shmInvalBuffer->procState[i].nextLXID = InvalidLocalTransactionId; @@ -255,11 +255,11 @@ SharedInvalBackendInit(void) SISeg *segP = shmInvalBuffer; /* - * This can run in parallel with read operations, and for that matter - * with write operations; but not in parallel with additions and removals - * of backends, nor in parallel with SICleanupQueue. It doesn't seem - * worth having a third lock, so we choose to use SInvalWriteLock to - * serialize additions/removals. + * This can run in parallel with read operations, and for that matter with + * write operations; but not in parallel with additions and removals of + * backends, nor in parallel with SICleanupQueue. It doesn't seem worth + * having a third lock, so we choose to use SInvalWriteLock to serialize + * additions/removals. */ LWLockAcquire(SInvalWriteLock, LW_EXCLUSIVE); @@ -394,7 +394,7 @@ SIInsertDataEntries(const SharedInvalidationMessage *data, int n) SISeg *segP = shmInvalBuffer; /* - * N can be arbitrarily large. We divide the work into groups of no more + * N can be arbitrarily large. We divide the work into groups of no more * than WRITE_QUANTUM messages, to be sure that we don't hold the lock for * an unreasonably long time. (This is not so much because we care about * letting in other writers, as that some just-caught-up backend might be @@ -404,9 +404,9 @@ SIInsertDataEntries(const SharedInvalidationMessage *data, int n) */ while (n > 0) { - int nthistime = Min(n, WRITE_QUANTUM); - int numMsgs; - int max; + int nthistime = Min(n, WRITE_QUANTUM); + int numMsgs; + int max; n -= nthistime; @@ -416,7 +416,7 @@ SIInsertDataEntries(const SharedInvalidationMessage *data, int n) * If the buffer is full, we *must* acquire some space. Clean the * queue and reset anyone who is preventing space from being freed. * Otherwise, clean the queue only when it's exceeded the next - * fullness threshold. We have to loop and recheck the buffer state + * fullness threshold. We have to loop and recheck the buffer state * after any call of SICleanupQueue. */ for (;;) @@ -458,9 +458,9 @@ SIInsertDataEntries(const SharedInvalidationMessage *data, int n) * get next SI message(s) for current backend, if there are any * * Possible return values: - * 0: no SI message available + * 0: no SI message available * n>0: next n SI messages have been extracted into data[] - * -1: SI reset message extracted + * -1: SI reset message extracted * * If the return value is less than the array size "datasize", the caller * can assume that there are no more SI messages after the one(s) returned. @@ -470,11 +470,11 @@ SIInsertDataEntries(const SharedInvalidationMessage *data, int n) * executing on behalf of other backends, since each instance will modify only * fields of its own backend's ProcState, and no instance will look at fields * of other backends' ProcStates. We express this by grabbing SInvalReadLock - * in shared mode. Note that this is not exactly the normal (read-only) + * in shared mode. Note that this is not exactly the normal (read-only) * interpretation of a shared lock! Look closely at the interactions before * allowing SInvalReadLock to be grabbed in shared mode for any other reason! * - * NB: this can also run in parallel with SIInsertDataEntries. It is not + * NB: this can also run in parallel with SIInsertDataEntries. It is not * guaranteed that we will return any messages added after the routine is * entered. * @@ -488,7 +488,7 @@ SIGetDataEntries(SharedInvalidationMessage *data, int datasize) ProcState *stateP; int max; int n; - + LWLockAcquire(SInvalReadLock, LW_SHARED); segP = shmInvalBuffer; @@ -557,7 +557,7 @@ SIGetDataEntries(SharedInvalidationMessage *data, int datasize) * * Caution: because we transiently release write lock when we have to signal * some other backend, it is NOT guaranteed that there are still minFree - * free message slots at exit. Caller must recheck and perhaps retry. + * free message slots at exit. Caller must recheck and perhaps retry. */ void SICleanupQueue(bool callerHasWriteLock, int minFree) @@ -576,9 +576,9 @@ SICleanupQueue(bool callerHasWriteLock, int minFree) LWLockAcquire(SInvalReadLock, LW_EXCLUSIVE); /* - * Recompute minMsgNum = minimum of all backends' nextMsgNum, identify - * the furthest-back backend that needs signaling (if any), and reset - * any backends that are too far back. + * Recompute minMsgNum = minimum of all backends' nextMsgNum, identify the + * furthest-back backend that needs signaling (if any), and reset any + * backends that are too far back. */ min = segP->maxMsgNum; minsig = min - SIG_THRESHOLD; @@ -587,15 +587,15 @@ SICleanupQueue(bool callerHasWriteLock, int minFree) for (i = 0; i < segP->lastBackend; i++) { ProcState *stateP = &segP->procState[i]; - int n = stateP->nextMsgNum; + int n = stateP->nextMsgNum; /* Ignore if inactive or already in reset state */ if (stateP->procPid == 0 || stateP->resetState) continue; /* - * If we must free some space and this backend is preventing it, - * force him into reset state and then ignore until he catches up. + * If we must free some space and this backend is preventing it, force + * him into reset state and then ignore until he catches up. */ if (n < lowbound) { @@ -619,8 +619,8 @@ SICleanupQueue(bool callerHasWriteLock, int minFree) /* * When minMsgNum gets really large, decrement all message counters so as - * to forestall overflow of the counters. This happens seldom enough - * that folding it into the previous loop would be a loser. + * to forestall overflow of the counters. This happens seldom enough that + * folding it into the previous loop would be a loser. */ if (min >= MSGNUMWRAPAROUND) { @@ -649,7 +649,7 @@ SICleanupQueue(bool callerHasWriteLock, int minFree) */ if (needSig) { - pid_t his_pid = needSig->procPid; + pid_t his_pid = needSig->procPid; needSig->signaled = true; LWLockRelease(SInvalReadLock); diff --git a/src/backend/storage/large_object/inv_api.c b/src/backend/storage/large_object/inv_api.c index 56a10d762b..0def1decd0 100644 --- a/src/backend/storage/large_object/inv_api.c +++ b/src/backend/storage/large_object/inv_api.c @@ -24,7 +24,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/large_object/inv_api.c,v 1.137 2009/01/01 17:23:47 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/storage/large_object/inv_api.c,v 1.138 2009/06/11 14:49:02 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -248,12 +248,12 @@ inv_open(Oid lobjId, int flags, MemoryContext mcxt) else if (flags & INV_READ) { /* - * We must register the snapshot in TopTransaction's resowner, - * because it must stay alive until the LO is closed rather than until - * the current portal shuts down. + * We must register the snapshot in TopTransaction's resowner, because + * it must stay alive until the LO is closed rather than until the + * current portal shuts down. */ retval->snapshot = RegisterSnapshotOnOwner(GetActiveSnapshot(), - TopTransactionResourceOwner); + TopTransactionResourceOwner); retval->flags = IFS_RDLOCK; } else @@ -641,7 +641,7 @@ inv_write(LargeObjectDesc *obj_desc, const char *buf, int nbytes) values[Anum_pg_largeobject_data - 1] = PointerGetDatum(&workbuf); replace[Anum_pg_largeobject_data - 1] = true; newtup = heap_modify_tuple(oldtuple, RelationGetDescr(lo_heap_r), - values, nulls, replace); + values, nulls, replace); simple_heap_update(lo_heap_r, &newtup->t_self, newtup); CatalogIndexInsert(indstate, newtup); heap_freetuple(newtup); @@ -810,7 +810,7 @@ inv_truncate(LargeObjectDesc *obj_desc, int len) values[Anum_pg_largeobject_data - 1] = PointerGetDatum(&workbuf); replace[Anum_pg_largeobject_data - 1] = true; newtup = heap_modify_tuple(oldtuple, RelationGetDescr(lo_heap_r), - values, nulls, replace); + values, nulls, replace); simple_heap_update(lo_heap_r, &newtup->t_self, newtup); CatalogIndexInsert(indstate, newtup); heap_freetuple(newtup); diff --git a/src/backend/storage/lmgr/deadlock.c b/src/backend/storage/lmgr/deadlock.c index 25a329f284..590e732f22 100644 --- a/src/backend/storage/lmgr/deadlock.c +++ b/src/backend/storage/lmgr/deadlock.c @@ -12,7 +12,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/lmgr/deadlock.c,v 1.56 2009/01/01 17:23:47 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/storage/lmgr/deadlock.c,v 1.57 2009/06/11 14:49:02 momjian Exp $ * * Interface: * @@ -933,7 +933,7 @@ DeadLockReport(void) appendStringInfo(&logbuf, _("Process %d: %s"), info->pid, - pgstat_get_backend_current_activity(info->pid, false)); + pgstat_get_backend_current_activity(info->pid, false)); } ereport(ERROR, diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c index 97c525d17a..6a29210496 100644 --- a/src/backend/storage/lmgr/lock.c +++ b/src/backend/storage/lmgr/lock.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.187 2009/03/23 01:52:38 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.188 2009/06/11 14:49:02 momjian Exp $ * * NOTES * A lock table is a shared memory hash table. When @@ -1112,7 +1112,7 @@ WaitOnLock(LOCALLOCK *locallock, ResourceOwner owner) { LOCKMETHODID lockmethodid = LOCALLOCK_LOCKMETHOD(*locallock); LockMethod lockMethodTable = LockMethods[lockmethodid]; - char * volatile new_status = NULL; + char *volatile new_status = NULL; LOCK_PRINT("WaitOnLock: sleeping on lock", locallock->lock, locallock->tag.mode); @@ -1145,20 +1145,20 @@ WaitOnLock(LOCALLOCK *locallock, ResourceOwner owner) * the locktable state must fully reflect the fact that we own the lock; * we can't do additional work on return. * - * We can and do use a PG_TRY block to try to clean up after failure, - * but this still has a major limitation: elog(FATAL) can occur while - * waiting (eg, a "die" interrupt), and then control won't come back here. - * So all cleanup of essential state should happen in LockWaitCancel, - * not here. We can use PG_TRY to clear the "waiting" status flags, - * since doing that is unimportant if the process exits. + * We can and do use a PG_TRY block to try to clean up after failure, but + * this still has a major limitation: elog(FATAL) can occur while waiting + * (eg, a "die" interrupt), and then control won't come back here. So all + * cleanup of essential state should happen in LockWaitCancel, not here. + * We can use PG_TRY to clear the "waiting" status flags, since doing that + * is unimportant if the process exits. */ PG_TRY(); { if (ProcSleep(locallock, lockMethodTable) != STATUS_OK) { /* - * We failed as a result of a deadlock, see CheckDeadLock(). - * Quit now. + * We failed as a result of a deadlock, see CheckDeadLock(). Quit + * now. */ awaitedLock = NULL; LOCK_PRINT("WaitOnLock: aborting on lock", diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index 8f5b4e3304..4ae977154a 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.206 2009/05/05 19:59:00 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.207 2009/06/11 14:49:02 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -277,8 +277,8 @@ InitProcess(void) /* * Now that we have a PGPROC, mark ourselves as an active postmaster - * child; this is so that the postmaster can detect it if we exit - * without cleaning up. + * child; this is so that the postmaster can detect it if we exit without + * cleaning up. */ if (IsUnderPostmaster) MarkPostmasterChildActive(); @@ -1184,8 +1184,8 @@ CheckDeadLock(void) * Check to see if we've been awoken by anyone in the interim. * * If we have, we can return and resume our transaction -- happy day. - * Before we are awoken the process releasing the lock grants it to us - * so we know that we don't have to wait anymore. + * Before we are awoken the process releasing the lock grants it to us so + * we know that we don't have to wait anymore. * * We check by looking to see if we've been unlinked from the wait queue. * This is quicker than checking our semaphore's state, since no kernel diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c index 361d020679..8655e90d29 100644 --- a/src/backend/storage/smgr/md.c +++ b/src/backend/storage/smgr/md.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.145 2009/03/11 23:19:25 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.146 2009/06/11 14:49:02 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -120,7 +120,7 @@ static MemoryContext MdCxt; /* context for all md.c allocations */ typedef struct { RelFileNode rnode; /* the targeted relation */ - ForkNumber forknum; + ForkNumber forknum; BlockNumber segno; /* which segment */ } PendingOperationTag; @@ -154,18 +154,18 @@ typedef enum /* behavior for mdopen & _mdfd_getseg */ } ExtensionBehavior; /* local routines */ -static MdfdVec *mdopen(SMgrRelation reln, ForkNumber forknum, - ExtensionBehavior behavior); +static MdfdVec *mdopen(SMgrRelation reln, ForkNumber forknum, + ExtensionBehavior behavior); static void register_dirty_segment(SMgrRelation reln, ForkNumber forknum, - MdfdVec *seg); + MdfdVec *seg); static void register_unlink(RelFileNode rnode); static MdfdVec *_fdvec_alloc(void); static MdfdVec *_mdfd_openseg(SMgrRelation reln, ForkNumber forkno, - BlockNumber segno, int oflags); + BlockNumber segno, int oflags); static MdfdVec *_mdfd_getseg(SMgrRelation reln, ForkNumber forkno, BlockNumber blkno, bool isTemp, ExtensionBehavior behavior); static BlockNumber _mdnblocks(SMgrRelation reln, ForkNumber forknum, - MdfdVec *seg); + MdfdVec *seg); /* @@ -204,7 +204,7 @@ mdinit(void) } /* - * mdexists() -- Does the physical file exist? + * mdexists() -- Does the physical file exist? * * Note: this will return true for lingering files, with pending deletions */ @@ -212,8 +212,8 @@ bool mdexists(SMgrRelation reln, ForkNumber forkNum) { /* - * Close it first, to ensure that we notice if the fork has been - * unlinked since we opened it. + * Close it first, to ensure that we notice if the fork has been unlinked + * since we opened it. */ mdclose(reln, forkNum); @@ -369,8 +369,8 @@ mdunlink(RelFileNode rnode, ForkNumber forkNum, bool isRedo) if (errno != ENOENT) ereport(WARNING, (errcode_for_file_access(), - errmsg("could not remove segment %u of relation %s: %m", - segno, path))); + errmsg("could not remove segment %u of relation %s: %m", + segno, path))); break; } } @@ -420,7 +420,8 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, v = _mdfd_getseg(reln, forknum, blocknum, isTemp, EXTENSION_CREATE); - seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE)); + seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE)); + Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE); /* @@ -535,7 +536,7 @@ mdclose(SMgrRelation reln, ForkNumber forknum) if (v == NULL) return; - reln->md_fd[forknum] = NULL; /* prevent dangling pointer after error */ + reln->md_fd[forknum] = NULL; /* prevent dangling pointer after error */ while (v != NULL) { @@ -562,11 +563,12 @@ mdprefetch(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum) v = _mdfd_getseg(reln, forknum, blocknum, false, EXTENSION_FAIL); - seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE)); + seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE)); + Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE); (void) FilePrefetch(v->mdfd_vfd, seekpos, BLCKSZ); -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ } @@ -588,7 +590,8 @@ mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, v = _mdfd_getseg(reln, forknum, blocknum, false, EXTENSION_FAIL); - seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE)); + seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE)); + Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE); if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos) @@ -611,8 +614,8 @@ mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, if (nbytes < 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not read block %u of relation %s: %m", - blocknum, relpath(reln->smgr_rnode, forknum)))); + errmsg("could not read block %u of relation %s: %m", + blocknum, relpath(reln->smgr_rnode, forknum)))); /* * Short read: we are at or past EOF, or we read a partial block at @@ -660,7 +663,8 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, v = _mdfd_getseg(reln, forknum, blocknum, isTemp, EXTENSION_FAIL); - seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE)); + seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE)); + Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE); if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos) @@ -683,8 +687,8 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, if (nbytes < 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not write block %u of relation %s: %m", - blocknum, relpath(reln->smgr_rnode, forknum)))); + errmsg("could not write block %u of relation %s: %m", + blocknum, relpath(reln->smgr_rnode, forknum)))); /* short write: complain appropriately */ ereport(ERROR, (errcode(ERRCODE_DISK_FULL), @@ -757,9 +761,9 @@ mdnblocks(SMgrRelation reln, ForkNumber forknum) if (v->mdfd_chain == NULL) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not open segment %u of relation %s: %m", - segno, - relpath(reln->smgr_rnode, forknum)))); + errmsg("could not open segment %u of relation %s: %m", + segno, + relpath(reln->smgr_rnode, forknum)))); } v = v->mdfd_chain; @@ -812,13 +816,14 @@ mdtruncate(SMgrRelation reln, ForkNumber forknum, BlockNumber nblocks, if (FileTruncate(v->mdfd_vfd, 0) < 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not truncate relation %s to %u blocks: %m", - relpath(reln->smgr_rnode, forknum), - nblocks))); + errmsg("could not truncate relation %s to %u blocks: %m", + relpath(reln->smgr_rnode, forknum), + nblocks))); if (!isTemp) register_dirty_segment(reln, forknum, v); v = v->mdfd_chain; - Assert(ov != reln->md_fd[forknum]); /* we never drop the 1st segment */ + Assert(ov != reln->md_fd[forknum]); /* we never drop the 1st + * segment */ pfree(ov); } else if (priorblocks + ((BlockNumber) RELSEG_SIZE) > nblocks) @@ -836,9 +841,9 @@ mdtruncate(SMgrRelation reln, ForkNumber forknum, BlockNumber nblocks, if (FileTruncate(v->mdfd_vfd, (off_t) lastsegblocks * BLCKSZ) < 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not truncate relation %s to %u blocks: %m", - relpath(reln->smgr_rnode, forknum), - nblocks))); + errmsg("could not truncate relation %s to %u blocks: %m", + relpath(reln->smgr_rnode, forknum), + nblocks))); if (!isTemp) register_dirty_segment(reln, forknum, v); v = v->mdfd_chain; @@ -1055,8 +1060,8 @@ mdsync(void) failures > 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not fsync segment %u of relation %s: %m", - entry->tag.segno, path))); + errmsg("could not fsync segment %u of relation %s: %m", + entry->tag.segno, path))); else ereport(DEBUG1, (errcode_for_file_access(), @@ -1268,7 +1273,7 @@ RememberFsyncRequest(RelFileNode rnode, ForkNumber forknum, BlockNumber segno) hash_seq_init(&hstat, pendingOpsTable); while ((entry = (PendingOperationEntry *) hash_seq_search(&hstat)) != NULL) { - if (RelFileNodeEquals(entry->tag.rnode, rnode) && + if (RelFileNodeEquals(entry->tag.rnode, rnode) && entry->tag.forknum == forknum) { /* Okay, cancel this entry */ @@ -1281,7 +1286,7 @@ RememberFsyncRequest(RelFileNode rnode, ForkNumber forknum, BlockNumber segno) /* Remove any pending requests for the entire database */ HASH_SEQ_STATUS hstat; PendingOperationEntry *entry; - ListCell *cell, + ListCell *cell, *prev, *next; @@ -1295,7 +1300,7 @@ RememberFsyncRequest(RelFileNode rnode, ForkNumber forknum, BlockNumber segno) entry->canceled = true; } } - + /* Remove unlink requests */ prev = NULL; for (cell = list_head(pendingUnlinks); cell; cell = next) @@ -1303,7 +1308,7 @@ RememberFsyncRequest(RelFileNode rnode, ForkNumber forknum, BlockNumber segno) PendingUnlinkEntry *entry = (PendingUnlinkEntry *) lfirst(cell); next = lnext(cell); - if (entry->rnode.dbNode == rnode.dbNode) + if (entry->rnode.dbNode == rnode.dbNode) { pendingUnlinks = list_delete_cell(pendingUnlinks, cell, prev); pfree(entry); @@ -1569,8 +1574,8 @@ _mdnblocks(SMgrRelation reln, ForkNumber forknum, MdfdVec *seg) if (len < 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not seek to end of segment %u of relation %s: %m", - seg->mdfd_segno, relpath(reln->smgr_rnode, forknum)))); + errmsg("could not seek to end of segment %u of relation %s: %m", + seg->mdfd_segno, relpath(reln->smgr_rnode, forknum)))); /* note that this calculation will ignore any partial block at EOF */ return (BlockNumber) (len / BLCKSZ); } diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c index f2cc449f17..7d1cd5af16 100644 --- a/src/backend/storage/smgr/smgr.c +++ b/src/backend/storage/smgr/smgr.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.116 2009/01/12 05:10:44 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.117 2009/06/11 14:49:02 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -42,21 +42,21 @@ typedef struct f_smgr void (*smgr_shutdown) (void); /* may be NULL */ void (*smgr_close) (SMgrRelation reln, ForkNumber forknum); void (*smgr_create) (SMgrRelation reln, ForkNumber forknum, - bool isRedo); + bool isRedo); bool (*smgr_exists) (SMgrRelation reln, ForkNumber forknum); void (*smgr_unlink) (RelFileNode rnode, ForkNumber forknum, - bool isRedo); + bool isRedo); void (*smgr_extend) (SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, char *buffer, bool isTemp); void (*smgr_prefetch) (SMgrRelation reln, ForkNumber forknum, - BlockNumber blocknum); + BlockNumber blocknum); void (*smgr_read) (SMgrRelation reln, ForkNumber forknum, - BlockNumber blocknum, char *buffer); - void (*smgr_write) (SMgrRelation reln, ForkNumber forknum, - BlockNumber blocknum, char *buffer, bool isTemp); + BlockNumber blocknum, char *buffer); + void (*smgr_write) (SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, char *buffer, bool isTemp); BlockNumber (*smgr_nblocks) (SMgrRelation reln, ForkNumber forknum); void (*smgr_truncate) (SMgrRelation reln, ForkNumber forknum, - BlockNumber nblocks, bool isTemp); + BlockNumber nblocks, bool isTemp); void (*smgr_immedsync) (SMgrRelation reln, ForkNumber forknum); void (*smgr_pre_ckpt) (void); /* may be NULL */ void (*smgr_sync) (void); /* may be NULL */ @@ -82,8 +82,8 @@ static HTAB *SMgrRelationHash = NULL; /* local function prototypes */ static void smgrshutdown(int code, Datum arg); -static void smgr_internal_unlink(RelFileNode rnode, ForkNumber forknum, - int which, bool isTemp, bool isRedo); +static void smgr_internal_unlink(RelFileNode rnode, ForkNumber forknum, + int which, bool isTemp, bool isRedo); /* @@ -156,14 +156,14 @@ smgropen(RelFileNode rnode) /* Initialize it if not present before */ if (!found) { - int forknum; + int forknum; /* hash_search already filled in the lookup key */ reln->smgr_owner = NULL; reln->smgr_which = 0; /* we only have md.c at present */ /* mark it not open */ - for(forknum = 0; forknum <= MAX_FORKNUM; forknum++) + for (forknum = 0; forknum <= MAX_FORKNUM; forknum++) reln->md_fd[forknum] = NULL; } @@ -209,7 +209,7 @@ void smgrclose(SMgrRelation reln) { SMgrRelation *owner; - ForkNumber forknum; + ForkNumber forknum; for (forknum = 0; forknum <= MAX_FORKNUM; forknum++) (*(smgrsw[reln->smgr_which].smgr_close)) (reln, forknum); @@ -286,9 +286,9 @@ void smgrcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo) { /* - * Exit quickly in WAL replay mode if we've already opened the file. - * If it's open, it surely must exist. - */ + * Exit quickly in WAL replay mode if we've already opened the file. If + * it's open, it surely must exist. + */ if (isRedo && reln->md_fd[forknum] != NULL) return; @@ -334,7 +334,7 @@ smgrdounlink(SMgrRelation reln, ForkNumber forknum, bool isTemp, bool isRedo) * Shared subroutine that actually does the unlink ... */ static void -smgr_internal_unlink(RelFileNode rnode, ForkNumber forknum, +smgr_internal_unlink(RelFileNode rnode, ForkNumber forknum, int which, bool isTemp, bool isRedo) { /* @@ -370,7 +370,7 @@ smgr_internal_unlink(RelFileNode rnode, ForkNumber forknum, * causes intervening file space to become filled with zeroes. */ void -smgrextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, +smgrextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, char *buffer, bool isTemp) { (*(smgrsw[reln->smgr_which].smgr_extend)) (reln, forknum, blocknum, @@ -395,7 +395,7 @@ smgrprefetch(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum) * return pages in the format that POSTGRES expects. */ void -smgrread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, +smgrread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, char *buffer) { (*(smgrsw[reln->smgr_which].smgr_read)) (reln, forknum, blocknum, buffer); @@ -417,7 +417,7 @@ smgrread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, * made to fsync the write before checkpointing. */ void -smgrwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, +smgrwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, char *buffer, bool isTemp) { (*(smgrsw[reln->smgr_which].smgr_write)) (reln, forknum, blocknum, @@ -527,4 +527,3 @@ smgrpostckpt(void) (*(smgrsw[i].smgr_post_ckpt)) (); } } - diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index c84fea522a..2ed386a222 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.566 2009/05/15 15:56:39 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.567 2009/06/11 14:49:02 momjian Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -2509,8 +2509,8 @@ quickdie(SIGNAL_ARGS) * system reset cycle if some idiot DBA sends a manual SIGQUIT to a random * backend. This is necessary precisely because we don't clean up our * shared memory state. (The "dead man switch" mechanism in pmsignal.c - * should ensure the postmaster sees this as a crash, too, but no harm - * in being doubly sure.) + * should ensure the postmaster sees this as a crash, too, but no harm in + * being doubly sure.) */ exit(2); } diff --git a/src/backend/tcop/pquery.c b/src/backend/tcop/pquery.c index 2521ee010a..98716830cd 100644 --- a/src/backend/tcop/pquery.c +++ b/src/backend/tcop/pquery.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.130 2009/03/27 18:30:21 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.131 2009/06/11 14:49:02 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -74,7 +74,7 @@ CreateQueryDesc(PlannedStmt *plannedstmt, qd->operation = plannedstmt->commandType; /* operation */ qd->plannedstmt = plannedstmt; /* plan */ qd->utilitystmt = plannedstmt->utilityStmt; /* in case DECLARE CURSOR */ - qd->sourceText = sourceText; /* query text */ + qd->sourceText = sourceText; /* query text */ qd->snapshot = RegisterSnapshot(snapshot); /* snapshot */ /* RI check snapshot */ qd->crosscheck_snapshot = RegisterSnapshot(crosscheck_snapshot); @@ -106,7 +106,7 @@ CreateUtilityQueryDesc(Node *utilitystmt, qd->operation = CMD_UTILITY; /* operation */ qd->plannedstmt = NULL; qd->utilitystmt = utilitystmt; /* utility command */ - qd->sourceText = sourceText; /* query text */ + qd->sourceText = sourceText; /* query text */ qd->snapshot = RegisterSnapshot(snapshot); /* snapshot */ qd->crosscheck_snapshot = InvalidSnapshot; /* RI check snapshot */ qd->dest = dest; /* output dest */ @@ -871,7 +871,7 @@ PortalRun(Portal portal, long count, bool isTopLevel, if (log_executor_stats && portal->strategy != PORTAL_MULTI_QUERY) ShowUsage("EXECUTOR STATISTICS"); - + TRACE_POSTGRESQL_QUERY_EXECUTE_DONE(); return result; @@ -1156,7 +1156,7 @@ static void PortalRunUtility(Portal portal, Node *utilityStmt, bool isTopLevel, DestReceiver *dest, char *completionTag) { - bool active_snapshot_set; + bool active_snapshot_set; elog(DEBUG3, "ProcessUtility"); @@ -1201,7 +1201,7 @@ PortalRunUtility(Portal portal, Node *utilityStmt, bool isTopLevel, /* * Some utility commands may pop the ActiveSnapshot stack from under us, - * so we only pop the stack if we actually see a snapshot set. Note that + * so we only pop the stack if we actually see a snapshot set. Note that * the set of utility commands that do this must be the same set * disallowed to run inside a transaction; otherwise, we could be popping * a snapshot that belongs to some other operation. diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index 63aca25ebd..84b357665d 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.307 2009/05/07 22:58:28 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.308 2009/06/11 14:49:02 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -148,8 +148,8 @@ check_xact_readonly(Node *parsetree) /* * Note: Commands that need to do more complicated checking are handled - * elsewhere, in particular COPY and plannable statements do their - * own checking. + * elsewhere, in particular COPY and plannable statements do their own + * checking. */ switch (nodeTag(parsetree)) @@ -252,7 +252,7 @@ ProcessUtility(Node *parsetree, DestReceiver *dest, char *completionTag) { - Assert(queryString != NULL); /* required as of 8.4 */ + Assert(queryString != NULL); /* required as of 8.4 */ check_xact_readonly(parsetree); @@ -423,8 +423,8 @@ ProcessUtility(Node *parsetree, if (IsA(stmt, CreateStmt)) { - Datum toast_options; - static char *validnsps[] = HEAP_RELOPT_NAMESPACES; + Datum toast_options; + static char *validnsps[] = HEAP_RELOPT_NAMESPACES; /* Create the table itself */ relOid = DefineRelation((CreateStmt *) stmt, @@ -438,7 +438,7 @@ ProcessUtility(Node *parsetree, /* parse and validate reloptions for the toast table */ toast_options = transformRelOptions((Datum) 0, - ((CreateStmt *)stmt)->options, + ((CreateStmt *) stmt)->options, "toast", validnsps, true, false); @@ -1000,6 +1000,7 @@ ProcessUtility(Node *parsetree, break; case T_LockStmt: + /* * Since the lock would just get dropped immediately, LOCK TABLE * outside a transaction block is presumed to be user error. diff --git a/src/backend/tsearch/regis.c b/src/backend/tsearch/regis.c index dbeb039bde..4b71872dcf 100644 --- a/src/backend/tsearch/regis.c +++ b/src/backend/tsearch/regis.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tsearch/regis.c,v 1.6 2009/01/01 17:23:48 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/tsearch/regis.c,v 1.7 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -38,7 +38,7 @@ RS_isRegis(const char *str) if (state == RS_IN_WAIT) { if (t_isalpha(c)) - /* okay */ ; + /* okay */ ; else if (t_iseq(c, '[')) state = RS_IN_ONEOF; else @@ -56,7 +56,7 @@ RS_isRegis(const char *str) else if (state == RS_IN_ONEOF_IN || state == RS_IN_NONEOF) { if (t_isalpha(c)) - /* okay */ ; + /* okay */ ; else if (t_iseq(c, ']')) state = RS_IN_WAIT; else @@ -115,7 +115,7 @@ RS_compile(Regis *r, bool issuffix, const char *str) ptr->type = RSF_ONEOF; state = RS_IN_ONEOF; } - else /* shouldn't get here */ + else /* shouldn't get here */ elog(ERROR, "invalid regis pattern: \"%s\"", str); } else if (state == RS_IN_ONEOF) @@ -131,7 +131,7 @@ RS_compile(Regis *r, bool issuffix, const char *str) ptr->len = pg_mblen(c); state = RS_IN_ONEOF_IN; } - else /* shouldn't get here */ + else /* shouldn't get here */ elog(ERROR, "invalid regis pattern: \"%s\"", str); } else if (state == RS_IN_ONEOF_IN || state == RS_IN_NONEOF) @@ -143,7 +143,7 @@ RS_compile(Regis *r, bool issuffix, const char *str) } else if (t_iseq(c, ']')) state = RS_IN_WAIT; - else /* shouldn't get here */ + else /* shouldn't get here */ elog(ERROR, "invalid regis pattern: \"%s\"", str); } else @@ -151,7 +151,7 @@ RS_compile(Regis *r, bool issuffix, const char *str) c += pg_mblen(c); } - if (state != RS_IN_WAIT) /* shouldn't get here */ + if (state != RS_IN_WAIT) /* shouldn't get here */ elog(ERROR, "invalid regis pattern: \"%s\"", str); ptr = r->node; diff --git a/src/backend/tsearch/spell.c b/src/backend/tsearch/spell.c index 71a77a1dcc..71a3d94001 100644 --- a/src/backend/tsearch/spell.c +++ b/src/backend/tsearch/spell.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tsearch/spell.c,v 1.15 2009/01/29 16:22:10 teodor Exp $ + * $PostgreSQL: pgsql/src/backend/tsearch/spell.c,v 1.16 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -521,7 +521,7 @@ addFlagValue(IspellDict *Conf, char *s, uint32 val) (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("multibyte flag character is not allowed"))); - Conf->flagval[*(unsigned char*) s] = (unsigned char) val; + Conf->flagval[*(unsigned char *) s] = (unsigned char) val; Conf->usecompound = true; } @@ -654,7 +654,7 @@ NIImportOOAffixes(IspellDict *Conf, const char *filename) ptr = repl + (ptr - prepl) + 1; while (*ptr) { - aflg |= Conf->flagval[*(unsigned char*) ptr]; + aflg |= Conf->flagval[*(unsigned char *) ptr]; ptr++; } } @@ -735,7 +735,7 @@ NIImportAffixes(IspellDict *Conf, const char *filename) if (*s && pg_mblen(s) == 1) { - Conf->flagval[*(unsigned char*) s] = FF_COMPOUNDFLAG; + Conf->flagval[*(unsigned char *) s] = FF_COMPOUNDFLAG; Conf->usecompound = true; } oldformat = true; @@ -791,7 +791,7 @@ NIImportAffixes(IspellDict *Conf, const char *filename) (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("multibyte flag character is not allowed"))); - flag = *(unsigned char*) s; + flag = *(unsigned char *) s; goto nextline; } if (STRNCMP(recoded, "COMPOUNDFLAG") == 0 || STRNCMP(recoded, "COMPOUNDMIN") == 0 || @@ -851,7 +851,7 @@ makeCompoundFlags(IspellDict *Conf, int affix) while (str && *str) { - flag |= Conf->flagval[*(unsigned char*) str]; + flag |= Conf->flagval[*(unsigned char *) str]; str++; } @@ -1306,7 +1306,7 @@ addToResult(char **forms, char **cur, char *word) if (forms == cur || strcmp(word, *(cur - 1)) != 0) { *cur = pstrdup(word); - *(cur+1) = NULL; + *(cur + 1) = NULL; return 1; } @@ -1497,7 +1497,7 @@ CopyVar(SplitVar *s, int makedup) static void AddStem(SplitVar *v, char *word) { - if ( v->nstem >= v->lenstem ) + if (v->nstem >= v->lenstem) { v->lenstem *= 2; v->stem = (char **) repalloc(v->stem, sizeof(char *) * v->lenstem); @@ -1546,8 +1546,8 @@ SplitToVariants(IspellDict *Conf, SPNode *snode, SplitVar *orig, char *word, int if (level + lenaff - 1 <= minpos) continue; - if ( lenaff >= MAXNORMLEN ) - continue; /* skip too big value */ + if (lenaff >= MAXNORMLEN) + continue; /* skip too big value */ if (lenaff > 0) memcpy(buf, word + startpos, lenaff); buf[lenaff] = '\0'; @@ -1570,7 +1570,7 @@ SplitToVariants(IspellDict *Conf, SPNode *snode, SplitVar *orig, char *word, int while (*sptr) { - AddStem( new, *sptr ); + AddStem(new, *sptr); sptr++; } pfree(subres); @@ -1621,7 +1621,7 @@ SplitToVariants(IspellDict *Conf, SPNode *snode, SplitVar *orig, char *word, int if (wordlen == level + 1) { /* well, it was last word */ - AddStem( var, pnstrdup(word + startpos, wordlen - startpos) ); + AddStem(var, pnstrdup(word + startpos, wordlen - startpos)); pfree(notprobed); return var; } @@ -1635,7 +1635,7 @@ SplitToVariants(IspellDict *Conf, SPNode *snode, SplitVar *orig, char *word, int ptr->next = SplitToVariants(Conf, node, var, word, wordlen, startpos, level); /* we can find next word */ level++; - AddStem( var, pnstrdup(word + startpos, level - startpos) ); + AddStem(var, pnstrdup(word + startpos, level - startpos)); node = Conf->Dictionary; startpos = level; continue; @@ -1649,18 +1649,19 @@ SplitToVariants(IspellDict *Conf, SPNode *snode, SplitVar *orig, char *word, int level++; } - AddStem( var, pnstrdup(word + startpos, wordlen - startpos) ); + AddStem(var, pnstrdup(word + startpos, wordlen - startpos)); pfree(notprobed); return var; } static void -addNorm( TSLexeme **lres, TSLexeme **lcur, char *word, int flags, uint16 NVariant) +addNorm(TSLexeme **lres, TSLexeme **lcur, char *word, int flags, uint16 NVariant) { - if ( *lres == NULL ) + if (*lres == NULL) *lcur = *lres = (TSLexeme *) palloc(MAX_NORM * sizeof(TSLexeme)); - if ( *lcur - *lres < MAX_NORM-1 ) { + if (*lcur - *lres < MAX_NORM - 1) + { (*lcur)->lexeme = word; (*lcur)->flags = flags; (*lcur)->nvariant = NVariant; @@ -1683,9 +1684,9 @@ NINormalizeWord(IspellDict *Conf, char *word) { char **ptr = res; - while (*ptr && (lcur-lres) < MAX_NORM) + while (*ptr && (lcur - lres) < MAX_NORM) { - addNorm( &lres, &lcur, *ptr, 0, NVariant++); + addNorm(&lres, &lcur, *ptr, 0, NVariant++); ptr++; } pfree(res); @@ -1712,10 +1713,10 @@ NINormalizeWord(IspellDict *Conf, char *word) { for (i = 0; i < var->nstem - 1; i++) { - addNorm( &lres, &lcur, (subptr == subres) ? var->stem[i] : pstrdup(var->stem[i]), 0, NVariant); + addNorm(&lres, &lcur, (subptr == subres) ? var->stem[i] : pstrdup(var->stem[i]), 0, NVariant); } - addNorm( &lres, &lcur, *subptr, 0, NVariant); + addNorm(&lres, &lcur, *subptr, 0, NVariant); subptr++; NVariant++; } diff --git a/src/backend/tsearch/to_tsany.c b/src/backend/tsearch/to_tsany.c index dcf6dfa241..a71120fb5e 100644 --- a/src/backend/tsearch/to_tsany.c +++ b/src/backend/tsearch/to_tsany.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tsearch/to_tsany.c,v 1.13 2009/01/01 17:23:48 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/tsearch/to_tsany.c,v 1.14 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -32,13 +32,13 @@ get_current_ts_config(PG_FUNCTION_ARGS) static int compareWORD(const void *a, const void *b) { - int res; + int res; res = tsCompareString( - ((ParsedWord *) a)->word, ((ParsedWord *) a)->len, - ((ParsedWord *) b)->word, ((ParsedWord *) b)->len, - false ); - + ((ParsedWord *) a)->word, ((ParsedWord *) a)->len, + ((ParsedWord *) b)->word, ((ParsedWord *) b)->len, + false); + if (res == 0) { if (((ParsedWord *) a)->pos.pos == ((ParsedWord *) b)->pos.pos) @@ -162,7 +162,7 @@ make_tsvector(ParsedText *prs) if (lenstr > MAXSTRPOS) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("string is too long for tsvector (%d bytes, max %d bytes)", lenstr, MAXSTRPOS))); + errmsg("string is too long for tsvector (%d bytes, max %d bytes)", lenstr, MAXSTRPOS))); totallen = CALCDATASIZE(prs->curwords, lenstr); in = (TSVector) palloc0(totallen); @@ -301,8 +301,8 @@ pushval_morph(Datum opaque, TSQueryParserState state, char *strval, int lenval, while (count < prs.curwords && pos == prs.words[count].pos.pos && variant == prs.words[count].nvariant) { - pushValue(state, prs.words[count].word, prs.words[count].len, weight, - ( (prs.words[count].flags & TSL_PREFIX) || prefix ) ? true : false ); + pushValue(state, prs.words[count].word, prs.words[count].len, weight, + ((prs.words[count].flags & TSL_PREFIX) || prefix) ? true : false); pfree(prs.words[count].word); if (cnt) pushOperator(state, OP_AND); @@ -351,15 +351,16 @@ to_tsquery_byid(PG_FUNCTION_ARGS) } memcpy((void *) GETQUERY(query), (void *) res, len * sizeof(QueryItem)); - if ( len != query->size ) { - char *oldoperand = GETOPERAND(query); - int4 lenoperand = VARSIZE(query) - (oldoperand - (char*)query); + if (len != query->size) + { + char *oldoperand = GETOPERAND(query); + int4 lenoperand = VARSIZE(query) - (oldoperand - (char *) query); - Assert( len < query->size ); + Assert(len < query->size); query->size = len; - memcpy((void *) GETOPERAND(query), oldoperand, VARSIZE(query) - (oldoperand - (char*)query) ); - SET_VARSIZE(query, COMPUTESIZE( len, lenoperand )); + memcpy((void *) GETOPERAND(query), oldoperand, VARSIZE(query) - (oldoperand - (char *) query)); + SET_VARSIZE(query, COMPUTESIZE(len, lenoperand)); } pfree(res); @@ -401,15 +402,16 @@ plainto_tsquery_byid(PG_FUNCTION_ARGS) } memcpy((void *) GETQUERY(query), (void *) res, len * sizeof(QueryItem)); - if ( len != query->size ) { - char *oldoperand = GETOPERAND(query); - int4 lenoperand = VARSIZE(query) - (oldoperand - (char*)query); + if (len != query->size) + { + char *oldoperand = GETOPERAND(query); + int4 lenoperand = VARSIZE(query) - (oldoperand - (char *) query); - Assert( len < query->size ); + Assert(len < query->size); query->size = len; - memcpy((void *) GETOPERAND(query), oldoperand, lenoperand ); - SET_VARSIZE(query, COMPUTESIZE( len, lenoperand )); + memcpy((void *) GETOPERAND(query), oldoperand, lenoperand); + SET_VARSIZE(query, COMPUTESIZE(len, lenoperand)); } pfree(res); diff --git a/src/backend/tsearch/ts_locale.c b/src/backend/tsearch/ts_locale.c index 75702694dd..cc1500dedf 100644 --- a/src/backend/tsearch/ts_locale.c +++ b/src/backend/tsearch/ts_locale.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tsearch/ts_locale.c,v 1.12 2009/01/01 17:23:48 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/tsearch/ts_locale.c,v 1.13 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -81,7 +81,7 @@ t_isprint(const char *ptr) /* - * Set up to read a file using tsearch_readline(). This facility is + * Set up to read a file using tsearch_readline(). This facility is * better than just reading the file directly because it provides error * context pointing to the specific line where a problem is detected. * @@ -159,10 +159,10 @@ tsearch_readline_callback(void *arg) /* * We can't include the text of the config line for errors that occur - * during t_readline() itself. This is only partly a consequence of - * our arms-length use of that routine: the major cause of such - * errors is encoding violations, and we daren't try to print error - * messages containing badly-encoded data. + * during t_readline() itself. This is only partly a consequence of our + * arms-length use of that routine: the major cause of such errors is + * encoding violations, and we daren't try to print error messages + * containing badly-encoded data. */ if (stp->curline) errcontext("line %d of configuration file \"%s\": \"%s\"", @@ -285,7 +285,7 @@ lowerstr_with_len(const char *str, int len) if (wlen < 0) ereport(ERROR, (errcode(ERRCODE_CHARACTER_NOT_IN_REPERTOIRE), - errmsg("conversion from wchar_t to server encoding failed: %m"))); + errmsg("conversion from wchar_t to server encoding failed: %m"))); Assert(wlen < len); } else diff --git a/src/backend/tsearch/ts_parse.c b/src/backend/tsearch/ts_parse.c index 21b723385d..ccafe5f804 100644 --- a/src/backend/tsearch/ts_parse.c +++ b/src/backend/tsearch/ts_parse.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tsearch/ts_parse.c,v 1.11 2009/01/15 16:33:59 teodor Exp $ + * $PostgreSQL: pgsql/src/backend/tsearch/ts_parse.c,v 1.12 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -464,8 +464,8 @@ hlfinditem(HeadlineParsedText *prs, TSQuery query, char *buf, int buflen) for (i = 0; i < query->size; i++) { if (item->type == QI_VAL && - tsCompareString( GETOPERAND(query) + item->operand.distance, item->operand.length, - buf, buflen, item->operand.prefix ) == 0 ) + tsCompareString(GETOPERAND(query) + item->operand.distance, item->operand.length, + buf, buflen, item->operand.prefix) == 0) { if (word->item) { @@ -584,9 +584,9 @@ generateHeadline(HeadlineParsedText *prs) { text *out; char *ptr; - int len = 128; - int numfragments = 0; - int2 infrag = 0; + int len = 128; + int numfragments = 0; + int2 infrag = 0; HeadlineWordEntry *wrd = prs->words; @@ -611,15 +611,15 @@ generateHeadline(HeadlineParsedText *prs) /* start of a new fragment */ infrag = 1; - numfragments ++; - /* add a fragment delimitor if this is after the first one */ + numfragments++; + /* add a fragment delimitor if this is after the first one */ if (numfragments > 1) { memcpy(ptr, prs->fragdelim, prs->fragdelimlen); ptr += prs->fragdelimlen; - } + } - } + } if (wrd->replace) { *ptr = ' '; @@ -646,7 +646,7 @@ generateHeadline(HeadlineParsedText *prs) if (infrag) infrag = 0; pfree(wrd->word); - } + } wrd++; } diff --git a/src/backend/tsearch/ts_selfuncs.c b/src/backend/tsearch/ts_selfuncs.c index 890019c058..d0ffb0c773 100644 --- a/src/backend/tsearch/ts_selfuncs.c +++ b/src/backend/tsearch/ts_selfuncs.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tsearch/ts_selfuncs.c,v 1.3 2009/06/03 18:42:13 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/tsearch/ts_selfuncs.c,v 1.4 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -33,23 +33,23 @@ /* lookup table type for binary searching through MCELEMs */ typedef struct { - text *element; - float4 frequency; + text *element; + float4 frequency; } TextFreq; /* type of keys for bsearch'ing through an array of TextFreqs */ typedef struct { - char *lexeme; - int length; + char *lexeme; + int length; } LexemeKey; static Selectivity tsquerysel(VariableStatData *vardata, Datum constval); static Selectivity mcelem_tsquery_selec(TSQuery query, - Datum *mcelem, int nmcelem, - float4 *numbers, int nnumbers); + Datum *mcelem, int nmcelem, + float4 *numbers, int nnumbers); static Selectivity tsquery_opr_selec(QueryItem *item, char *operand, - TextFreq *lookup, int length, float4 minfreq); + TextFreq *lookup, int length, float4 minfreq); static int compare_lexeme_textfreq(const void *e1, const void *e2); @@ -63,6 +63,7 @@ Datum tsmatchsel(PG_FUNCTION_ARGS) { PlannerInfo *root = (PlannerInfo *) PG_GETARG_POINTER(0); + #ifdef NOT_USED Oid operator = PG_GETARG_OID(1); #endif @@ -71,7 +72,7 @@ tsmatchsel(PG_FUNCTION_ARGS) VariableStatData vardata; Node *other; bool varonleft; - Selectivity selec; + Selectivity selec; /* * If expression is not variable = something or something = variable, then @@ -145,8 +146,8 @@ tsmatchjoinsel(PG_FUNCTION_ARGS) static Selectivity tsquerysel(VariableStatData *vardata, Datum constval) { - Selectivity selec; - TSQuery query; + Selectivity selec; + TSQuery query; /* The caller made sure the const is a TSQuery, so get it now */ query = DatumGetTSQuery(constval); @@ -157,11 +158,11 @@ tsquerysel(VariableStatData *vardata, Datum constval) if (HeapTupleIsValid(vardata->statsTuple)) { - Form_pg_statistic stats; - Datum *values; - int nvalues; - float4 *numbers; - int nnumbers; + Form_pg_statistic stats; + Datum *values; + int nvalues; + float4 *numbers; + int nnumbers; stats = (Form_pg_statistic) GETSTRUCT(vardata->statsTuple); @@ -202,10 +203,10 @@ static Selectivity mcelem_tsquery_selec(TSQuery query, Datum *mcelem, int nmcelem, float4 *numbers, int nnumbers) { - float4 minfreq; - TextFreq *lookup; - Selectivity selec; - int i; + float4 minfreq; + TextFreq *lookup; + Selectivity selec; + int i; /* * There should be two more Numbers than Values, because the last two @@ -221,8 +222,8 @@ mcelem_tsquery_selec(TSQuery query, Datum *mcelem, int nmcelem, for (i = 0; i < nmcelem; i++) { /* - * The text Datums came from an array, so it cannot be compressed - * or stored out-of-line -- it's safe to use VARSIZE_ANY*. + * The text Datums came from an array, so it cannot be compressed or + * stored out-of-line -- it's safe to use VARSIZE_ANY*. */ Assert(!VARATT_IS_COMPRESSED(mcelem[i]) && !VARATT_IS_EXTERNAL(mcelem[i])); lookup[i].element = (text *) DatumGetPointer(mcelem[i]); @@ -246,15 +247,15 @@ mcelem_tsquery_selec(TSQuery query, Datum *mcelem, int nmcelem, /* * Traverse the tsquery in preorder, calculating selectivity as: * - * selec(left_oper) * selec(right_oper) in AND nodes, + * selec(left_oper) * selec(right_oper) in AND nodes, * - * selec(left_oper) + selec(right_oper) - - * selec(left_oper) * selec(right_oper) in OR nodes, + * selec(left_oper) + selec(right_oper) - + * selec(left_oper) * selec(right_oper) in OR nodes, * - * 1 - select(oper) in NOT nodes + * 1 - select(oper) in NOT nodes * - * freq[val] in VAL nodes, if the value is in MCELEM - * min(freq[MCELEM]) / 2 in VAL nodes, if it is not + * freq[val] in VAL nodes, if the value is in MCELEM + * min(freq[MCELEM]) / 2 in VAL nodes, if it is not * * * The MCELEM array is already sorted (see ts_typanalyze.c), so we can use @@ -265,8 +266,10 @@ tsquery_opr_selec(QueryItem *item, char *operand, TextFreq *lookup, int length, float4 minfreq) { LexemeKey key; - TextFreq *searchres; - Selectivity selec, s1, s2; + TextFreq *searchres; + Selectivity selec, + s1, + s2; /* since this function recurses, it could be driven to stack overflow */ check_stack_depth(); @@ -307,13 +310,13 @@ tsquery_opr_selec(QueryItem *item, char *operand, switch (item->operator.oper) { case OP_NOT: - selec = 1.0 - tsquery_opr_selec(item + 1, operand, - lookup, length, minfreq); + selec = 1.0 - tsquery_opr_selec(item + 1, operand, + lookup, length, minfreq); break; case OP_AND: s1 = tsquery_opr_selec(item + 1, operand, - lookup, length, minfreq); + lookup, length, minfreq); s2 = tsquery_opr_selec(item + item->operator.left, operand, lookup, length, minfreq); selec = s1 * s2; @@ -348,10 +351,10 @@ tsquery_opr_selec(QueryItem *item, char *operand, static int compare_lexeme_textfreq(const void *e1, const void *e2) { - const LexemeKey *key = (const LexemeKey *) e1; - const TextFreq *t = (const TextFreq *) e2; - int len1, - len2; + const LexemeKey *key = (const LexemeKey *) e1; + const TextFreq *t = (const TextFreq *) e2; + int len1, + len2; len1 = key->length; len2 = VARSIZE_ANY_EXHDR(t->element); diff --git a/src/backend/tsearch/ts_typanalyze.c b/src/backend/tsearch/ts_typanalyze.c index 37fe82a8b8..11359c25cc 100644 --- a/src/backend/tsearch/ts_typanalyze.c +++ b/src/backend/tsearch/ts_typanalyze.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tsearch/ts_typanalyze.c,v 1.6 2009/01/01 17:23:48 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/tsearch/ts_typanalyze.c,v 1.7 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -31,21 +31,21 @@ typedef struct /* A hash table entry for the Lossy Counting algorithm */ typedef struct { - LexemeHashKey key; /* This is 'e' from the LC algorithm. */ - int frequency; /* This is 'f'. */ - int delta; /* And this is 'delta'. */ + LexemeHashKey key; /* This is 'e' from the LC algorithm. */ + int frequency; /* This is 'f'. */ + int delta; /* And this is 'delta'. */ } TrackItem; static void compute_tsvector_stats(VacAttrStats *stats, - AnalyzeAttrFetchFunc fetchfunc, - int samplerows, - double totalrows); + AnalyzeAttrFetchFunc fetchfunc, + int samplerows, + double totalrows); static void prune_lexemes_hashtable(HTAB *lexemes_tab, int b_current); static uint32 lexeme_hash(const void *key, Size keysize); -static int lexeme_match(const void *key1, const void *key2, Size keysize); -static int lexeme_compare(const void *key1, const void *key2); -static int trackitem_compare_frequencies_desc(const void *e1, const void *e2); -static int trackitem_compare_lexemes(const void *e1, const void *e2); +static int lexeme_match(const void *key1, const void *key2, Size keysize); +static int lexeme_compare(const void *key1, const void *key2); +static int trackitem_compare_frequencies_desc(const void *e1, const void *e2); +static int trackitem_compare_lexemes(const void *e1, const void *e2); /* @@ -94,7 +94,7 @@ ts_typanalyze(PG_FUNCTION_ARGS) * The Lossy Counting (aka LC) algorithm goes like this: * Let D be a set of triples (e, f, d), where e is an element value, f is * that element's frequency (occurrence count) and d is the maximum error in - * f. We start with D empty and process the elements in batches of size + * f. We start with D empty and process the elements in batches of size * w. (The batch size is also known as "bucket size".) Let the current batch * number be b_current, starting with 1. For each element e we either * increment its f count, if it's already in D, or insert a new triple into D @@ -114,29 +114,32 @@ compute_tsvector_stats(VacAttrStats *stats, int samplerows, double totalrows) { - int num_mcelem; - int null_cnt = 0; - double total_width = 0; + int num_mcelem; + int null_cnt = 0; + double total_width = 0; + /* This is D from the LC algorithm. */ - HTAB *lexemes_tab; - HASHCTL hash_ctl; - HASH_SEQ_STATUS scan_status; + HTAB *lexemes_tab; + HASHCTL hash_ctl; + HASH_SEQ_STATUS scan_status; + /* This is the current bucket number from the LC algorithm */ - int b_current; + int b_current; + /* This is 'w' from the LC algorithm */ - int bucket_width; - int vector_no, - lexeme_no; - LexemeHashKey hash_key; - TrackItem *item; + int bucket_width; + int vector_no, + lexeme_no; + LexemeHashKey hash_key; + TrackItem *item; /* We want statistics_target * 10 lexemes in the MCELEM array */ num_mcelem = stats->attr->attstattarget * 10; /* - * We set bucket width equal to the target number of result lexemes. - * This is probably about right but perhaps might need to be scaled - * up or down a bit? + * We set bucket width equal to the target number of result lexemes. This + * is probably about right but perhaps might need to be scaled up or down + * a bit? */ bucket_width = num_mcelem; @@ -154,7 +157,7 @@ compute_tsvector_stats(VacAttrStats *stats, lexemes_tab = hash_create("Analyzed lexemes table", bucket_width * 4, &hash_ctl, - HASH_ELEM | HASH_FUNCTION | HASH_COMPARE | HASH_CONTEXT); + HASH_ELEM | HASH_FUNCTION | HASH_COMPARE | HASH_CONTEXT); /* Initialize counters. */ b_current = 1; @@ -165,9 +168,9 @@ compute_tsvector_stats(VacAttrStats *stats, { Datum value; bool isnull; - TSVector vector; - WordEntry *curentryptr; - char *lexemesptr; + TSVector vector; + WordEntry *curentryptr; + char *lexemesptr; int j; vacuum_delay_point(); @@ -198,7 +201,7 @@ compute_tsvector_stats(VacAttrStats *stats, /* * We loop through the lexemes in the tsvector and add them to our - * tracking hashtable. Note: the hashtable entries will point into + * tracking hashtable. Note: the hashtable entries will point into * the (detoasted) tsvector value, therefore we cannot free that * storage until we're done. */ @@ -206,7 +209,7 @@ compute_tsvector_stats(VacAttrStats *stats, curentryptr = ARRPTR(vector); for (j = 0; j < vector->size; j++) { - bool found; + bool found; /* Construct a hash key */ hash_key.lexeme = lexemesptr + curentryptr->pos; @@ -247,9 +250,10 @@ compute_tsvector_stats(VacAttrStats *stats, { int nonnull_cnt = samplerows - null_cnt; int i; - TrackItem **sort_table; + TrackItem **sort_table; int track_len; - int minfreq, maxfreq; + int minfreq, + maxfreq; stats->stats_valid = true; /* Do the simple null-frac and average width stats */ @@ -281,7 +285,7 @@ compute_tsvector_stats(VacAttrStats *stats, /* Suppress any single-occurrence items */ while (track_len > 0) { - if (sort_table[track_len-1]->frequency > 1) + if (sort_table[track_len - 1]->frequency > 1) break; track_len--; } @@ -293,9 +297,9 @@ compute_tsvector_stats(VacAttrStats *stats, /* Generate MCELEM slot entry */ if (num_mcelem > 0) { - MemoryContext old_context; - Datum *mcelem_values; - float4 *mcelem_freqs; + MemoryContext old_context; + Datum *mcelem_values; + float4 *mcelem_freqs; /* Grab the minimal and maximal frequencies that will get stored */ minfreq = sort_table[num_mcelem - 1]->frequency; @@ -305,15 +309,15 @@ compute_tsvector_stats(VacAttrStats *stats, * We want to store statistics sorted on the lexeme value using * first length, then byte-for-byte comparison. The reason for * doing length comparison first is that we don't care about the - * ordering so long as it's consistent, and comparing lengths first - * gives us a chance to avoid a strncmp() call. + * ordering so long as it's consistent, and comparing lengths + * first gives us a chance to avoid a strncmp() call. * - * This is different from what we do with scalar statistics -- they - * get sorted on frequencies. The rationale is that we usually - * search through most common elements looking for a specific - * value, so we can grab its frequency. When values are presorted - * we can employ binary search for that. See ts_selfuncs.c for a - * real usage scenario. + * This is different from what we do with scalar statistics -- + * they get sorted on frequencies. The rationale is that we + * usually search through most common elements looking for a + * specific value, so we can grab its frequency. When values are + * presorted we can employ binary search for that. See + * ts_selfuncs.c for a real usage scenario. */ qsort(sort_table, num_mcelem, sizeof(TrackItem *), trackitem_compare_lexemes); @@ -332,11 +336,11 @@ compute_tsvector_stats(VacAttrStats *stats, for (i = 0; i < num_mcelem; i++) { - TrackItem *item = sort_table[i]; + TrackItem *item = sort_table[i]; mcelem_values[i] = PointerGetDatum(cstring_to_text_with_len(item->key.lexeme, - item->key.length)); + item->key.length)); mcelem_freqs[i] = (double) item->frequency / (double) nonnull_cnt; } mcelem_freqs[i++] = (double) minfreq / (double) nonnull_cnt; @@ -352,7 +356,7 @@ compute_tsvector_stats(VacAttrStats *stats, stats->numvalues[0] = num_mcelem; /* We are storing text values */ stats->statypid[0] = TEXTOID; - stats->statyplen[0] = -1; /* typlen, -1 for varlena */ + stats->statyplen[0] = -1; /* typlen, -1 for varlena */ stats->statypbyval[0] = false; stats->statypalign[0] = 'i'; } @@ -362,13 +366,13 @@ compute_tsvector_stats(VacAttrStats *stats, /* We found only nulls; assume the column is entirely null */ stats->stats_valid = true; stats->stanullfrac = 1.0; - stats->stawidth = 0; /* "unknown" */ - stats->stadistinct = 0.0; /* "unknown" */ + stats->stawidth = 0; /* "unknown" */ + stats->stadistinct = 0.0; /* "unknown" */ } /* - * We don't need to bother cleaning up any of our temporary palloc's. - * The hashtable should also go away, as it used a child memory context. + * We don't need to bother cleaning up any of our temporary palloc's. The + * hashtable should also go away, as it used a child memory context. */ } @@ -379,8 +383,8 @@ compute_tsvector_stats(VacAttrStats *stats, static void prune_lexemes_hashtable(HTAB *lexemes_tab, int b_current) { - HASH_SEQ_STATUS scan_status; - TrackItem *item; + HASH_SEQ_STATUS scan_status; + TrackItem *item; hash_seq_init(&scan_status, lexemes_tab); while ((item = (TrackItem *) hash_seq_search(&scan_status)) != NULL) @@ -423,8 +427,8 @@ lexeme_match(const void *key1, const void *key2, Size keysize) static int lexeme_compare(const void *key1, const void *key2) { - const LexemeHashKey *d1 = (const LexemeHashKey *) key1; - const LexemeHashKey *d2 = (const LexemeHashKey *) key2; + const LexemeHashKey *d1 = (const LexemeHashKey *) key1; + const LexemeHashKey *d2 = (const LexemeHashKey *) key2; /* First, compare by length */ if (d1->length > d2->length) @@ -441,8 +445,8 @@ lexeme_compare(const void *key1, const void *key2) static int trackitem_compare_frequencies_desc(const void *e1, const void *e2) { - const TrackItem * const *t1 = (const TrackItem * const *) e1; - const TrackItem * const *t2 = (const TrackItem * const *) e2; + const TrackItem *const * t1 = (const TrackItem *const *) e1; + const TrackItem *const * t2 = (const TrackItem *const *) e2; return (*t2)->frequency - (*t1)->frequency; } @@ -453,8 +457,8 @@ trackitem_compare_frequencies_desc(const void *e1, const void *e2) static int trackitem_compare_lexemes(const void *e1, const void *e2) { - const TrackItem * const *t1 = (const TrackItem * const *) e1; - const TrackItem * const *t2 = (const TrackItem * const *) e2; + const TrackItem *const * t1 = (const TrackItem *const *) e1; + const TrackItem *const * t2 = (const TrackItem *const *) e2; return lexeme_compare(&(*t1)->key, &(*t2)->key); } diff --git a/src/backend/tsearch/wparser.c b/src/backend/tsearch/wparser.c index f21484dfd8..da70d14cea 100644 --- a/src/backend/tsearch/wparser.c +++ b/src/backend/tsearch/wparser.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tsearch/wparser.c,v 1.10 2009/01/01 17:23:48 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/tsearch/wparser.c,v 1.11 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -309,9 +309,9 @@ ts_headline_byid_opt(PG_FUNCTION_ARGS) prsobj = lookup_ts_parser_cache(cfg->prsId); if (!OidIsValid(prsobj->headlineOid)) - ereport(ERROR, + ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("text search parser does not support headline creation"))); + errmsg("text search parser does not support headline creation"))); memset(&prs, 0, sizeof(HeadlineParsedText)); prs.lenwords = 32; diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c index 64d55b6b1c..67c4ea36e3 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.147 2009/02/06 21:15:11 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.148 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -84,7 +84,7 @@ static int oidComparator(const void *arg1, const void *arg2); static AclMode convert_priv_string(text *priv_type_text); static AclMode convert_any_priv_string(text *priv_type_text, - const priv_map *privileges); + const priv_map *privileges); static Oid convert_table_name(text *tablename); static AclMode convert_table_priv_string(text *priv_type_text); @@ -386,7 +386,7 @@ allocacl(int n) Acl * aclcopy(const Acl *orig_acl) { - Acl *result_acl; + Acl *result_acl; result_acl = allocacl(ACL_NUM(orig_acl)); @@ -406,7 +406,7 @@ aclcopy(const Acl *orig_acl) Acl * aclconcat(const Acl *left_acl, const Acl *right_acl) { - Acl *result_acl; + Acl *result_acl; result_acl = allocacl(ACL_NUM(left_acl) + ACL_NUM(right_acl)); @@ -1682,23 +1682,23 @@ static AclMode convert_table_priv_string(text *priv_type_text) { static const priv_map table_priv_map[] = { - { "SELECT", ACL_SELECT }, - { "SELECT WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_SELECT) }, - { "INSERT", ACL_INSERT }, - { "INSERT WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_INSERT) }, - { "UPDATE", ACL_UPDATE }, - { "UPDATE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_UPDATE) }, - { "DELETE", ACL_DELETE }, - { "DELETE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_DELETE) }, - { "TRUNCATE", ACL_TRUNCATE }, - { "TRUNCATE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_TRUNCATE) }, - { "REFERENCES", ACL_REFERENCES }, - { "REFERENCES WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_REFERENCES) }, - { "TRIGGER", ACL_TRIGGER }, - { "TRIGGER WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_TRIGGER) }, - { "RULE", 0 }, /* ignore old RULE privileges */ - { "RULE WITH GRANT OPTION", 0 }, - { NULL, 0 } + {"SELECT", ACL_SELECT}, + {"SELECT WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_SELECT)}, + {"INSERT", ACL_INSERT}, + {"INSERT WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_INSERT)}, + {"UPDATE", ACL_UPDATE}, + {"UPDATE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_UPDATE)}, + {"DELETE", ACL_DELETE}, + {"DELETE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_DELETE)}, + {"TRUNCATE", ACL_TRUNCATE}, + {"TRUNCATE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_TRUNCATE)}, + {"REFERENCES", ACL_REFERENCES}, + {"REFERENCES WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_REFERENCES)}, + {"TRIGGER", ACL_TRIGGER}, + {"TRIGGER WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_TRIGGER)}, + {"RULE", 0}, /* ignore old RULE privileges */ + {"RULE WITH GRANT OPTION", 0}, + {NULL, 0} }; return convert_any_priv_string(priv_type_text, table_priv_map); @@ -1928,7 +1928,7 @@ column_privilege_check(Oid tableoid, AttrNumber attnum, * existence of the pg_class row before risking calling pg_class_aclcheck. * Note: it might seem there's a race condition against concurrent DROP, * but really it's safe because there will be no syscache flush between - * here and there. So if we see the row in the syscache, so will + * here and there. So if we see the row in the syscache, so will * pg_class_aclcheck. */ if (!SearchSysCacheExists(RELOID, @@ -2314,15 +2314,15 @@ static AclMode convert_column_priv_string(text *priv_type_text) { static const priv_map column_priv_map[] = { - { "SELECT", ACL_SELECT }, - { "SELECT WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_SELECT) }, - { "INSERT", ACL_INSERT }, - { "INSERT WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_INSERT) }, - { "UPDATE", ACL_UPDATE }, - { "UPDATE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_UPDATE) }, - { "REFERENCES", ACL_REFERENCES }, - { "REFERENCES WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_REFERENCES) }, - { NULL, 0 } + {"SELECT", ACL_SELECT}, + {"SELECT WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_SELECT)}, + {"INSERT", ACL_INSERT}, + {"INSERT WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_INSERT)}, + {"UPDATE", ACL_UPDATE}, + {"UPDATE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_UPDATE)}, + {"REFERENCES", ACL_REFERENCES}, + {"REFERENCES WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_REFERENCES)}, + {NULL, 0} }; return convert_any_priv_string(priv_type_text, column_priv_map); @@ -2524,15 +2524,15 @@ static AclMode convert_database_priv_string(text *priv_type_text) { static const priv_map database_priv_map[] = { - { "CREATE", ACL_CREATE }, - { "CREATE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_CREATE) }, - { "TEMPORARY", ACL_CREATE_TEMP }, - { "TEMPORARY WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_CREATE_TEMP) }, - { "TEMP", ACL_CREATE_TEMP }, - { "TEMP WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_CREATE_TEMP) }, - { "CONNECT", ACL_CONNECT }, - { "CONNECT WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_CONNECT) }, - { NULL, 0 } + {"CREATE", ACL_CREATE}, + {"CREATE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_CREATE)}, + {"TEMPORARY", ACL_CREATE_TEMP}, + {"TEMPORARY WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_CREATE_TEMP)}, + {"TEMP", ACL_CREATE_TEMP}, + {"TEMP WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_CREATE_TEMP)}, + {"CONNECT", ACL_CONNECT}, + {"CONNECT WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_CONNECT)}, + {NULL, 0} }; return convert_any_priv_string(priv_type_text, database_priv_map); @@ -2713,9 +2713,9 @@ static AclMode convert_foreign_data_wrapper_priv_string(text *priv_type_text) { static const priv_map foreign_data_wrapper_priv_map[] = { - { "USAGE", ACL_USAGE }, - { "USAGE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_USAGE) }, - { NULL, 0 } + {"USAGE", ACL_USAGE}, + {"USAGE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_USAGE)}, + {NULL, 0} }; return convert_any_priv_string(priv_type_text, foreign_data_wrapper_priv_map); @@ -2919,9 +2919,9 @@ static AclMode convert_function_priv_string(text *priv_type_text) { static const priv_map function_priv_map[] = { - { "EXECUTE", ACL_EXECUTE }, - { "EXECUTE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_EXECUTE) }, - { NULL, 0 } + {"EXECUTE", ACL_EXECUTE}, + {"EXECUTE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_EXECUTE)}, + {NULL, 0} }; return convert_any_priv_string(priv_type_text, function_priv_map); @@ -3125,9 +3125,9 @@ static AclMode convert_language_priv_string(text *priv_type_text) { static const priv_map language_priv_map[] = { - { "USAGE", ACL_USAGE }, - { "USAGE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_USAGE) }, - { NULL, 0 } + {"USAGE", ACL_USAGE}, + {"USAGE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_USAGE)}, + {NULL, 0} }; return convert_any_priv_string(priv_type_text, language_priv_map); @@ -3331,11 +3331,11 @@ static AclMode convert_schema_priv_string(text *priv_type_text) { static const priv_map schema_priv_map[] = { - { "CREATE", ACL_CREATE }, - { "CREATE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_CREATE) }, - { "USAGE", ACL_USAGE }, - { "USAGE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_USAGE) }, - { NULL, 0 } + {"CREATE", ACL_CREATE}, + {"CREATE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_CREATE)}, + {"USAGE", ACL_USAGE}, + {"USAGE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_USAGE)}, + {NULL, 0} }; return convert_any_priv_string(priv_type_text, schema_priv_map); @@ -3515,9 +3515,9 @@ static AclMode convert_server_priv_string(text *priv_type_text) { static const priv_map server_priv_map[] = { - { "USAGE", ACL_USAGE }, - { "USAGE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_USAGE) }, - { NULL, 0 } + {"USAGE", ACL_USAGE}, + {"USAGE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_USAGE)}, + {NULL, 0} }; return convert_any_priv_string(priv_type_text, server_priv_map); @@ -3705,9 +3705,9 @@ static AclMode convert_tablespace_priv_string(text *priv_type_text) { static const priv_map tablespace_priv_map[] = { - { "CREATE", ACL_CREATE }, - { "CREATE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_CREATE) }, - { NULL, 0 } + {"CREATE", ACL_CREATE}, + {"CREATE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_CREATE)}, + {NULL, 0} }; return convert_any_priv_string(priv_type_text, tablespace_priv_map); @@ -3881,13 +3881,13 @@ static AclMode convert_role_priv_string(text *priv_type_text) { static const priv_map role_priv_map[] = { - { "USAGE", ACL_USAGE }, - { "MEMBER", ACL_CREATE }, - { "USAGE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_CREATE) }, - { "USAGE WITH ADMIN OPTION", ACL_GRANT_OPTION_FOR(ACL_CREATE) }, - { "MEMBER WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_CREATE) }, - { "MEMBER WITH ADMIN OPTION", ACL_GRANT_OPTION_FOR(ACL_CREATE) }, - { NULL, 0 } + {"USAGE", ACL_USAGE}, + {"MEMBER", ACL_CREATE}, + {"USAGE WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_CREATE)}, + {"USAGE WITH ADMIN OPTION", ACL_GRANT_OPTION_FOR(ACL_CREATE)}, + {"MEMBER WITH GRANT OPTION", ACL_GRANT_OPTION_FOR(ACL_CREATE)}, + {"MEMBER WITH ADMIN OPTION", ACL_GRANT_OPTION_FOR(ACL_CREATE)}, + {NULL, 0} }; return convert_any_priv_string(priv_type_text, role_priv_map); diff --git a/src/backend/utils/adt/array_userfuncs.c b/src/backend/utils/adt/array_userfuncs.c index b43ad38993..c30d6b42b0 100644 --- a/src/backend/utils/adt/array_userfuncs.c +++ b/src/backend/utils/adt/array_userfuncs.c @@ -6,7 +6,7 @@ * Copyright (c) 2003-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/array_userfuncs.c,v 1.29 2009/06/09 18:15:04 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/array_userfuncs.c,v 1.30 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -474,7 +474,7 @@ create_singleton_array(FunctionCallInfo fcinfo, Datum array_agg_transfn(PG_FUNCTION_ARGS) { - Oid arg1_typeid = get_fn_expr_argtype(fcinfo->flinfo, 1); + Oid arg1_typeid = get_fn_expr_argtype(fcinfo->flinfo, 1); MemoryContext aggcontext; ArrayBuildState *state; Datum elem; @@ -504,10 +504,9 @@ array_agg_transfn(PG_FUNCTION_ARGS) aggcontext); /* - * The transition type for array_agg() is declared to be "internal", - * which is a pass-by-value type the same size as a pointer. So we - * can safely pass the ArrayBuildState pointer through nodeAgg.c's - * machinations. + * The transition type for array_agg() is declared to be "internal", which + * is a pass-by-value type the same size as a pointer. So we can safely + * pass the ArrayBuildState pointer through nodeAgg.c's machinations. */ PG_RETURN_POINTER(state); } @@ -521,12 +520,12 @@ array_agg_finalfn(PG_FUNCTION_ARGS) int lbs[1]; /* - * Test for null before Asserting we are in right context. This is - * to avoid possible Assert failure in 8.4beta installations, where - * it is possible for users to create NULL constants of type internal. + * Test for null before Asserting we are in right context. This is to + * avoid possible Assert failure in 8.4beta installations, where it is + * possible for users to create NULL constants of type internal. */ if (PG_ARGISNULL(0)) - PG_RETURN_NULL(); /* returns null iff no input values */ + PG_RETURN_NULL(); /* returns null iff no input values */ /* cannot be called directly because of internal-type argument */ Assert(fcinfo->context && diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c index 4f0da19d23..b3973fbccb 100644 --- a/src/backend/utils/adt/arrayfuncs.c +++ b/src/backend/utils/adt/arrayfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.156 2009/04/15 23:30:33 alvherre Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.157 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -96,10 +96,10 @@ static void array_insert_slice(ArrayType *destArray, ArrayType *origArray, int typlen, bool typbyval, char typalign); static int array_cmp(FunctionCallInfo fcinfo); static ArrayType *create_array_envelope(int ndims, int *dimv, int *lbv, int nbytes, - Oid elmtype, int dataoffset); + Oid elmtype, int dataoffset); static ArrayType *array_fill_internal(ArrayType *dims, ArrayType *lbs, - Datum value, bool isnull, Oid elmtype, - FunctionCallInfo fcinfo); + Datum value, bool isnull, Oid elmtype, + FunctionCallInfo fcinfo); /* @@ -1532,7 +1532,7 @@ array_send(PG_FUNCTION_ARGS) /* * array_ndims : - * returns the number of dimensions of the array pointed to by "v" + * returns the number of dimensions of the array pointed to by "v" */ Datum array_ndims(PG_FUNCTION_ARGS) @@ -4287,9 +4287,9 @@ array_smaller(PG_FUNCTION_ARGS) typedef struct generate_subscripts_fctx { - int4 lower; - int4 upper; - bool reverse; + int4 lower; + int4 upper; + bool reverse; } generate_subscripts_fctx; /* @@ -4306,10 +4306,10 @@ generate_subscripts(PG_FUNCTION_ARGS) /* stuff done only on the first call of the function */ if (SRF_IS_FIRSTCALL()) { - ArrayType *v = PG_GETARG_ARRAYTYPE_P(0); - int reqdim = PG_GETARG_INT32(1); - int *lb, - *dimv; + ArrayType *v = PG_GETARG_ARRAYTYPE_P(0); + int reqdim = PG_GETARG_INT32(1); + int *lb, + *dimv; /* create a function context for cross-call persistence */ funcctx = SRF_FIRSTCALL_INIT(); @@ -4374,20 +4374,20 @@ generate_subscripts_nodir(PG_FUNCTION_ARGS) Datum array_fill_with_lower_bounds(PG_FUNCTION_ARGS) { - ArrayType *dims; - ArrayType *lbs; - ArrayType *result; + ArrayType *dims; + ArrayType *lbs; + ArrayType *result; Oid elmtype; - Datum value; - bool isnull; + Datum value; + bool isnull; if (PG_ARGISNULL(1) || PG_ARGISNULL(2)) ereport(ERROR, - (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), - errmsg("dimension array or low bound array cannot be NULL"))); + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("dimension array or low bound array cannot be NULL"))); dims = PG_GETARG_ARRAYTYPE_P(1); - lbs = PG_GETARG_ARRAYTYPE_P(2); + lbs = PG_GETARG_ARRAYTYPE_P(2); if (!PG_ARGISNULL(0)) { @@ -4415,16 +4415,16 @@ array_fill_with_lower_bounds(PG_FUNCTION_ARGS) Datum array_fill(PG_FUNCTION_ARGS) { - ArrayType *dims; - ArrayType *result; + ArrayType *dims; + ArrayType *result; Oid elmtype; - Datum value; - bool isnull; + Datum value; + bool isnull; if (PG_ARGISNULL(1)) ereport(ERROR, - (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), - errmsg("dimension array or low bound array cannot be NULL"))); + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("dimension array or low bound array cannot be NULL"))); dims = PG_GETARG_ARRAYTYPE_P(1); @@ -4451,7 +4451,7 @@ static ArrayType * create_array_envelope(int ndims, int *dimv, int *lbsv, int nbytes, Oid elmtype, int dataoffset) { - ArrayType *result; + ArrayType *result; result = (ArrayType *) palloc0(nbytes); SET_VARSIZE(result, nbytes); @@ -4469,36 +4469,36 @@ array_fill_internal(ArrayType *dims, ArrayType *lbs, Datum value, bool isnull, Oid elmtype, FunctionCallInfo fcinfo) { - ArrayType *result; - int *dimv; - int *lbsv; - int ndims; - int nitems; - int deflbs[MAXDIM]; - int16 elmlen; - bool elmbyval; - char elmalign; - ArrayMetaState *my_extra; + ArrayType *result; + int *dimv; + int *lbsv; + int ndims; + int nitems; + int deflbs[MAXDIM]; + int16 elmlen; + bool elmbyval; + char elmalign; + ArrayMetaState *my_extra; /* * Params checks */ if (ARR_NDIM(dims) != 1) ereport(ERROR, - (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), - errmsg("wrong number of array subscripts"), - errdetail("Dimension array must be one dimensional."))); + (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), + errmsg("wrong number of array subscripts"), + errdetail("Dimension array must be one dimensional."))); if (ARR_LBOUND(dims)[0] != 1) ereport(ERROR, - (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), - errmsg("wrong range of array subscripts"), - errdetail("Lower bound of dimension array must be one."))); + (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), + errmsg("wrong range of array subscripts"), + errdetail("Lower bound of dimension array must be one."))); if (ARR_HASNULL(dims)) ereport(ERROR, - (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), - errmsg("dimension values cannot be null"))); + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("dimension values cannot be null"))); dimv = (int *) ARR_DATA_PTR(dims); ndims = ARR_DIMS(dims)[0]; @@ -4517,32 +4517,32 @@ array_fill_internal(ArrayType *dims, ArrayType *lbs, { if (ARR_NDIM(lbs) != 1) ereport(ERROR, - (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), - errmsg("wrong number of array subscripts"), - errdetail("Dimension array must be one dimensional."))); + (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), + errmsg("wrong number of array subscripts"), + errdetail("Dimension array must be one dimensional."))); if (ARR_LBOUND(lbs)[0] != 1) ereport(ERROR, - (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), - errmsg("wrong range of array subscripts"), - errdetail("Lower bound of dimension array must be one."))); + (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), + errmsg("wrong range of array subscripts"), + errdetail("Lower bound of dimension array must be one."))); if (ARR_HASNULL(lbs)) ereport(ERROR, - (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), - errmsg("dimension values cannot be null"))); + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("dimension values cannot be null"))); if (ARR_DIMS(lbs)[0] != ndims) ereport(ERROR, - (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), - errmsg("wrong number of array subscripts"), - errdetail("Low bound array has different size than dimensions array."))); + (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), + errmsg("wrong number of array subscripts"), + errdetail("Low bound array has different size than dimensions array."))); lbsv = (int *) ARR_DATA_PTR(lbs); } else { - int i; + int i; for (i = 0; i < MAXDIM; i++) deflbs[i] = 1; @@ -4586,8 +4586,8 @@ array_fill_internal(ArrayType *dims, ArrayType *lbs, /* compute required space */ if (!isnull) { - int i; - char *p; + int i; + char *p; int nbytes; int totbytes; @@ -4624,8 +4624,8 @@ array_fill_internal(ArrayType *dims, ArrayType *lbs, } else { - int nbytes; - int dataoffset; + int nbytes; + int dataoffset; dataoffset = ARR_OVERHEAD_WITHNULLS(ndims, nitems); nbytes = dataoffset; @@ -4648,14 +4648,14 @@ array_unnest(PG_FUNCTION_ARGS) { typedef struct { - ArrayType *arr; - int nextelem; - int numelems; - char *elemdataptr; /* this moves with nextelem */ - bits8 *arraynullsptr; /* this does not */ - int16 elmlen; - bool elmbyval; - char elmalign; + ArrayType *arr; + int nextelem; + int numelems; + char *elemdataptr; /* this moves with nextelem */ + bits8 *arraynullsptr; /* this does not */ + int16 elmlen; + bool elmbyval; + char elmalign; } array_unnest_fctx; FuncCallContext *funcctx; @@ -4677,10 +4677,10 @@ array_unnest(PG_FUNCTION_ARGS) /* * Get the array value and detoast if needed. We can't do this - * earlier because if we have to detoast, we want the detoasted - * copy to be in multi_call_memory_ctx, so it will go away when - * we're done and not before. (If no detoast happens, we assume - * the originally passed array will stick around till then.) + * earlier because if we have to detoast, we want the detoasted copy + * to be in multi_call_memory_ctx, so it will go away when we're done + * and not before. (If no detoast happens, we assume the originally + * passed array will stick around till then.) */ arr = PG_GETARG_ARRAYTYPE_P(0); @@ -4710,8 +4710,8 @@ array_unnest(PG_FUNCTION_ARGS) if (fctx->nextelem < fctx->numelems) { - int offset = fctx->nextelem++; - Datum elem; + int offset = fctx->nextelem++; + Datum elem; /* * Check for NULL array element @@ -4727,7 +4727,7 @@ array_unnest(PG_FUNCTION_ARGS) /* * OK, get the element */ - char *ptr = fctx->elemdataptr; + char *ptr = fctx->elemdataptr; fcinfo->isnull = false; elem = ArrayCast(ptr, fctx->elmbyval, fctx->elmlen); diff --git a/src/backend/utils/adt/bool.c b/src/backend/utils/adt/bool.c index a9f9c5b207..848827a81a 100644 --- a/src/backend/utils/adt/bool.c +++ b/src/backend/utils/adt/bool.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/bool.c,v 1.47 2009/03/09 16:49:12 petere Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/bool.c,v 1.48 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -110,7 +110,7 @@ parse_bool_with_len(const char *value, size_t len, bool *result) } if (result) - *result = false; /* suppress compiler warning */ + *result = false; /* suppress compiler warning */ return false; } diff --git a/src/backend/utils/adt/cash.c b/src/backend/utils/adt/cash.c index 73d55c5b54..784947e440 100644 --- a/src/backend/utils/adt/cash.c +++ b/src/backend/utils/adt/cash.c @@ -13,7 +13,7 @@ * this version handles 64 bit numbers and so can hold values up to * $92,233,720,368,547,758.07. * - * $PostgreSQL: pgsql/src/backend/utils/adt/cash.c,v 1.81 2009/06/10 16:31:32 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/cash.c,v 1.82 2009/06/11 14:49:03 momjian Exp $ */ #include "postgres.h" @@ -320,9 +320,8 @@ cash_out(PG_FUNCTION_ARGS) count -= strlen(csymbol) - 1; /* - * If points == 0 and the number of digits % mon_group == 0, - * the code above adds a trailing ssymbol on the far right, - * so remove it. + * If points == 0 and the number of digits % mon_group == 0, the code + * above adds a trailing ssymbol on the far right, so remove it. */ if (buf[LAST_DIGIT] == ssymbol) buf[LAST_DIGIT] = '\0'; @@ -792,13 +791,13 @@ cash_words(PG_FUNCTION_ARGS) /* Now treat as unsigned, to avoid trouble at INT_MIN */ val = (uint64) value; - m0 = val % INT64CONST(100); /* cents */ - m1 = (val / INT64CONST(100)) % 1000; /* hundreds */ - m2 = (val / INT64CONST(100000)) % 1000; /* thousands */ - m3 = (val / INT64CONST(100000000)) % 1000; /* millions */ + m0 = val % INT64CONST(100); /* cents */ + m1 = (val / INT64CONST(100)) % 1000; /* hundreds */ + m2 = (val / INT64CONST(100000)) % 1000; /* thousands */ + m3 = (val / INT64CONST(100000000)) % 1000; /* millions */ m4 = (val / INT64CONST(100000000000)) % 1000; /* billions */ m5 = (val / INT64CONST(100000000000000)) % 1000; /* trillions */ - m6 = (val / INT64CONST(100000000000000000)) % 1000; /* quadrillions */ + m6 = (val / INT64CONST(100000000000000000)) % 1000; /* quadrillions */ if (m6) { diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c index 5d84d6447d..43148bec90 100644 --- a/src/backend/utils/adt/date.c +++ b/src/backend/utils/adt/date.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.145 2009/05/26 01:29:09 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.146 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -231,7 +231,7 @@ EncodeSpecialDate(DateADT dt, char *str) strcpy(str, EARLY); else if (DATE_IS_NOEND(dt)) strcpy(str, LATE); - else /* shouldn't happen */ + else /* shouldn't happen */ elog(ERROR, "invalid argument for EncodeSpecialDate"); } @@ -2552,7 +2552,7 @@ timetz_zone(PG_FUNCTION_ARGS) pg_tz *tzp; /* - * Look up the requested timezone. First we look in the date token table + * Look up the requested timezone. First we look in the date token table * (to handle cases like "EST"), and if that fails, we look in the * timezone database (to handle cases like "America/New_York"). (This * matches the order in which timestamp input checks the cases; it's diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index e6f4689a59..186522148d 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.207 2009/06/10 05:05:03 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.208 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -40,17 +40,17 @@ static int DecodeTime(char *str, int fmask, int range, int *tmask, struct pg_tm * tm, fsec_t *fsec); static int DecodeTimezone(char *str, int *tzp); static const datetkn *datebsearch(const char *key, const datetkn *base, int nel); -static int DecodeDate(char *str, int fmask, int *tmask, bool *is2digits, - struct pg_tm * tm); -static int ValidateDate(int fmask, bool is2digits, bool bc, - struct pg_tm * tm); +static int DecodeDate(char *str, int fmask, int *tmask, bool *is2digits, + struct pg_tm * tm); +static int ValidateDate(int fmask, bool is2digits, bool bc, + struct pg_tm * tm); static void TrimTrailingZeros(char *str); static void AppendSeconds(char *cp, int sec, fsec_t fsec, - int precision, bool fillzeros); + int precision, bool fillzeros); static void AdjustFractSeconds(double frac, struct pg_tm * tm, fsec_t *fsec, - int scale); + int scale); static void AdjustFractDays(double frac, struct pg_tm * tm, fsec_t *fsec, - int scale); + int scale); const int day_tab[2][13] = @@ -266,7 +266,7 @@ static const datetkn *deltacache[MAXDATEFIELDS] = {NULL}; static int strtoi(const char *nptr, char **endptr, int base) { - long val; + long val; val = strtol(nptr, endptr, base); #ifdef HAVE_LONG_INT_64 @@ -461,8 +461,8 @@ static void AppendTimestampSeconds(char *cp, struct pg_tm * tm, fsec_t fsec) { /* - * In float mode, don't print fractional seconds before 1 AD, - * since it's unlikely there's any precision left ... + * In float mode, don't print fractional seconds before 1 AD, since it's + * unlikely there's any precision left ... */ #ifndef HAVE_INT64_TIMESTAMP if (tm->tm_year <= 0) @@ -478,18 +478,18 @@ AppendTimestampSeconds(char *cp, struct pg_tm * tm, fsec_t fsec) static void AdjustFractSeconds(double frac, struct pg_tm * tm, fsec_t *fsec, int scale) { - int sec; + int sec; if (frac == 0) return; - frac *= scale; - sec = (int) frac; + frac *= scale; + sec = (int) frac; tm->tm_sec += sec; - frac -= sec; + frac -= sec; #ifdef HAVE_INT64_TIMESTAMP - *fsec += rint(frac * 1000000); + *fsec += rint(frac * 1000000); #else - *fsec += frac; + *fsec += frac; #endif } @@ -497,14 +497,14 @@ AdjustFractSeconds(double frac, struct pg_tm * tm, fsec_t *fsec, int scale) static void AdjustFractDays(double frac, struct pg_tm * tm, fsec_t *fsec, int scale) { - int extra_days; + int extra_days; if (frac == 0) return; - frac *= scale; - extra_days = (int) frac; + frac *= scale; + extra_days = (int) frac; tm->tm_mday += extra_days; - frac -= extra_days; + frac -= extra_days; AdjustFractSeconds(frac, tm, fsec, SECS_PER_DAY); } @@ -1358,7 +1358,7 @@ DecodeDateTime(char **field, int *ftype, int nf, if (tmask & fmask) return DTERR_BAD_FORMAT; fmask |= tmask; - } /* end loop over fields */ + } /* end loop over fields */ /* do final checking/adjustment of Y/M/D fields */ dterr = ValidateDate(fmask, is2digits, bc, tm); @@ -2042,7 +2042,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf, if (tmask & fmask) return DTERR_BAD_FORMAT; fmask |= tmask; - } /* end loop over fields */ + } /* end loop over fields */ /* do final checking/adjustment of Y/M/D fields */ dterr = ValidateDate(fmask, is2digits, bc, tm); @@ -2059,7 +2059,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf, if (tm->tm_hour < 0 || tm->tm_min < 0 || tm->tm_min > 59 || tm->tm_sec < 0 || tm->tm_sec > 60 || tm->tm_hour > 24 || - /* test for > 24:00:00 */ + /* test for > 24:00:00 */ (tm->tm_hour == 24 && (tm->tm_min > 0 || tm->tm_sec > 0 || *fsec > 0)) || #ifdef HAVE_INT64_TIMESTAMP @@ -2262,7 +2262,7 @@ ValidateDate(int fmask, bool is2digits, bool bc, struct pg_tm * tm) else if (is2digits) { /* process 1 or 2-digit input as 1970-2069 AD, allow '0' and '00' */ - if (tm->tm_year < 0) /* just paranoia */ + if (tm->tm_year < 0) /* just paranoia */ return DTERR_FIELD_OVERFLOW; if (tm->tm_year < 70) tm->tm_year += 2000; @@ -2599,8 +2599,8 @@ DecodeNumberField(int len, char *str, int fmask, if ((cp = strchr(str, '.')) != NULL) { /* - * Can we use ParseFractionalSecond here? Not clear whether - * trailing junk should be rejected ... + * Can we use ParseFractionalSecond here? Not clear whether trailing + * junk should be rejected ... */ double frac; @@ -2805,16 +2805,16 @@ DecodeSpecial(int field, char *lowtoken, int *val) * * Zero out a pg_tm and associated fsec_t */ -static inline void -ClearPgTm(struct pg_tm *tm, fsec_t *fsec) +static inline void +ClearPgTm(struct pg_tm * tm, fsec_t *fsec) { tm->tm_year = 0; - tm->tm_mon = 0; + tm->tm_mon = 0; tm->tm_mday = 0; tm->tm_hour = 0; - tm->tm_min = 0; - tm->tm_sec = 0; - *fsec = 0; + tm->tm_min = 0; + tm->tm_sec = 0; + *fsec = 0; } @@ -2845,7 +2845,7 @@ DecodeInterval(char **field, int *ftype, int nf, int range, *dtype = DTK_DELTA; type = IGNORE_DTF; - ClearPgTm(tm,fsec); + ClearPgTm(tm, fsec); /* read through list backwards to pick up units before values */ for (i = nf - 1; i >= 0; i--) @@ -2863,16 +2863,16 @@ DecodeInterval(char **field, int *ftype, int nf, int range, case DTK_TZ: /* - * Timezone is a token with a leading sign character and - * at least one digit; there could be ':', '.', '-' - * embedded in it as well. + * Timezone is a token with a leading sign character and at + * least one digit; there could be ':', '.', '-' embedded in + * it as well. */ Assert(*field[i] == '-' || *field[i] == '+'); /* * Try for hh:mm or hh:mm:ss. If not, fall through to - * DTK_NUMBER case, which can handle signed float numbers - * and signed year-month values. + * DTK_NUMBER case, which can handle signed float numbers and + * signed year-month values. */ if (strchr(field[i] + 1, ':') != NULL && DecodeTime(field[i] + 1, fmask, INTERVAL_FULL_RANGE, @@ -2944,7 +2944,7 @@ DecodeInterval(char **field, int *ftype, int nf, int range, if (*cp == '-') { /* SQL "years-months" syntax */ - int val2; + int val2; val2 = strtoi(cp + 1, &cp, 10); if (errno == ERANGE || val2 < 0 || val2 >= MONTHS_PER_YEAR) @@ -3022,7 +3022,7 @@ DecodeInterval(char **field, int *ftype, int nf, int range, tm->tm_hour += val; AdjustFractSeconds(fval, tm, fsec, SECS_PER_HOUR); tmask = DTK_M(HOUR); - type = DTK_DAY; /* set for next field */ + type = DTK_DAY; /* set for next field */ break; case DTK_DAY: @@ -3133,7 +3133,7 @@ DecodeInterval(char **field, int *ftype, int nf, int range, /*---------- * The SQL standard defines the interval literal - * '-1 1:00:00' + * '-1 1:00:00' * to mean "negative 1 days and negative 1 hours", while Postgres * traditionally treats this as meaning "negative 1 days and positive * 1 hours". In SQL_STANDARD intervalstyle, we apply the leading sign @@ -3143,14 +3143,14 @@ DecodeInterval(char **field, int *ftype, int nf, int range, * This protects us against misinterpreting postgres-style dump output, * since the postgres-style output code has always put an explicit sign on * all fields following a negative field. But note that SQL-spec output - * is ambiguous and can be misinterpreted on load! (So it's best practice + * is ambiguous and can be misinterpreted on load! (So it's best practice * to dump in postgres style, not SQL style.) *---------- */ if (IntervalStyle == INTSTYLE_SQL_STANDARD && *field[0] == '-') { /* Check for additional explicit signs */ - bool more_signs = false; + bool more_signs = false; for (i = 1; i < nf; i++) { @@ -3164,8 +3164,8 @@ DecodeInterval(char **field, int *ftype, int nf, int range, if (!more_signs) { /* - * Rather than re-determining which field was field[0], just - * force 'em all negative. + * Rather than re-determining which field was field[0], just force + * 'em all negative. */ if (*fsec > 0) *fsec = -(*fsec); @@ -3245,28 +3245,28 @@ ISO8601IntegerWidth(char *fieldstart) /* DecodeISO8601Interval() - * Decode an ISO 8601 time interval of the "format with designators" - * (section 4.4.3.2) or "alternative format" (section 4.4.3.3) - * Examples: P1D for 1 day - * PT1H for 1 hour - * P2Y6M7DT1H30M for 2 years, 6 months, 7 days 1 hour 30 min - * P0002-06-07T01:30:00 the same value in alternative format + * Decode an ISO 8601 time interval of the "format with designators" + * (section 4.4.3.2) or "alternative format" (section 4.4.3.3) + * Examples: P1D for 1 day + * PT1H for 1 hour + * P2Y6M7DT1H30M for 2 years, 6 months, 7 days 1 hour 30 min + * P0002-06-07T01:30:00 the same value in alternative format * * Returns 0 if successful, DTERR code if bogus input detected. * Note: error code should be DTERR_BAD_FORMAT if input doesn't look like * ISO8601, otherwise this could cause unexpected error messages. * dtype, tm, fsec are output parameters. * - * A couple exceptions from the spec: - * - a week field ('W') may coexist with other units - * - allows decimals in fields other than the least significant unit. + * A couple exceptions from the spec: + * - a week field ('W') may coexist with other units + * - allows decimals in fields other than the least significant unit. */ int DecodeISO8601Interval(char *str, int *dtype, struct pg_tm * tm, fsec_t *fsec) { - bool datepart = true; - bool havefield = false; + bool datepart = true; + bool havefield = false; *dtype = DTK_DELTA; ClearPgTm(tm, fsec); @@ -3277,13 +3277,13 @@ DecodeISO8601Interval(char *str, str++; while (*str) { - char *fieldstart; - int val; - double fval; - char unit; - int dterr; + char *fieldstart; + int val; + double fval; + char unit; + int dterr; - if (*str == 'T') /* T indicates the beginning of the time part */ + if (*str == 'T') /* T indicates the beginning of the time part */ { datepart = false; havefield = false; @@ -3297,14 +3297,14 @@ DecodeISO8601Interval(char *str, return dterr; /* - * Note: we could step off the end of the string here. Code below + * Note: we could step off the end of the string here. Code below * *must* exit the loop if unit == '\0'. */ unit = *str++; if (datepart) { - switch (unit) /* before T: Y M W D */ + switch (unit) /* before T: Y M W D */ { case 'Y': tm->tm_year += val; @@ -3322,12 +3322,12 @@ DecodeISO8601Interval(char *str, tm->tm_mday += val; AdjustFractSeconds(fval, tm, fsec, SECS_PER_DAY); break; - case 'T': /* ISO 8601 4.4.3.3 Alternative Format / Basic */ + case 'T': /* ISO 8601 4.4.3.3 Alternative Format / Basic */ case '\0': if (ISO8601IntegerWidth(fieldstart) == 8 && !havefield) { tm->tm_year += val / 10000; - tm->tm_mon += (val / 100) % 100; + tm->tm_mon += (val / 100) % 100; tm->tm_mday += val % 100; AdjustFractSeconds(fval, tm, fsec, SECS_PER_DAY); if (unit == '\0') @@ -3337,12 +3337,13 @@ DecodeISO8601Interval(char *str, continue; } /* Else fall through to extended alternative format */ - case '-': /* ISO 8601 4.4.3.3 Alternative Format, Extended */ + case '-': /* ISO 8601 4.4.3.3 Alternative Format, + * Extended */ if (havefield) return DTERR_BAD_FORMAT; tm->tm_year += val; - tm->tm_mon += (fval * 12); + tm->tm_mon += (fval * 12); if (unit == '\0') return 0; if (unit == 'T') @@ -3355,7 +3356,7 @@ DecodeISO8601Interval(char *str, dterr = ParseISO8601Number(str, &str, &val, &fval); if (dterr) return dterr; - tm->tm_mon += val; + tm->tm_mon += val; AdjustFractDays(fval, tm, fsec, DAYS_PER_MONTH); if (*str == '\0') return 0; @@ -3368,7 +3369,7 @@ DecodeISO8601Interval(char *str, if (*str != '-') return DTERR_BAD_FORMAT; str++; - + dterr = ParseISO8601Number(str, &str, &val, &fval); if (dterr) return dterr; @@ -3390,7 +3391,7 @@ DecodeISO8601Interval(char *str, } else { - switch (unit) /* after T: H M S */ + switch (unit) /* after T: H M S */ { case 'H': tm->tm_hour += val; @@ -3404,17 +3405,18 @@ DecodeISO8601Interval(char *str, tm->tm_sec += val; AdjustFractSeconds(fval, tm, fsec, 1); break; - case '\0': /* ISO 8601 4.4.3.3 Alternative Format */ - if (ISO8601IntegerWidth(fieldstart) == 6 && !havefield) + case '\0': /* ISO 8601 4.4.3.3 Alternative Format */ + if (ISO8601IntegerWidth(fieldstart) == 6 && !havefield) { tm->tm_hour += val / 10000; - tm->tm_min += (val / 100) % 100; - tm->tm_sec += val % 100; + tm->tm_min += (val / 100) % 100; + tm->tm_sec += val % 100; AdjustFractSeconds(fval, tm, fsec, 1); return 0; } /* Else fall through to extended alternative format */ - case ':': /* ISO 8601 4.4.3.3 Alternative Format, Extended */ + case ':': /* ISO 8601 4.4.3.3 Alternative Format, + * Extended */ if (havefield) return DTERR_BAD_FORMAT; @@ -3422,22 +3424,22 @@ DecodeISO8601Interval(char *str, AdjustFractSeconds(fval, tm, fsec, SECS_PER_HOUR); if (unit == '\0') return 0; - + dterr = ParseISO8601Number(str, &str, &val, &fval); if (dterr) return dterr; - tm->tm_min += val; + tm->tm_min += val; AdjustFractSeconds(fval, tm, fsec, SECS_PER_MINUTE); if (*str == '\0') return 0; if (*str != ':') return DTERR_BAD_FORMAT; str++; - + dterr = ParseISO8601Number(str, &str, &val, &fval); if (dterr) return dterr; - tm->tm_sec += val; + tm->tm_sec += val; AdjustFractSeconds(fval, tm, fsec, 1); if (*str == '\0') return 0; @@ -3843,9 +3845,10 @@ AddPostgresIntPart(char *cp, int value, const char *units, value, units, (value != 1) ? "s" : ""); + /* - * Each nonzero field sets is_before for (only) the next one. This is - * a tad bizarre but it's how it worked before... + * Each nonzero field sets is_before for (only) the next one. This is a + * tad bizarre but it's how it worked before... */ *is_before = (value < 0); *is_zero = FALSE; @@ -3884,7 +3887,7 @@ AddVerboseIntPart(char *cp, int value, const char *units, * Actually, afaik, ISO 8601 does specify formats for "time * intervals...[of the]...format with time-unit designators", which * are pretty ugly. The format looks something like - * P1Y1M1DT1H1M1.12345S + * P1Y1M1DT1H1M1.12345S * but useful for exchanging data with computers instead of humans. * - ron 2003-07-14 * @@ -3897,11 +3900,11 @@ EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str) { char *cp = str; int year = tm->tm_year; - int mon = tm->tm_mon; + int mon = tm->tm_mon; int mday = tm->tm_mday; int hour = tm->tm_hour; - int min = tm->tm_min; - int sec = tm->tm_sec; + int min = tm->tm_min; + int sec = tm->tm_sec; bool is_before = FALSE; bool is_zero = TRUE; @@ -3913,21 +3916,21 @@ EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str) */ switch (style) { - /* SQL Standard interval format */ + /* SQL Standard interval format */ case INTSTYLE_SQL_STANDARD: { - bool has_negative = year < 0 || mon < 0 || - mday < 0 || hour < 0 || - min < 0 || sec < 0 || fsec < 0; - bool has_positive = year > 0 || mon > 0 || - mday > 0 || hour > 0 || - min > 0 || sec > 0 || fsec > 0; - bool has_year_month = year != 0 || mon != 0; - bool has_day_time = mday != 0 || hour != 0 || - min != 0 || sec != 0 || fsec != 0; - bool has_day = mday != 0; - bool sql_standard_value = !(has_negative && has_positive) && - !(has_year_month && has_day_time); + bool has_negative = year < 0 || mon < 0 || + mday < 0 || hour < 0 || + min < 0 || sec < 0 || fsec < 0; + bool has_positive = year > 0 || mon > 0 || + mday > 0 || hour > 0 || + min > 0 || sec > 0 || fsec > 0; + bool has_year_month = year != 0 || mon != 0; + bool has_day_time = mday != 0 || hour != 0 || + min != 0 || sec != 0 || fsec != 0; + bool has_day = mday != 0; + bool sql_standard_value = !(has_negative && has_positive) && + !(has_year_month && has_day_time); /* * SQL Standard wants only 1 "<sign>" preceding the whole @@ -3937,11 +3940,11 @@ EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str) { *cp++ = '-'; year = -year; - mon = -mon; + mon = -mon; mday = -mday; hour = -hour; - min = -min; - sec = -sec; + min = -min; + sec = -sec; fsec = -fsec; } @@ -3952,15 +3955,14 @@ EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str) else if (!sql_standard_value) { /* - * For non sql-standard interval values, - * force outputting the signs to avoid - * ambiguities with intervals with mixed - * sign components. + * For non sql-standard interval values, force outputting + * the signs to avoid ambiguities with intervals with + * mixed sign components. */ - char year_sign = (year < 0 || mon < 0) ? '-' : '+'; - char day_sign = (mday < 0) ? '-' : '+'; - char sec_sign = (hour < 0 || min < 0 || - sec < 0 || fsec < 0) ? '-' : '+'; + char year_sign = (year < 0 || mon < 0) ? '-' : '+'; + char day_sign = (mday < 0) ? '-' : '+'; + char sec_sign = (hour < 0 || min < 0 || + sec < 0 || fsec < 0) ? '-' : '+'; sprintf(cp, "%c%d-%d %c%d %c%d:%02d:", year_sign, abs(year), abs(mon), @@ -3988,23 +3990,23 @@ EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str) } break; - /* ISO 8601 "time-intervals by duration only" */ + /* ISO 8601 "time-intervals by duration only" */ case INTSTYLE_ISO_8601: /* special-case zero to avoid printing nothing */ if (year == 0 && mon == 0 && mday == 0 && - hour == 0 && min == 0 && sec == 0 && fsec == 0) + hour == 0 && min == 0 && sec == 0 && fsec == 0) { sprintf(cp, "PT0S"); break; } *cp++ = 'P'; cp = AddISO8601IntPart(cp, year, 'Y'); - cp = AddISO8601IntPart(cp, mon , 'M'); + cp = AddISO8601IntPart(cp, mon, 'M'); cp = AddISO8601IntPart(cp, mday, 'D'); if (hour != 0 || min != 0 || sec != 0 || fsec != 0) *cp++ = 'T'; cp = AddISO8601IntPart(cp, hour, 'H'); - cp = AddISO8601IntPart(cp, min , 'M'); + cp = AddISO8601IntPart(cp, min, 'M'); if (sec != 0 || fsec != 0) { if (sec < 0 || fsec < 0) @@ -4016,14 +4018,14 @@ EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str) } break; - /* Compatible with postgresql < 8.4 when DateStyle = 'iso' */ + /* Compatible with postgresql < 8.4 when DateStyle = 'iso' */ case INTSTYLE_POSTGRES: cp = AddPostgresIntPart(cp, year, "year", &is_zero, &is_before); cp = AddPostgresIntPart(cp, mon, "mon", &is_zero, &is_before); cp = AddPostgresIntPart(cp, mday, "day", &is_zero, &is_before); if (is_zero || hour != 0 || min != 0 || sec != 0 || fsec != 0) { - bool minus = (hour < 0 || min < 0 || sec < 0 || fsec < 0); + bool minus = (hour < 0 || min < 0 || sec < 0 || fsec < 0); sprintf(cp, "%s%s%02d:%02d:", is_zero ? "" : " ", @@ -4034,7 +4036,7 @@ EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str) } break; - /* Compatible with postgresql < 8.4 when DateStyle != 'iso' */ + /* Compatible with postgresql < 8.4 when DateStyle != 'iso' */ case INTSTYLE_POSTGRES_VERBOSE: default: strcpy(cp, "@"); diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c index a8b3eb2214..9b97751524 100644 --- a/src/backend/utils/adt/dbsize.c +++ b/src/backend/utils/adt/dbsize.c @@ -5,7 +5,7 @@ * Copyright (c) 2002-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.23 2009/01/01 17:23:49 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.24 2009/06/11 14:49:03 momjian Exp $ * */ @@ -294,7 +294,7 @@ pg_relation_size(PG_FUNCTION_ARGS) rel = relation_open(relOid, AccessShareLock); size = calculate_relation_size(&(rel->rd_node), - forkname_to_number(text_to_cstring(forkName))); + forkname_to_number(text_to_cstring(forkName))); relation_close(rel, AccessShareLock); diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c index 8244738515..4547240be1 100644 --- a/src/backend/utils/adt/float.c +++ b/src/backend/utils/adt/float.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.161 2009/03/04 22:08:20 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.162 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -1335,8 +1335,8 @@ dpow(PG_FUNCTION_ARGS) /* * The SQL spec requires that we emit a particular SQLSTATE error code for - * certain error conditions. Specifically, we don't return a divide-by-zero - * error code for 0 ^ -1. + * certain error conditions. Specifically, we don't return a + * divide-by-zero error code for 0 ^ -1. */ if (arg1 == 0 && arg2 < 0) ereport(ERROR, diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index 3498e2c503..064993bd87 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- * formatting.c * - * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.156 2009/03/15 20:31:19 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.157 2009/06/11 14:49:03 momjian Exp $ * * * Portions Copyright (c) 1999-2009, PostgreSQL Global Development Group @@ -148,9 +148,9 @@ typedef struct */ typedef enum { - FROM_CHAR_DATE_NONE = 0, /* Value does not affect date mode. */ - FROM_CHAR_DATE_GREGORIAN, /* Gregorian (day, month, year) style date */ - FROM_CHAR_DATE_ISOWEEK /* ISO 8601 week date */ + FROM_CHAR_DATE_NONE = 0, /* Value does not affect date mode. */ + FROM_CHAR_DATE_GREGORIAN, /* Gregorian (day, month, year) style date */ + FROM_CHAR_DATE_ISOWEEK /* ISO 8601 week date */ } FromCharDateMode; typedef struct FormatNode FormatNode; @@ -286,9 +286,9 @@ static char *numth[] = {"st", "nd", "rd", "th", NULL}; * Flags & Options: * ---------- */ -#define ONE_UPPER 1 /* Name */ -#define ALL_UPPER 2 /* NAME */ -#define ALL_LOWER 3 /* name */ +#define ONE_UPPER 1 /* Name */ +#define ALL_UPPER 2 /* NAME */ +#define ALL_LOWER 3 /* name */ #define FULL_SIZ 0 @@ -421,8 +421,8 @@ typedef struct cc, j, us, - yysz, /* is it YY or YYYY ? */ - clock; /* 12 or 24 hour clock? */ + yysz, /* is it YY or YYYY ? */ + clock; /* 12 or 24 hour clock? */ } TmFromChar; #define ZERO_tmfc(_X) memset(_X, 0, sizeof(TmFromChar)) @@ -709,94 +709,94 @@ typedef enum */ static const KeyWord DCH_keywords[] = { /* name, len, id, is_digit, date_mode */ - {"A.D.", 4, DCH_A_D, FALSE, FROM_CHAR_DATE_NONE}, /* A */ + {"A.D.", 4, DCH_A_D, FALSE, FROM_CHAR_DATE_NONE}, /* A */ {"A.M.", 4, DCH_A_M, FALSE, FROM_CHAR_DATE_NONE}, {"AD", 2, DCH_AD, FALSE, FROM_CHAR_DATE_NONE}, {"AM", 2, DCH_AM, FALSE, FROM_CHAR_DATE_NONE}, - {"B.C.", 4, DCH_B_C, FALSE, FROM_CHAR_DATE_NONE}, /* B */ + {"B.C.", 4, DCH_B_C, FALSE, FROM_CHAR_DATE_NONE}, /* B */ {"BC", 2, DCH_BC, FALSE, FROM_CHAR_DATE_NONE}, - {"CC", 2, DCH_CC, TRUE, FROM_CHAR_DATE_NONE}, /* C */ - {"DAY", 3, DCH_DAY, FALSE, FROM_CHAR_DATE_NONE}, /* D */ + {"CC", 2, DCH_CC, TRUE, FROM_CHAR_DATE_NONE}, /* C */ + {"DAY", 3, DCH_DAY, FALSE, FROM_CHAR_DATE_NONE}, /* D */ {"DDD", 3, DCH_DDD, TRUE, FROM_CHAR_DATE_GREGORIAN}, {"DD", 2, DCH_DD, TRUE, FROM_CHAR_DATE_GREGORIAN}, {"DY", 2, DCH_DY, FALSE, FROM_CHAR_DATE_NONE}, {"Day", 3, DCH_Day, FALSE, FROM_CHAR_DATE_NONE}, {"Dy", 2, DCH_Dy, FALSE, FROM_CHAR_DATE_NONE}, {"D", 1, DCH_D, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"FX", 2, DCH_FX, FALSE, FROM_CHAR_DATE_NONE}, /* F */ - {"HH24", 4, DCH_HH24, TRUE, FROM_CHAR_DATE_NONE}, /* H */ + {"FX", 2, DCH_FX, FALSE, FROM_CHAR_DATE_NONE}, /* F */ + {"HH24", 4, DCH_HH24, TRUE, FROM_CHAR_DATE_NONE}, /* H */ {"HH12", 4, DCH_HH12, TRUE, FROM_CHAR_DATE_NONE}, {"HH", 2, DCH_HH, TRUE, FROM_CHAR_DATE_NONE}, - {"IDDD", 4, DCH_IDDD, TRUE, FROM_CHAR_DATE_ISOWEEK}, /* I */ + {"IDDD", 4, DCH_IDDD, TRUE, FROM_CHAR_DATE_ISOWEEK}, /* I */ {"ID", 2, DCH_ID, TRUE, FROM_CHAR_DATE_ISOWEEK}, {"IW", 2, DCH_IW, TRUE, FROM_CHAR_DATE_ISOWEEK}, {"IYYY", 4, DCH_IYYY, TRUE, FROM_CHAR_DATE_ISOWEEK}, {"IYY", 3, DCH_IYY, TRUE, FROM_CHAR_DATE_ISOWEEK}, {"IY", 2, DCH_IY, TRUE, FROM_CHAR_DATE_ISOWEEK}, {"I", 1, DCH_I, TRUE, FROM_CHAR_DATE_ISOWEEK}, - {"J", 1, DCH_J, TRUE, FROM_CHAR_DATE_NONE}, /* J */ - {"MI", 2, DCH_MI, TRUE, FROM_CHAR_DATE_NONE}, /* M */ + {"J", 1, DCH_J, TRUE, FROM_CHAR_DATE_NONE}, /* J */ + {"MI", 2, DCH_MI, TRUE, FROM_CHAR_DATE_NONE}, /* M */ {"MM", 2, DCH_MM, TRUE, FROM_CHAR_DATE_GREGORIAN}, {"MONTH", 5, DCH_MONTH, FALSE, FROM_CHAR_DATE_GREGORIAN}, {"MON", 3, DCH_MON, FALSE, FROM_CHAR_DATE_GREGORIAN}, {"MS", 2, DCH_MS, TRUE, FROM_CHAR_DATE_NONE}, {"Month", 5, DCH_Month, FALSE, FROM_CHAR_DATE_GREGORIAN}, {"Mon", 3, DCH_Mon, FALSE, FROM_CHAR_DATE_GREGORIAN}, - {"P.M.", 4, DCH_P_M, FALSE, FROM_CHAR_DATE_NONE}, /* P */ + {"P.M.", 4, DCH_P_M, FALSE, FROM_CHAR_DATE_NONE}, /* P */ {"PM", 2, DCH_PM, FALSE, FROM_CHAR_DATE_NONE}, - {"Q", 1, DCH_Q, TRUE, FROM_CHAR_DATE_NONE}, /* Q */ - {"RM", 2, DCH_RM, FALSE, FROM_CHAR_DATE_GREGORIAN}, /* R */ - {"SSSS", 4, DCH_SSSS, TRUE, FROM_CHAR_DATE_NONE}, /* S */ + {"Q", 1, DCH_Q, TRUE, FROM_CHAR_DATE_NONE}, /* Q */ + {"RM", 2, DCH_RM, FALSE, FROM_CHAR_DATE_GREGORIAN}, /* R */ + {"SSSS", 4, DCH_SSSS, TRUE, FROM_CHAR_DATE_NONE}, /* S */ {"SS", 2, DCH_SS, TRUE, FROM_CHAR_DATE_NONE}, - {"TZ", 2, DCH_TZ, FALSE, FROM_CHAR_DATE_NONE}, /* T */ - {"US", 2, DCH_US, TRUE, FROM_CHAR_DATE_NONE}, /* U */ - {"WW", 2, DCH_WW, TRUE, FROM_CHAR_DATE_GREGORIAN}, /* W */ + {"TZ", 2, DCH_TZ, FALSE, FROM_CHAR_DATE_NONE}, /* T */ + {"US", 2, DCH_US, TRUE, FROM_CHAR_DATE_NONE}, /* U */ + {"WW", 2, DCH_WW, TRUE, FROM_CHAR_DATE_GREGORIAN}, /* W */ {"W", 1, DCH_W, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"Y,YYY", 5, DCH_Y_YYY, TRUE, FROM_CHAR_DATE_GREGORIAN},/* Y */ + {"Y,YYY", 5, DCH_Y_YYY, TRUE, FROM_CHAR_DATE_GREGORIAN}, /* Y */ {"YYYY", 4, DCH_YYYY, TRUE, FROM_CHAR_DATE_GREGORIAN}, {"YYY", 3, DCH_YYY, TRUE, FROM_CHAR_DATE_GREGORIAN}, {"YY", 2, DCH_YY, TRUE, FROM_CHAR_DATE_GREGORIAN}, {"Y", 1, DCH_Y, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"a.d.", 4, DCH_a_d, FALSE, FROM_CHAR_DATE_NONE}, /* a */ + {"a.d.", 4, DCH_a_d, FALSE, FROM_CHAR_DATE_NONE}, /* a */ {"a.m.", 4, DCH_a_m, FALSE, FROM_CHAR_DATE_NONE}, {"ad", 2, DCH_ad, FALSE, FROM_CHAR_DATE_NONE}, {"am", 2, DCH_am, FALSE, FROM_CHAR_DATE_NONE}, - {"b.c.", 4, DCH_b_c, FALSE, FROM_CHAR_DATE_NONE}, /* b */ + {"b.c.", 4, DCH_b_c, FALSE, FROM_CHAR_DATE_NONE}, /* b */ {"bc", 2, DCH_bc, FALSE, FROM_CHAR_DATE_NONE}, - {"cc", 2, DCH_CC, TRUE, FROM_CHAR_DATE_NONE}, /* c */ - {"day", 3, DCH_day, FALSE, FROM_CHAR_DATE_NONE}, /* d */ + {"cc", 2, DCH_CC, TRUE, FROM_CHAR_DATE_NONE}, /* c */ + {"day", 3, DCH_day, FALSE, FROM_CHAR_DATE_NONE}, /* d */ {"ddd", 3, DCH_DDD, TRUE, FROM_CHAR_DATE_GREGORIAN}, {"dd", 2, DCH_DD, TRUE, FROM_CHAR_DATE_GREGORIAN}, {"dy", 2, DCH_dy, FALSE, FROM_CHAR_DATE_NONE}, {"d", 1, DCH_D, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"fx", 2, DCH_FX, FALSE, FROM_CHAR_DATE_NONE}, /* f */ - {"hh24", 4, DCH_HH24, TRUE, FROM_CHAR_DATE_NONE}, /* h */ + {"fx", 2, DCH_FX, FALSE, FROM_CHAR_DATE_NONE}, /* f */ + {"hh24", 4, DCH_HH24, TRUE, FROM_CHAR_DATE_NONE}, /* h */ {"hh12", 4, DCH_HH12, TRUE, FROM_CHAR_DATE_NONE}, {"hh", 2, DCH_HH, TRUE, FROM_CHAR_DATE_NONE}, - {"iddd", 4, DCH_IDDD, TRUE, FROM_CHAR_DATE_ISOWEEK}, /* i */ + {"iddd", 4, DCH_IDDD, TRUE, FROM_CHAR_DATE_ISOWEEK}, /* i */ {"id", 2, DCH_ID, TRUE, FROM_CHAR_DATE_ISOWEEK}, {"iw", 2, DCH_IW, TRUE, FROM_CHAR_DATE_ISOWEEK}, {"iyyy", 4, DCH_IYYY, TRUE, FROM_CHAR_DATE_ISOWEEK}, {"iyy", 3, DCH_IYY, TRUE, FROM_CHAR_DATE_ISOWEEK}, {"iy", 2, DCH_IY, TRUE, FROM_CHAR_DATE_ISOWEEK}, {"i", 1, DCH_I, TRUE, FROM_CHAR_DATE_ISOWEEK}, - {"j", 1, DCH_J, TRUE, FROM_CHAR_DATE_NONE}, /* j */ - {"mi", 2, DCH_MI, TRUE, FROM_CHAR_DATE_NONE}, /* m */ + {"j", 1, DCH_J, TRUE, FROM_CHAR_DATE_NONE}, /* j */ + {"mi", 2, DCH_MI, TRUE, FROM_CHAR_DATE_NONE}, /* m */ {"mm", 2, DCH_MM, TRUE, FROM_CHAR_DATE_GREGORIAN}, {"month", 5, DCH_month, FALSE, FROM_CHAR_DATE_GREGORIAN}, {"mon", 3, DCH_mon, FALSE, FROM_CHAR_DATE_GREGORIAN}, {"ms", 2, DCH_MS, TRUE, FROM_CHAR_DATE_NONE}, - {"p.m.", 4, DCH_p_m, FALSE, FROM_CHAR_DATE_NONE}, /* p */ + {"p.m.", 4, DCH_p_m, FALSE, FROM_CHAR_DATE_NONE}, /* p */ {"pm", 2, DCH_pm, FALSE, FROM_CHAR_DATE_NONE}, - {"q", 1, DCH_Q, TRUE, FROM_CHAR_DATE_NONE}, /* q */ - {"rm", 2, DCH_rm, FALSE, FROM_CHAR_DATE_GREGORIAN}, /* r */ - {"ssss", 4, DCH_SSSS, TRUE, FROM_CHAR_DATE_NONE}, /* s */ + {"q", 1, DCH_Q, TRUE, FROM_CHAR_DATE_NONE}, /* q */ + {"rm", 2, DCH_rm, FALSE, FROM_CHAR_DATE_GREGORIAN}, /* r */ + {"ssss", 4, DCH_SSSS, TRUE, FROM_CHAR_DATE_NONE}, /* s */ {"ss", 2, DCH_SS, TRUE, FROM_CHAR_DATE_NONE}, - {"tz", 2, DCH_tz, FALSE, FROM_CHAR_DATE_NONE}, /* t */ - {"us", 2, DCH_US, TRUE, FROM_CHAR_DATE_NONE}, /* u */ - {"ww", 2, DCH_WW, TRUE, FROM_CHAR_DATE_GREGORIAN}, /* w */ + {"tz", 2, DCH_tz, FALSE, FROM_CHAR_DATE_NONE}, /* t */ + {"us", 2, DCH_US, TRUE, FROM_CHAR_DATE_NONE}, /* u */ + {"ww", 2, DCH_WW, TRUE, FROM_CHAR_DATE_GREGORIAN}, /* w */ {"w", 1, DCH_W, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"y,yyy", 5, DCH_Y_YYY, TRUE, FROM_CHAR_DATE_GREGORIAN},/* y */ + {"y,yyy", 5, DCH_Y_YYY, TRUE, FROM_CHAR_DATE_GREGORIAN}, /* y */ {"yyyy", 4, DCH_YYYY, TRUE, FROM_CHAR_DATE_GREGORIAN}, {"yyy", 3, DCH_YYY, TRUE, FROM_CHAR_DATE_GREGORIAN}, {"yy", 2, DCH_YY, TRUE, FROM_CHAR_DATE_GREGORIAN}, @@ -814,42 +814,42 @@ static const KeyWord DCH_keywords[] = { */ static const KeyWord NUM_keywords[] = { /* name, len, id is in Index */ - {",", 1, NUM_COMMA}, /* , */ - {".", 1, NUM_DEC}, /* . */ - {"0", 1, NUM_0}, /* 0 */ - {"9", 1, NUM_9}, /* 9 */ - {"B", 1, NUM_B}, /* B */ - {"C", 1, NUM_C}, /* C */ - {"D", 1, NUM_D}, /* D */ - {"E", 1, NUM_E}, /* E */ - {"FM", 2, NUM_FM}, /* F */ - {"G", 1, NUM_G}, /* G */ - {"L", 1, NUM_L}, /* L */ - {"MI", 2, NUM_MI}, /* M */ - {"PL", 2, NUM_PL}, /* P */ + {",", 1, NUM_COMMA}, /* , */ + {".", 1, NUM_DEC}, /* . */ + {"0", 1, NUM_0}, /* 0 */ + {"9", 1, NUM_9}, /* 9 */ + {"B", 1, NUM_B}, /* B */ + {"C", 1, NUM_C}, /* C */ + {"D", 1, NUM_D}, /* D */ + {"E", 1, NUM_E}, /* E */ + {"FM", 2, NUM_FM}, /* F */ + {"G", 1, NUM_G}, /* G */ + {"L", 1, NUM_L}, /* L */ + {"MI", 2, NUM_MI}, /* M */ + {"PL", 2, NUM_PL}, /* P */ {"PR", 2, NUM_PR}, - {"RN", 2, NUM_RN}, /* R */ - {"SG", 2, NUM_SG}, /* S */ + {"RN", 2, NUM_RN}, /* R */ + {"SG", 2, NUM_SG}, /* S */ {"SP", 2, NUM_SP}, {"S", 1, NUM_S}, - {"TH", 2, NUM_TH}, /* T */ - {"V", 1, NUM_V}, /* V */ - {"b", 1, NUM_B}, /* b */ - {"c", 1, NUM_C}, /* c */ - {"d", 1, NUM_D}, /* d */ - {"e", 1, NUM_E}, /* e */ - {"fm", 2, NUM_FM}, /* f */ - {"g", 1, NUM_G}, /* g */ - {"l", 1, NUM_L}, /* l */ - {"mi", 2, NUM_MI}, /* m */ - {"pl", 2, NUM_PL}, /* p */ + {"TH", 2, NUM_TH}, /* T */ + {"V", 1, NUM_V}, /* V */ + {"b", 1, NUM_B}, /* b */ + {"c", 1, NUM_C}, /* c */ + {"d", 1, NUM_D}, /* d */ + {"e", 1, NUM_E}, /* e */ + {"fm", 2, NUM_FM}, /* f */ + {"g", 1, NUM_G}, /* g */ + {"l", 1, NUM_L}, /* l */ + {"mi", 2, NUM_MI}, /* m */ + {"pl", 2, NUM_PL}, /* p */ {"pr", 2, NUM_PR}, - {"rn", 2, NUM_rn}, /* r */ - {"sg", 2, NUM_SG}, /* s */ + {"rn", 2, NUM_rn}, /* r */ + {"sg", 2, NUM_SG}, /* s */ {"sp", 2, NUM_SP}, {"s", 1, NUM_S}, - {"th", 2, NUM_th}, /* t */ - {"v", 1, NUM_V}, /* v */ + {"th", 2, NUM_th}, /* t */ + {"v", 1, NUM_V}, /* v */ /* last */ {NULL, 0, 0} @@ -950,7 +950,7 @@ static void parse_format(FormatNode *node, char *str, const KeyWord *kw, KeySuffix *suf, const int *index, int ver, NUMDesc *Num); static void DCH_to_char(FormatNode *node, bool is_interval, - TmToChar *in, char *out); + TmToChar *in, char *out); static void DCH_from_char(FormatNode *node, char *in, TmFromChar *out); #ifdef DEBUG_TO_FROM_CHAR @@ -1474,7 +1474,7 @@ str_numth(char *dest, char *num, int type) char * str_tolower(const char *buff, size_t nbytes) { - char *result; + char *result; if (!buff) return NULL; @@ -1482,7 +1482,7 @@ str_tolower(const char *buff, size_t nbytes) #ifdef USE_WIDE_UPPER_LOWER if (pg_database_encoding_max_length() > 1 && !lc_ctype_is_c()) { - wchar_t *workspace; + wchar_t *workspace; size_t curr_char; size_t result_size; @@ -1508,9 +1508,9 @@ str_tolower(const char *buff, size_t nbytes) pfree(workspace); } else -#endif /* USE_WIDE_UPPER_LOWER */ +#endif /* USE_WIDE_UPPER_LOWER */ { - char *p; + char *p; result = pnstrdup(buff, nbytes); @@ -1530,7 +1530,7 @@ str_tolower(const char *buff, size_t nbytes) char * str_toupper(const char *buff, size_t nbytes) { - char *result; + char *result; if (!buff) return NULL; @@ -1538,7 +1538,7 @@ str_toupper(const char *buff, size_t nbytes) #ifdef USE_WIDE_UPPER_LOWER if (pg_database_encoding_max_length() > 1 && !lc_ctype_is_c()) { - wchar_t *workspace; + wchar_t *workspace; size_t curr_char; size_t result_size; @@ -1564,9 +1564,9 @@ str_toupper(const char *buff, size_t nbytes) pfree(workspace); } else -#endif /* USE_WIDE_UPPER_LOWER */ +#endif /* USE_WIDE_UPPER_LOWER */ { - char *p; + char *p; result = pnstrdup(buff, nbytes); @@ -1586,7 +1586,7 @@ str_toupper(const char *buff, size_t nbytes) char * str_initcap(const char *buff, size_t nbytes) { - char *result; + char *result; int wasalnum = false; if (!buff) @@ -1595,7 +1595,7 @@ str_initcap(const char *buff, size_t nbytes) #ifdef USE_WIDE_UPPER_LOWER if (pg_database_encoding_max_length() > 1 && !lc_ctype_is_c()) { - wchar_t *workspace; + wchar_t *workspace; size_t curr_char; size_t result_size; @@ -1627,9 +1627,9 @@ str_initcap(const char *buff, size_t nbytes) pfree(workspace); } else -#endif /* USE_WIDE_UPPER_LOWER */ +#endif /* USE_WIDE_UPPER_LOWER */ { - char *p; + char *p; result = pnstrdup(buff, nbytes); @@ -1805,8 +1805,8 @@ from_char_set_int(int *dest, const int value, const FormatNode *node) if (*dest != 0 && *dest != value) ereport(ERROR, (errcode(ERRCODE_INVALID_DATETIME_FORMAT), - errmsg("conflicting values for \"%s\" field in formatting string", - node->key->name), + errmsg("conflicting values for \"%s\" field in formatting string", + node->key->name), errdetail("This value contradicts a previous setting for " "the same field type."))); *dest = value; @@ -1847,8 +1847,7 @@ from_char_parse_int_len(int *dest, char **src, const int len, FormatNode *node) { /* * This node is in Fill Mode, or the next node is known to be a - * non-digit value, so we just slurp as many characters as we - * can get. + * non-digit value, so we just slurp as many characters as we can get. */ errno = 0; result = strtol(init, src, 10); @@ -1859,13 +1858,13 @@ from_char_parse_int_len(int *dest, char **src, const int len, FormatNode *node) * We need to pull exactly the number of characters given in 'len' out * of the string, and convert those. */ - char *last; + char *last; if (used < len) ereport(ERROR, (errcode(ERRCODE_INVALID_DATETIME_FORMAT), - errmsg("source string too short for \"%s\" formatting field", - node->key->name), + errmsg("source string too short for \"%s\" formatting field", + node->key->name), errdetail("Field requires %d characters, but only %d " "remain.", len, used), @@ -1879,12 +1878,12 @@ from_char_parse_int_len(int *dest, char **src, const int len, FormatNode *node) if (used > 0 && used < len) ereport(ERROR, (errcode(ERRCODE_INVALID_DATETIME_FORMAT), - errmsg("invalid value \"%s\" for \"%s\"", - copy, node->key->name), + errmsg("invalid value \"%s\" for \"%s\"", + copy, node->key->name), errdetail("Field requires %d characters, but only %d " - "could be parsed.", len, used), + "could be parsed.", len, used), errhint("If your source string is not fixed-width, try " - "using the \"FM\" modifier."))); + "using the \"FM\" modifier."))); *src += used; } @@ -1893,14 +1892,14 @@ from_char_parse_int_len(int *dest, char **src, const int len, FormatNode *node) ereport(ERROR, (errcode(ERRCODE_INVALID_DATETIME_FORMAT), errmsg("invalid value \"%s\" for \"%s\"", - copy, node->key->name), + copy, node->key->name), errdetail("Value must be an integer."))); if (errno == ERANGE || result < INT_MIN || result > INT_MAX) ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), errmsg("value for \"%s\" in source string is out of range", - node->key->name), + node->key->name), errdetail("Value must be in the range %d to %d.", INT_MIN, INT_MAX))); @@ -1998,7 +1997,7 @@ seq_search(char *name, char **array, int type, int max, int *len) /* * Perform a sequential search in 'array' for text matching the first 'max' - * characters of the source string. + * characters of the source string. * * If a match is found, copy the array index of the match into the integer * pointed to by 'dest', advance 'src' to the end of the part of the string @@ -2007,15 +2006,15 @@ seq_search(char *name, char **array, int type, int max, int *len) * If the string doesn't match, throw an error. */ static int -from_char_seq_search(int *dest, char **src, char **array, int type, int max, +from_char_seq_search(int *dest, char **src, char **array, int type, int max, FormatNode *node) { - int len; + int len; *dest = seq_search(*src, array, type, max, &len); if (len <= 0) { - char copy[DCH_MAX_ITEM_SIZ + 1]; + char copy[DCH_MAX_ITEM_SIZ + 1]; Assert(max <= DCH_MAX_ITEM_SIZ); strlcpy(copy, *src, max + 1); @@ -2023,9 +2022,9 @@ from_char_seq_search(int *dest, char **src, char **array, int type, int max, ereport(ERROR, (errcode(ERRCODE_INVALID_DATETIME_FORMAT), errmsg("invalid value \"%s\" for \"%s\"", - copy, node->key->name), + copy, node->key->name), errdetail("The given value did not match any of the allowed " - "values for this field."))); + "values for this field."))); } *src += len; return len; @@ -2111,7 +2110,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out) str_numth(s, s, S_TH_TYPE(n->suffix)); s += strlen(s); break; - case DCH_MS: /* millisecond */ + case DCH_MS: /* millisecond */ #ifdef HAVE_INT64_TIMESTAMP sprintf(s, "%03d", (int) (in->fsec / INT64CONST(1000))); #else @@ -2122,7 +2121,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out) str_numth(s, s, S_TH_TYPE(n->suffix)); s += strlen(s); break; - case DCH_US: /* microsecond */ + case DCH_US: /* microsecond */ #ifdef HAVE_INT64_TIMESTAMP sprintf(s, "%06d", (int) in->fsec); #else @@ -2263,7 +2262,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out) strcpy(s, str_toupper_z(localized_full_days[tm->tm_wday])); else sprintf(s, "%*s", S_FM(n->suffix) ? 0 : -9, - str_toupper_z(days[tm->tm_wday])); + str_toupper_z(days[tm->tm_wday])); s += strlen(s); break; case DCH_Day: @@ -2317,7 +2316,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out) sprintf(s, "%0*d", S_FM(n->suffix) ? 0 : 3, (n->key->id == DCH_DDD) ? tm->tm_yday : - date2isoyearday(tm->tm_year, tm->tm_mon, tm->tm_mday)); + date2isoyearday(tm->tm_year, tm->tm_mon, tm->tm_mday)); if (S_THth(n->suffix)) str_numth(s, s, S_TH_TYPE(n->suffix)); s += strlen(s); @@ -2365,9 +2364,9 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out) s += strlen(s); break; case DCH_CC: - if (is_interval) /* straight calculation */ + if (is_interval) /* straight calculation */ i = tm->tm_year / 100; - else /* century 21 starts in 2001 */ + else /* century 21 starts in 2001 */ i = (tm->tm_year - 1) / 100 + 1; if (i <= 99 && i >= -99) sprintf(s, "%0*d", S_FM(n->suffix) ? 0 : 2, i); @@ -2556,7 +2555,7 @@ DCH_from_char(FormatNode *node, char *in, TmFromChar *out) from_char_parse_int(&out->ss, &s, n); s += SKIP_THth(n->suffix); break; - case DCH_MS: /* millisecond */ + case DCH_MS: /* millisecond */ len = from_char_parse_int_len(&out->ms, &s, 3, n); /* @@ -2567,7 +2566,7 @@ DCH_from_char(FormatNode *node, char *in, TmFromChar *out) s += SKIP_THth(n->suffix); break; - case DCH_US: /* microsecond */ + case DCH_US: /* microsecond */ len = from_char_parse_int_len(&out->us, &s, 6, n); out->us *= len == 1 ? 100000 : @@ -2662,6 +2661,7 @@ DCH_from_char(FormatNode *node, char *in, TmFromChar *out) s += SKIP_THth(n->suffix); break; case DCH_Q: + /* * We ignore Q when converting to date because it is not * normative. @@ -2678,13 +2678,15 @@ DCH_from_char(FormatNode *node, char *in, TmFromChar *out) break; case DCH_Y_YYY: { - int matched, years, millenia; + int matched, + years, + millenia; matched = sscanf(s, "%d,%03d", &millenia, &years); if (matched != 2) ereport(ERROR, (errcode(ERRCODE_INVALID_DATETIME_FORMAT), - errmsg("invalid input string for \"Y,YYY\""))); + errmsg("invalid input string for \"Y,YYY\""))); years += (millenia * 1000); from_char_set_int(&out->year, years, n); out->yysz = 4; @@ -2739,12 +2741,12 @@ DCH_from_char(FormatNode *node, char *in, TmFromChar *out) s += SKIP_THth(n->suffix); break; case DCH_RM: - from_char_seq_search(&value, &s, rm_months_upper, + from_char_seq_search(&value, &s, rm_months_upper, ALL_UPPER, MAX_RM_LEN, n); from_char_set_int(&out->mm, 12 - value, n); break; case DCH_rm: - from_char_seq_search(&value, &s, rm_months_lower, + from_char_seq_search(&value, &s, rm_months_lower, ALL_LOWER, MAX_RM_LEN, n); from_char_set_int(&out->mm, 12 - value, n); break; @@ -3276,16 +3278,16 @@ do_to_timestamp(text *date_txt, text *fmt, if (tmfc.ddd && (tm->tm_mon <= 1 || tm->tm_mday <= 1)) { /* - * The month and day field have not been set, so we use the day-of-year - * field to populate them. Depending on the date mode, this field may - * be interpreted as a Gregorian day-of-year, or an ISO week date - * day-of-year. + * The month and day field have not been set, so we use the + * day-of-year field to populate them. Depending on the date mode, + * this field may be interpreted as a Gregorian day-of-year, or an ISO + * week date day-of-year. */ if (!tm->tm_year && !tmfc.bc) ereport(ERROR, (errcode(ERRCODE_INVALID_DATETIME_FORMAT), - errmsg("cannot calculate day of year without year information"))); + errmsg("cannot calculate day of year without year information"))); if (tmfc.mode == FROM_CHAR_DATE_ISOWEEK) { @@ -3302,7 +3304,7 @@ do_to_timestamp(text *date_txt, text *fmt, static const int ysum[2][13] = { {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}, - {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366}}; + {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366}}; y = ysum[isleap(tm->tm_year)]; @@ -3388,8 +3390,8 @@ NUM_cache_getnew(char *str) for (ent = NUMCache; ent <= (NUMCache + NUM_CACHE_FIELDS); ent++) { /* - * entry removed via NUM_cache_remove() can be used here, - * which is why it's worth scanning first entry again + * entry removed via NUM_cache_remove() can be used here, which is + * why it's worth scanning first entry again */ if (ent->str[0] == '\0') { @@ -3621,6 +3623,7 @@ NUM_prepare_locale(NUMProc *Np) */ if (lconv->decimal_point && *lconv->decimal_point) Np->decimal = lconv->decimal_point; + else Np->decimal = "."; @@ -3637,7 +3640,7 @@ NUM_prepare_locale(NUMProc *Np) if (lconv->thousands_sep && *lconv->thousands_sep) Np->L_thousands_sep = lconv->thousands_sep; /* Make sure thousands separator doesn't match decimal point symbol. */ - else if (strcmp(Np->decimal, ",") != 0) + else if (strcmp(Np->decimal, ",") !=0) Np->L_thousands_sep = ","; else Np->L_thousands_sep = "."; diff --git a/src/backend/utils/adt/int8.c b/src/backend/utils/adt/int8.c index b636f8e82d..89162f080e 100644 --- a/src/backend/utils/adt/int8.c +++ b/src/backend/utils/adt/int8.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/int8.c,v 1.73 2009/01/01 17:23:49 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/int8.c,v 1.74 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -608,7 +608,7 @@ int8div(PG_FUNCTION_ARGS) /* * Overflow check. The only possible overflow case is for arg1 = * INT64_MIN, arg2 = -1, where the correct result is -INT64_MIN, which - * can't be represented on a two's-complement machine. Most machines + * can't be represented on a two's-complement machine. Most machines * produce INT64_MIN but it seems some produce zero. */ if (arg2 == -1 && arg1 < 0 && result <= 0) @@ -661,9 +661,9 @@ int8inc(PG_FUNCTION_ARGS) /* * When int8 is pass-by-reference, we provide this special case to avoid * palloc overhead for COUNT(): when called from nodeAgg, we know that the - * argument is modifiable local storage, so just update it in-place. - * (If int8 is pass-by-value, then of course this is useless as well - * as incorrect, so just ifdef it out.) + * argument is modifiable local storage, so just update it in-place. (If + * int8 is pass-by-value, then of course this is useless as well as + * incorrect, so just ifdef it out.) */ #ifndef USE_FLOAT8_BYVAL /* controls int8 too */ if (fcinfo->context && @@ -833,7 +833,7 @@ int84div(PG_FUNCTION_ARGS) /* * Overflow check. The only possible overflow case is for arg1 = * INT64_MIN, arg2 = -1, where the correct result is -INT64_MIN, which - * can't be represented on a two's-complement machine. Most machines + * can't be represented on a two's-complement machine. Most machines * produce INT64_MIN but it seems some produce zero. */ if (arg2 == -1 && arg1 < 0 && result <= 0) @@ -1012,7 +1012,7 @@ int82div(PG_FUNCTION_ARGS) /* * Overflow check. The only possible overflow case is for arg1 = * INT64_MIN, arg2 = -1, where the correct result is -INT64_MIN, which - * can't be represented on a two's-complement machine. Most machines + * can't be represented on a two's-complement machine. Most machines * produce INT64_MIN but it seems some produce zero. */ if (arg2 == -1 && arg1 < 0 && result <= 0) diff --git a/src/backend/utils/adt/like_match.c b/src/backend/utils/adt/like_match.c index d72113b66b..06eedb659b 100644 --- a/src/backend/utils/adt/like_match.c +++ b/src/backend/utils/adt/like_match.c @@ -19,7 +19,7 @@ * Copyright (c) 1996-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/like_match.c,v 1.25 2009/05/24 18:10:37 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/like_match.c,v 1.26 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -100,8 +100,8 @@ MatchText(char *t, int tlen, char *p, int plen) if (plen <= 0) ereport(ERROR, (errcode(ERRCODE_INVALID_ESCAPE_SEQUENCE), - errmsg("LIKE pattern must not end with escape character"))); - if (TCHAR(*p) != TCHAR(*t)) + errmsg("LIKE pattern must not end with escape character"))); + if (TCHAR (*p) != TCHAR (*t)) return LIKE_FALSE; } else if (*p == '%') @@ -135,9 +135,9 @@ MatchText(char *t, int tlen, char *p, int plen) } while (tlen > 0 && plen > 0 && *p == '_'); /* - * If we are at the end of the pattern, succeed: % followed - * by n _'s matches any string of at least n characters, and - * we have now found there are at least n characters. + * If we are at the end of the pattern, succeed: % followed by + * n _'s matches any string of at least n characters, and we + * have now found there are at least n characters. */ if (plen <= 0) return LIKE_TRUE; @@ -155,13 +155,13 @@ MatchText(char *t, int tlen, char *p, int plen) } else { - char firstpat = TCHAR(*p); + char firstpat = TCHAR (*p); if (*p == '\\') { if (plen < 2) return LIKE_FALSE; - firstpat = TCHAR(p[1]); + firstpat = TCHAR (p[1]); } while (tlen > 0) @@ -170,7 +170,7 @@ MatchText(char *t, int tlen, char *p, int plen) * Optimization to prevent most recursion: don't recurse * unless first pattern byte matches first text byte. */ - if (TCHAR(*t) == firstpat) + if (TCHAR (*t) == firstpat) { int matched = MatchText(t, tlen, p, plen); @@ -195,7 +195,7 @@ MatchText(char *t, int tlen, char *p, int plen) NextByte(p, plen); continue; } - else if (TCHAR(*p) != TCHAR(*t)) + else if (TCHAR (*p) != TCHAR (*t)) { /* non-wildcard pattern char fails to match text char */ return LIKE_FALSE; @@ -220,8 +220,9 @@ MatchText(char *t, int tlen, char *p, int plen) if (tlen > 0) return LIKE_FALSE; /* end of pattern, but not of text */ - /* End of text string. Do we have matching pattern remaining? */ - while (plen > 0 && *p == '%') /* allow multiple %'s at end of pattern */ + /* End of text string. Do we have matching pattern remaining? */ + while (plen > 0 && *p == '%') /* allow multiple %'s at end of + * pattern */ NextByte(p, plen); if (plen <= 0) @@ -351,4 +352,5 @@ do_like_escape(text *pat, text *esc) #ifdef MATCH_LOWER #undef MATCH_LOWER + #endif diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c index 904abb911b..f78fc7363d 100644 --- a/src/backend/utils/adt/misc.c +++ b/src/backend/utils/adt/misc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/misc.c,v 1.70 2009/01/08 00:13:22 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/misc.c,v 1.71 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -54,8 +54,8 @@ current_database(PG_FUNCTION_ARGS) /* * current_query() - * Expose the current query to the user (useful in stored procedures) - * We might want to use ActivePortal->sourceText someday. + * Expose the current query to the user (useful in stored procedures) + * We might want to use ActivePortal->sourceText someday. */ Datum current_query(PG_FUNCTION_ARGS) @@ -322,7 +322,7 @@ pg_get_keywords(PG_FUNCTION_ARGS) tupdesc = CreateTemplateTupleDesc(3, false); TupleDescInitEntry(tupdesc, (AttrNumber) 1, "word", TEXTOID, -1, 0); - TupleDescInitEntry(tupdesc, (AttrNumber) 2, "catcode", + TupleDescInitEntry(tupdesc, (AttrNumber) 2, "catcode", CHAROID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 3, "catdesc", TEXTOID, -1, 0); diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c index b25938a205..d1c41e138f 100644 --- a/src/backend/utils/adt/nabstime.c +++ b/src/backend/utils/adt/nabstime.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.160 2009/03/22 01:12:32 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.161 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -631,7 +631,7 @@ reltimein(PG_FUNCTION_ARGS) /* if those functions think it's a bad format, try ISO8601 style */ if (dterr == DTERR_BAD_FORMAT) - dterr = DecodeISO8601Interval(str, + dterr = DecodeISO8601Interval(str, &dtype, tm, &fsec); if (dterr != 0) diff --git a/src/backend/utils/adt/network.c b/src/backend/utils/adt/network.c index 8e58374e9b..f4fc67a843 100644 --- a/src/backend/utils/adt/network.c +++ b/src/backend/utils/adt/network.c @@ -1,7 +1,7 @@ /* * PostgreSQL type definitions for the INET and CIDR types. * - * $PostgreSQL: pgsql/src/backend/utils/adt/network.c,v 1.73 2008/03/25 22:42:44 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/network.c,v 1.74 2009/06/11 14:49:03 momjian Exp $ * * Jon Postel RIP 16 Oct 1998 */ @@ -319,7 +319,7 @@ inet_to_cidr(PG_FUNCTION_ARGS) inet *src = PG_GETARG_INET_P(0); inet *dst; int bits; - int byte; + int byte; int nbits; int maxbytes; @@ -335,19 +335,20 @@ inet_to_cidr(PG_FUNCTION_ARGS) /* zero out any bits to the right of the netmask */ byte = bits / 8; + nbits = bits % 8; /* clear the first byte, this might be a partial byte */ if (nbits != 0) { - ip_addr(dst)[byte] &= ~(0xFF >> nbits); - byte++; + ip_addr(dst)[byte] &=~(0xFF >> nbits); + byte ++; } /* clear remaining bytes */ maxbytes = ip_addrsize(dst); - while (byte < maxbytes) + while (byte <maxbytes) { ip_addr(dst)[byte] = 0; - byte++; + byte ++; } PG_RETURN_INET_P(dst); @@ -383,7 +384,7 @@ cidr_set_masklen(PG_FUNCTION_ARGS) inet *src = PG_GETARG_INET_P(0); int bits = PG_GETARG_INT32(1); inet *dst; - int byte; + int byte; int nbits; int maxbytes; @@ -403,19 +404,20 @@ cidr_set_masklen(PG_FUNCTION_ARGS) /* zero out any bits to the right of the new netmask */ byte = bits / 8; + nbits = bits % 8; /* clear the first byte, this might be a partial byte */ if (nbits != 0) { - ip_addr(dst)[byte] &= ~(0xFF >> nbits); - byte++; + ip_addr(dst)[byte] &=~(0xFF >> nbits); + byte ++; } /* clear remaining bytes */ maxbytes = ip_addrsize(dst); - while (byte < maxbytes) + while (byte <maxbytes) { ip_addr(dst)[byte] = 0; - byte++; + byte ++; } PG_RETURN_INET_P(dst); @@ -714,7 +716,7 @@ network_broadcast(PG_FUNCTION_ARGS) { inet *ip = PG_GETARG_INET_P(0); inet *dst; - int byte; + int byte; int bits; int maxbytes; unsigned char mask; @@ -733,7 +735,7 @@ network_broadcast(PG_FUNCTION_ARGS) a = ip_addr(ip); b = ip_addr(dst); - for (byte = 0; byte < maxbytes; byte++) + for (byte = 0; byte <maxbytes; byte ++) { if (bits >= 8) { @@ -748,7 +750,7 @@ network_broadcast(PG_FUNCTION_ARGS) bits = 0; } - b[byte] = a[byte] | mask; + b[byte] = a[byte] |mask; } ip_family(dst) = ip_family(ip); @@ -763,7 +765,7 @@ network_network(PG_FUNCTION_ARGS) { inet *ip = PG_GETARG_INET_P(0); inet *dst; - int byte; + int byte; int bits; unsigned char mask; unsigned char *a, @@ -777,6 +779,7 @@ network_network(PG_FUNCTION_ARGS) b = ip_addr(dst); byte = 0; + while (bits) { if (bits >= 8) @@ -790,8 +793,8 @@ network_network(PG_FUNCTION_ARGS) bits = 0; } - b[byte] = a[byte] & mask; - byte++; + b[byte] = a[byte] &mask; + byte ++; } ip_family(dst) = ip_family(ip); @@ -806,7 +809,7 @@ network_netmask(PG_FUNCTION_ARGS) { inet *ip = PG_GETARG_INET_P(0); inet *dst; - int byte; + int byte; int bits; unsigned char mask; unsigned char *b; @@ -818,6 +821,7 @@ network_netmask(PG_FUNCTION_ARGS) b = ip_addr(dst); byte = 0; + while (bits) { if (bits >= 8) @@ -832,7 +836,7 @@ network_netmask(PG_FUNCTION_ARGS) } b[byte] = mask; - byte++; + byte ++; } ip_family(dst) = ip_family(ip); @@ -847,7 +851,7 @@ network_hostmask(PG_FUNCTION_ARGS) { inet *ip = PG_GETARG_INET_P(0); inet *dst; - int byte; + int byte; int bits; int maxbytes; unsigned char mask; @@ -865,6 +869,7 @@ network_hostmask(PG_FUNCTION_ARGS) b = ip_addr(dst); byte = maxbytes - 1; + while (bits) { if (bits >= 8) @@ -879,7 +884,7 @@ network_hostmask(PG_FUNCTION_ARGS) } b[byte] = mask; - byte--; + byte --; } ip_family(dst) = ip_family(ip); @@ -989,7 +994,7 @@ bitncmp(void *l, void *r, int n) static bool addressOK(unsigned char *a, int bits, int family) { - int byte; + int byte; int nbits; int maxbits; int maxbytes; @@ -1011,17 +1016,18 @@ addressOK(unsigned char *a, int bits, int family) return true; byte = bits / 8; + nbits = bits % 8; mask = 0xff; if (bits != 0) mask >>= nbits; - while (byte < maxbytes) + while (byte <maxbytes) { - if ((a[byte] & mask) != 0) + if ((a[byte] &mask) != 0) return false; mask = 0xff; - byte++; + byte ++; } return true; @@ -1390,7 +1396,7 @@ inetmi(PG_FUNCTION_ARGS) * two's complement, too bad. */ int nb = ip_addrsize(ip); - int byte = 0; + int byte = 0; unsigned char *pip = ip_addr(ip); unsigned char *pip2 = ip_addr(ip2); int carry = 1; @@ -1401,9 +1407,9 @@ inetmi(PG_FUNCTION_ARGS) carry = pip[nb] + (~pip2[nb] & 0xFF) + carry; lobyte = carry & 0xFF; - if (byte < sizeof(int64)) + if (byte <sizeof(int64)) { - res |= ((int64) lobyte) << (byte * 8); + res |= ((int64) lobyte) << (byte *8); } else { @@ -1418,15 +1424,15 @@ inetmi(PG_FUNCTION_ARGS) errmsg("result is out of range"))); } carry >>= 8; - byte++; + byte ++; } /* * If input is narrower than int64, overflow is not possible, but we * have to do proper sign extension. */ - if (carry == 0 && byte < sizeof(int64)) - res |= ((int64) -1) << (byte * 8); + if (carry == 0 && byte <sizeof(int64)) + res |= ((int64) -1) << (byte *8); } PG_RETURN_INT64(res); diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c index 0fbca23175..ba3721b12b 100644 --- a/src/backend/utils/adt/numeric.c +++ b/src/backend/utils/adt/numeric.c @@ -14,7 +14,7 @@ * Copyright (c) 1998-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.117 2009/04/08 22:08:40 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.118 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -90,7 +90,7 @@ typedef int16 NumericDigit; /* ---------- - * NumericVar is the format we use for arithmetic. The digit-array part + * NumericVar is the format we use for arithmetic. The digit-array part * is the same as the NumericData storage format, but the header is more * complex. * @@ -243,7 +243,7 @@ static void free_var(NumericVar *var); static void zero_var(NumericVar *var); static const char *set_var_from_str(const char *str, const char *cp, - NumericVar *dest); + NumericVar *dest); static void set_var_from_num(Numeric value, NumericVar *dest); static void set_var_from_var(NumericVar *value, NumericVar *dest); static char *get_str_from_var(NumericVar *var, int dscale); @@ -271,7 +271,7 @@ static void mul_var(NumericVar *var1, NumericVar *var2, NumericVar *result, static void div_var(NumericVar *var1, NumericVar *var2, NumericVar *result, int rscale, bool round); static void div_var_fast(NumericVar *var1, NumericVar *var2, NumericVar *result, - int rscale, bool round); + int rscale, bool round); static int select_div_scale(NumericVar *var1, NumericVar *var2); static void mod_var(NumericVar *var1, NumericVar *var2, NumericVar *result); static void ceil_var(NumericVar *var, NumericVar *result); @@ -348,8 +348,8 @@ numeric_in(PG_FUNCTION_ARGS) if (!isspace((unsigned char) *cp)) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type numeric: \"%s\"", - str))); + errmsg("invalid input syntax for type numeric: \"%s\"", + str))); cp++; } } @@ -367,16 +367,16 @@ numeric_in(PG_FUNCTION_ARGS) /* * We duplicate a few lines of code here because we would like to * throw any trailing-junk syntax error before any semantic error - * resulting from apply_typmod. We can't easily fold the two - * cases together because we mustn't apply apply_typmod to a NaN. + * resulting from apply_typmod. We can't easily fold the two cases + * together because we mustn't apply apply_typmod to a NaN. */ while (*cp) { if (!isspace((unsigned char) *cp)) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type numeric: \"%s\"", - str))); + errmsg("invalid input syntax for type numeric: \"%s\"", + str))); cp++; } @@ -1938,8 +1938,8 @@ numeric_power(PG_FUNCTION_ARGS) /* * The SQL spec requires that we emit a particular SQLSTATE error code for - * certain error conditions. Specifically, we don't return a divide-by-zero - * error code for 0 ^ -1. + * certain error conditions. Specifically, we don't return a + * divide-by-zero error code for 0 ^ -1. */ if (cmp_var(&arg1, &const_zero) == 0 && cmp_var(&arg2, &const_zero) < 0) @@ -2654,9 +2654,9 @@ int2_sum(PG_FUNCTION_ARGS) /* * If we're invoked by nodeAgg, we can cheat and modify our first * parameter in-place to avoid palloc overhead. If not, we need to return - * the new value of the transition variable. - * (If int8 is pass-by-value, then of course this is useless as well - * as incorrect, so just ifdef it out.) + * the new value of the transition variable. (If int8 is pass-by-value, + * then of course this is useless as well as incorrect, so just ifdef it + * out.) */ #ifndef USE_FLOAT8_BYVAL /* controls int8 too */ if (fcinfo->context && @@ -2705,9 +2705,9 @@ int4_sum(PG_FUNCTION_ARGS) /* * If we're invoked by nodeAgg, we can cheat and modify our first * parameter in-place to avoid palloc overhead. If not, we need to return - * the new value of the transition variable. - * (If int8 is pass-by-value, then of course this is useless as well - * as incorrect, so just ifdef it out.) + * the new value of the transition variable. (If int8 is pass-by-value, + * then of course this is useless as well as incorrect, so just ifdef it + * out.) */ #ifndef USE_FLOAT8_BYVAL /* controls int8 too */ if (fcinfo->context && @@ -4209,6 +4209,7 @@ div_var(NumericVar *var1, NumericVar *var2, NumericVar *result, /* If rounding needed, figure one more digit to ensure correct result */ if (round) res_ndigits++; + /* * The working dividend normally requires res_ndigits + var2ndigits * digits, but make it at least var1ndigits so we can load all of var1 @@ -4222,8 +4223,8 @@ div_var(NumericVar *var1, NumericVar *var2, NumericVar *result, /* * We need a workspace with room for the working dividend (div_ndigits+1 * digits) plus room for the possibly-normalized divisor (var2ndigits - * digits). It is convenient also to have a zero at divisor[0] with - * the actual divisor data in divisor[1 .. var2ndigits]. Transferring the + * digits). It is convenient also to have a zero at divisor[0] with the + * actual divisor data in divisor[1 .. var2ndigits]. Transferring the * digits into the workspace also allows us to realloc the result (which * might be the same as either input var) before we begin the main loop. * Note that we use palloc0 to ensure that divisor[0], dividend[0], and @@ -4244,8 +4245,8 @@ div_var(NumericVar *var1, NumericVar *var2, NumericVar *result, if (var2ndigits == 1) { /* - * If there's only a single divisor digit, we can use a fast path - * (cf. Knuth section 4.3.1 exercise 16). + * If there's only a single divisor digit, we can use a fast path (cf. + * Knuth section 4.3.1 exercise 16). */ divisor1 = divisor[1]; carry = 0; @@ -4264,12 +4265,12 @@ div_var(NumericVar *var1, NumericVar *var2, NumericVar *result, * * We need the first divisor digit to be >= NBASE/2. If it isn't, * make it so by scaling up both the divisor and dividend by the - * factor "d". (The reason for allocating dividend[0] above is to + * factor "d". (The reason for allocating dividend[0] above is to * leave room for possible carry here.) */ if (divisor[1] < HALF_NBASE) { - int d = NBASE / (divisor[1] + 1); + int d = NBASE / (divisor[1] + 1); carry = 0; for (i = var2ndigits; i > 0; i--) @@ -4295,22 +4296,22 @@ div_var(NumericVar *var1, NumericVar *var2, NumericVar *result, divisor2 = divisor[2]; /* - * Begin the main loop. Each iteration of this loop produces the - * j'th quotient digit by dividing dividend[j .. j + var2ndigits] - * by the divisor; this is essentially the same as the common manual + * Begin the main loop. Each iteration of this loop produces the j'th + * quotient digit by dividing dividend[j .. j + var2ndigits] by the + * divisor; this is essentially the same as the common manual * procedure for long division. */ for (j = 0; j < res_ndigits; j++) { /* Estimate quotient digit from the first two dividend digits */ - int next2digits = dividend[j] * NBASE + dividend[j+1]; - int qhat; + int next2digits = dividend[j] * NBASE + dividend[j + 1]; + int qhat; /* * If next2digits are 0, then quotient digit must be 0 and there's - * no need to adjust the working dividend. It's worth testing - * here to fall out ASAP when processing trailing zeroes in - * a dividend. + * no need to adjust the working dividend. It's worth testing + * here to fall out ASAP when processing trailing zeroes in a + * dividend. */ if (next2digits == 0) { @@ -4322,14 +4323,15 @@ div_var(NumericVar *var1, NumericVar *var2, NumericVar *result, qhat = NBASE - 1; else qhat = next2digits / divisor1; + /* * Adjust quotient digit if it's too large. Knuth proves that - * after this step, the quotient digit will be either correct - * or just one too large. (Note: it's OK to use dividend[j+2] - * here because we know the divisor length is at least 2.) + * after this step, the quotient digit will be either correct or + * just one too large. (Note: it's OK to use dividend[j+2] here + * because we know the divisor length is at least 2.) */ while (divisor2 * qhat > - (next2digits - qhat * divisor1) * NBASE + dividend[j+2]) + (next2digits - qhat * divisor1) * NBASE + dividend[j + 2]) qhat--; /* As above, need do nothing more when quotient digit is 0 */ @@ -5253,16 +5255,16 @@ power_var(NumericVar *base, NumericVar *exp, NumericVar *result) } /* - * This avoids log(0) for cases of 0 raised to a non-integer. - * 0 ^ 0 handled by power_var_int(). + * This avoids log(0) for cases of 0 raised to a non-integer. 0 ^ 0 + * handled by power_var_int(). */ if (cmp_var(base, &const_zero) == 0) { set_var_from_var(&const_zero, result); - result->dscale = NUMERIC_MIN_SIG_DIGITS; /* no need to round */ + result->dscale = NUMERIC_MIN_SIG_DIGITS; /* no need to round */ return; } - + init_var(&ln_base); init_var(&ln_num); @@ -5330,11 +5332,13 @@ power_var_int(NumericVar *base, int exp, NumericVar *result, int rscale) switch (exp) { case 0: + /* - * While 0 ^ 0 can be either 1 or indeterminate (error), we - * treat it as 1 because most programming languages do this. - * SQL:2003 also requires a return value of 1. - * http://en.wikipedia.org/wiki/Exponentiation#Zero_to_the_zero_power + * While 0 ^ 0 can be either 1 or indeterminate (error), we treat + * it as 1 because most programming languages do this. SQL:2003 + * also requires a return value of 1. + * http://en.wikipedia.org/wiki/Exponentiation#Zero_to_the_zero_pow + * er */ set_var_from_var(&const_one, result); result->dscale = rscale; /* no need to round */ diff --git a/src/backend/utils/adt/oracle_compat.c b/src/backend/utils/adt/oracle_compat.c index 4b9e53868d..106671b7d5 100644 --- a/src/backend/utils/adt/oracle_compat.c +++ b/src/backend/utils/adt/oracle_compat.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/oracle_compat.c,v 1.83 2009/01/01 17:23:49 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/oracle_compat.c,v 1.84 2009/06/11 14:49:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -42,9 +42,9 @@ static text *dotrim(const char *string, int stringlen, Datum lower(PG_FUNCTION_ARGS) { - text *in_string = PG_GETARG_TEXT_PP(0); - char *out_string; - text *result; + text *in_string = PG_GETARG_TEXT_PP(0); + char *out_string; + text *result; out_string = str_tolower(VARDATA_ANY(in_string), VARSIZE_ANY_EXHDR(in_string)); @@ -72,9 +72,9 @@ lower(PG_FUNCTION_ARGS) Datum upper(PG_FUNCTION_ARGS) { - text *in_string = PG_GETARG_TEXT_PP(0); - char *out_string; - text *result; + text *in_string = PG_GETARG_TEXT_PP(0); + char *out_string; + text *result; out_string = str_toupper(VARDATA_ANY(in_string), VARSIZE_ANY_EXHDR(in_string)); @@ -105,9 +105,9 @@ upper(PG_FUNCTION_ARGS) Datum initcap(PG_FUNCTION_ARGS) { - text *in_string = PG_GETARG_TEXT_PP(0); - char *out_string; - text *result; + text *in_string = PG_GETARG_TEXT_PP(0); + char *out_string; + text *result; out_string = str_initcap(VARDATA_ANY(in_string), VARSIZE_ANY_EXHDR(in_string)); diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c index 7472a8ef79..03b6fad3ef 100644 --- a/src/backend/utils/adt/pg_locale.c +++ b/src/backend/utils/adt/pg_locale.c @@ -4,14 +4,14 @@ * * Portions Copyright (c) 2002-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/backend/utils/adt/pg_locale.c,v 1.49 2009/04/01 09:17:32 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/pg_locale.c,v 1.50 2009/06/11 14:49:03 momjian Exp $ * *----------------------------------------------------------------------- */ /*---------- * Here is how the locale stuff is handled: LC_COLLATE and LC_CTYPE - * are fixed at CREATE DATABASE time, stored in pg_database, and cannot + * are fixed at CREATE DATABASE time, stored in pg_database, and cannot * be changed. Thus, the effects of strcoll(), strxfrm(), isupper(), * toupper(), etc. are always in the same fixed locale. * @@ -93,7 +93,7 @@ static char lc_numeric_envbuf[LC_ENV_BUFSIZE]; static char lc_time_envbuf[LC_ENV_BUFSIZE]; #if defined(WIN32) && defined(LC_MESSAGES) -static char *IsoLocaleName(const char *); /* MSVC specific */ +static char *IsoLocaleName(const char *); /* MSVC specific */ #endif @@ -159,9 +159,9 @@ pg_perm_setlocale(int category, const char *locale) result = IsoLocaleName(locale); if (result == NULL) result = (char *) locale; -#endif /* WIN32 */ +#endif /* WIN32 */ break; -#endif /* LC_MESSAGES */ +#endif /* LC_MESSAGES */ case LC_MONETARY: envvar = "LC_MONETARY"; envbuf = lc_monetary_envbuf; @@ -468,28 +468,33 @@ PGLC_localeconv(void) * pg_strftime(), which isn't locale-aware and does not need to be replaced. */ static size_t -strftime_win32(char *dst, size_t dstlen, const wchar_t *format, const struct tm *tm) +strftime_win32(char *dst, size_t dstlen, const wchar_t *format, const struct tm * tm) { - size_t len; - wchar_t wbuf[MAX_L10N_DATA]; - int encoding; + size_t len; + wchar_t wbuf[MAX_L10N_DATA]; + int encoding; encoding = GetDatabaseEncoding(); len = wcsftime(wbuf, MAX_L10N_DATA, format, tm); if (len == 0) - /* strftime call failed - return 0 with the contents of dst unspecified */ + + /* + * strftime call failed - return 0 with the contents of dst + * unspecified + */ return 0; len = WideCharToMultiByte(CP_UTF8, 0, wbuf, len, dst, dstlen, NULL, NULL); if (len == 0) elog(ERROR, - "could not convert string to UTF-8:error %lu", GetLastError()); + "could not convert string to UTF-8:error %lu", GetLastError()); dst[len] = '\0'; if (encoding != PG_UTF8) { - char *convstr = pg_do_encoding_conversion(dst, len, PG_UTF8, encoding); + char *convstr = pg_do_encoding_conversion(dst, len, PG_UTF8, encoding); + if (dst != convstr) { strlcpy(dst, convstr, dstlen); @@ -501,8 +506,7 @@ strftime_win32(char *dst, size_t dstlen, const wchar_t *format, const struct tm } #define strftime(a,b,c,d) strftime_win32(a,b,L##c,d) - -#endif /* WIN32 */ +#endif /* WIN32 */ /* @@ -511,12 +515,13 @@ strftime_win32(char *dst, size_t dstlen, const wchar_t *format, const struct tm void cache_locale_time(void) { - char *save_lc_time; + char *save_lc_time; time_t timenow; - struct tm *timeinfo; + struct tm *timeinfo; char buf[MAX_L10N_DATA]; char *ptr; int i; + #ifdef WIN32 char *save_lc_ctype; #endif @@ -611,10 +616,11 @@ cache_locale_time(void) * contains the iso formatted locale name. */ static -char *IsoLocaleName(const char *winlocname) +char * +IsoLocaleName(const char *winlocname) { -#if (_MSC_VER >= 1400) /* VC8.0 or later */ - static char iso_lc_messages[32]; +#if (_MSC_VER >= 1400) /* VC8.0 or later */ + static char iso_lc_messages[32]; _locale_t loct = NULL; if (pg_strcasecmp("c", winlocname) == 0 || @@ -627,8 +633,9 @@ char *IsoLocaleName(const char *winlocname) loct = _create_locale(LC_CTYPE, winlocname); if (loct != NULL) { - char isolang[32], isocrty[32]; - LCID lcid; + char isolang[32], + isocrty[32]; + LCID lcid; lcid = loct->locinfo->lc_handle[LC_CTYPE]; if (lcid == 0) @@ -644,8 +651,8 @@ char *IsoLocaleName(const char *winlocname) } return NULL; #else - return NULL; /* Not supported on this version of msvc/mingw */ -#endif /* _MSC_VER >= 1400 */ + return NULL; /* Not supported on this version of msvc/mingw */ +#endif /* _MSC_VER >= 1400 */ } -#endif /* WIN32 && LC_MESSAGES */ +#endif /* WIN32 && LC_MESSAGES */ diff --git a/src/backend/utils/adt/pg_lzcompress.c b/src/backend/utils/adt/pg_lzcompress.c index 20244ae3fc..3978e9581c 100644 --- a/src/backend/utils/adt/pg_lzcompress.c +++ b/src/backend/utils/adt/pg_lzcompress.c @@ -166,7 +166,7 @@ * * Copyright (c) 1999-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.33 2009/01/06 15:51:38 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.34 2009/06/11 14:49:03 momjian Exp $ * ---------- */ #include "postgres.h" @@ -210,23 +210,29 @@ typedef struct PGLZ_HistEntry * ---------- */ static const PGLZ_Strategy strategy_default_data = { - 32, /* Data chunks less than 32 bytes are not compressed */ - INT_MAX, /* No upper limit on what we'll try to compress */ - 25, /* Require 25% compression rate, or not worth it */ - 1024, /* Give up if no compression in the first 1KB */ - 128, /* Stop history lookup if a match of 128 bytes is found */ - 10 /* Lower good match size by 10% at every loop iteration */ + 32, /* Data chunks less than 32 bytes are not + * compressed */ + INT_MAX, /* No upper limit on what we'll try to + * compress */ + 25, /* Require 25% compression rate, or not worth + * it */ + 1024, /* Give up if no compression in the first 1KB */ + 128, /* Stop history lookup if a match of 128 bytes + * is found */ + 10 /* Lower good match size by 10% at every loop + * iteration */ }; const PGLZ_Strategy *const PGLZ_strategy_default = &strategy_default_data; static const PGLZ_Strategy strategy_always_data = { - 0, /* Chunks of any size are compressed */ + 0, /* Chunks of any size are compressed */ INT_MAX, - 0, /* It's enough to save one single byte */ - INT_MAX, /* Never give up early */ - 128, /* Stop history lookup if a match of 128 bytes is found */ - 6 /* Look harder for a good match */ + 0, /* It's enough to save one single byte */ + INT_MAX, /* Never give up early */ + 128, /* Stop history lookup if a match of 128 bytes + * is found */ + 6 /* Look harder for a good match */ }; const PGLZ_Strategy *const PGLZ_strategy_always = &strategy_always_data; @@ -502,8 +508,8 @@ pglz_compress(const char *source, int32 slen, PGLZ_Header *dest, strategy = PGLZ_strategy_default; /* - * If the strategy forbids compression (at all or if source chunk size - * out of range), fail. + * If the strategy forbids compression (at all or if source chunk size out + * of range), fail. */ if (strategy->match_size_good <= 0 || slen < strategy->min_input_size || @@ -537,11 +543,11 @@ pglz_compress(const char *source, int32 slen, PGLZ_Header *dest, need_rate = 99; /* - * Compute the maximum result size allowed by the strategy, namely - * the input size minus the minimum wanted compression rate. This had - * better be <= slen, else we might overrun the provided output buffer. + * Compute the maximum result size allowed by the strategy, namely the + * input size minus the minimum wanted compression rate. This had better + * be <= slen, else we might overrun the provided output buffer. */ - if (slen > (INT_MAX/100)) + if (slen > (INT_MAX / 100)) { /* Approximate to avoid overflow */ result_max = (slen / 100) * (100 - need_rate); @@ -572,7 +578,7 @@ pglz_compress(const char *source, int32 slen, PGLZ_Header *dest, /* * If we've emitted more than first_success_by bytes without finding - * anything compressible at all, fail. This lets us fall out + * anything compressible at all, fail. This lets us fall out * reasonably quickly when looking at incompressible input (such as * pre-compressed data). */ @@ -654,11 +660,11 @@ pglz_decompress(const PGLZ_Header *source, char *dest) while (sp < srcend && dp < destend) { /* - * Read one control byte and process the next 8 items (or as many - * as remain in the compressed input). + * Read one control byte and process the next 8 items (or as many as + * remain in the compressed input). */ unsigned char ctrl = *sp++; - int ctrlc; + int ctrlc; for (ctrlc = 0; ctrlc < 8 && sp < srcend; ctrlc++) { @@ -681,11 +687,11 @@ pglz_decompress(const PGLZ_Header *source, char *dest) len += *sp++; /* - * Check for output buffer overrun, to ensure we don't - * clobber memory in case of corrupt input. Note: we must - * advance dp here to ensure the error is detected below - * the loop. We don't simply put the elog inside the loop - * since that will probably interfere with optimization. + * Check for output buffer overrun, to ensure we don't clobber + * memory in case of corrupt input. Note: we must advance dp + * here to ensure the error is detected below the loop. We + * don't simply put the elog inside the loop since that will + * probably interfere with optimization. */ if (dp + len > destend) { @@ -711,8 +717,8 @@ pglz_decompress(const PGLZ_Header *source, char *dest) * An unset control bit means LITERAL BYTE. So we just copy * one from INPUT to OUTPUT. */ - if (dp >= destend) /* check for buffer overrun */ - break; /* do not clobber memory */ + if (dp >= destend) /* check for buffer overrun */ + break; /* do not clobber memory */ *dp++ = *sp++; } diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c index b56761d60c..89fb28a402 100644 --- a/src/backend/utils/adt/pgstatfuncs.c +++ b/src/backend/utils/adt/pgstatfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/pgstatfuncs.c,v 1.53 2009/01/01 17:23:49 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/pgstatfuncs.c,v 1.54 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -332,7 +332,7 @@ pg_stat_get_last_autoanalyze_time(PG_FUNCTION_ARGS) Datum pg_stat_get_function_calls(PG_FUNCTION_ARGS) { - Oid funcid = PG_GETARG_OID(0); + Oid funcid = PG_GETARG_OID(0); PgStat_StatFuncEntry *funcentry; if ((funcentry = pgstat_fetch_stat_funcentry(funcid)) == NULL) @@ -343,7 +343,7 @@ pg_stat_get_function_calls(PG_FUNCTION_ARGS) Datum pg_stat_get_function_time(PG_FUNCTION_ARGS) { - Oid funcid = PG_GETARG_OID(0); + Oid funcid = PG_GETARG_OID(0); PgStat_StatFuncEntry *funcentry; if ((funcentry = pgstat_fetch_stat_funcentry(funcid)) == NULL) @@ -354,7 +354,7 @@ pg_stat_get_function_time(PG_FUNCTION_ARGS) Datum pg_stat_get_function_self_time(PG_FUNCTION_ARGS) { - Oid funcid = PG_GETARG_OID(0); + Oid funcid = PG_GETARG_OID(0); PgStat_StatFuncEntry *funcentry; if ((funcentry = pgstat_fetch_stat_funcentry(funcid)) == NULL) @@ -410,10 +410,10 @@ pg_stat_get_activity(PG_FUNCTION_ARGS) if (SRF_IS_FIRSTCALL()) { MemoryContext oldcontext; - TupleDesc tupdesc; - + TupleDesc tupdesc; + funcctx = SRF_FIRSTCALL_INIT(); - + oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx); tupdesc = CreateTemplateTupleDesc(10, false); @@ -441,33 +441,34 @@ pg_stat_get_activity(PG_FUNCTION_ARGS) /* * Get one backend - locate by pid. * - * We lookup the backend early, so we can return zero rows if it doesn't - * exist, instead of returning a single row full of NULLs. + * We lookup the backend early, so we can return zero rows if it + * doesn't exist, instead of returning a single row full of NULLs. */ - int pid = PG_GETARG_INT32(0); - int i; - int n = pgstat_fetch_stat_numbackends(); - + int pid = PG_GETARG_INT32(0); + int i; + int n = pgstat_fetch_stat_numbackends(); + for (i = 1; i <= n; i++) { PgBackendStatus *be = pgstat_fetch_stat_beentry(i); + if (be) { if (be->st_procpid == pid) { - *(int *)(funcctx->user_fctx) = i; + *(int *) (funcctx->user_fctx) = i; break; } } } - if (*(int *)(funcctx->user_fctx) == 0) + if (*(int *) (funcctx->user_fctx) == 0) /* Pid not found, return zero rows */ funcctx->max_calls = 0; else funcctx->max_calls = 1; } - + MemoryContextSwitchTo(oldcontext); } @@ -477,26 +478,26 @@ pg_stat_get_activity(PG_FUNCTION_ARGS) if (funcctx->call_cntr < funcctx->max_calls) { /* for each row */ - Datum values[10]; - bool nulls[10]; - HeapTuple tuple; + Datum values[10]; + bool nulls[10]; + HeapTuple tuple; PgBackendStatus *beentry; - SockAddr zero_clientaddr; + SockAddr zero_clientaddr; MemSet(values, 0, sizeof(values)); MemSet(nulls, 0, sizeof(nulls)); - - if (*(int *)(funcctx->user_fctx) > 0) + + if (*(int *) (funcctx->user_fctx) > 0) /* Get specific pid slot */ - beentry = pgstat_fetch_stat_beentry(*(int *)(funcctx->user_fctx)); + beentry = pgstat_fetch_stat_beentry(*(int *) (funcctx->user_fctx)); else /* Get the next one in the list */ - beentry = pgstat_fetch_stat_beentry(funcctx->call_cntr+1); /* 1-based index */ + beentry = pgstat_fetch_stat_beentry(funcctx->call_cntr + 1); /* 1-based index */ if (!beentry) { - int i; + int i; - for (i = 0; i < sizeof(nulls)/sizeof(nulls[0]); i++) + for (i = 0; i < sizeof(nulls) / sizeof(nulls[0]); i++) nulls[i] = true; nulls[3] = false; @@ -543,7 +544,7 @@ pg_stat_get_activity(PG_FUNCTION_ARGS) /* A zeroed client addr means we don't know */ memset(&zero_clientaddr, 0, sizeof(zero_clientaddr)); if (memcmp(&(beentry->st_clientaddr), &zero_clientaddr, - sizeof(zero_clientaddr) == 0)) + sizeof(zero_clientaddr) == 0)) { nulls[8] = true; nulls[9] = true; @@ -554,9 +555,9 @@ pg_stat_get_activity(PG_FUNCTION_ARGS) #ifdef HAVE_IPV6 || beentry->st_clientaddr.addr.ss_family == AF_INET6 #endif - ) + ) { - char remote_host[NI_MAXHOST]; + char remote_host[NI_MAXHOST]; char remote_port[NI_MAXSERV]; int ret; @@ -576,16 +577,17 @@ pg_stat_get_activity(PG_FUNCTION_ARGS) { clean_ipv6_addr(beentry->st_clientaddr.addr.ss_family, remote_host); values[8] = DirectFunctionCall1(inet_in, - CStringGetDatum(remote_host)); + CStringGetDatum(remote_host)); values[9] = Int32GetDatum(atoi(remote_port)); } } else if (beentry->st_clientaddr.addr.ss_family == AF_UNIX) { /* - * Unix sockets always reports NULL for host and -1 for port, so it's - * possible to tell the difference to connections we have no - * permissions to view, or with errors. + * Unix sockets always reports NULL for host and -1 for + * port, so it's possible to tell the difference to + * connections we have no permissions to view, or with + * errors. */ nulls[8] = true; values[9] = DatumGetInt32(-1); diff --git a/src/backend/utils/adt/quote.c b/src/backend/utils/adt/quote.c index d7553afc97..c9419081d7 100644 --- a/src/backend/utils/adt/quote.c +++ b/src/backend/utils/adt/quote.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/quote.c,v 1.26 2009/01/01 17:23:49 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/quote.c,v 1.27 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -86,8 +86,8 @@ quote_literal(PG_FUNCTION_ARGS) /* * quote_nullable - - * Returns a properly quoted literal, with null values returned - * as the text string 'NULL'. + * Returns a properly quoted literal, with null values returned + * as the text string 'NULL'. */ Datum quote_nullable(PG_FUNCTION_ARGS) diff --git a/src/backend/utils/adt/regexp.c b/src/backend/utils/adt/regexp.c index f9ccf6352d..e4e3c77665 100644 --- a/src/backend/utils/adt/regexp.c +++ b/src/backend/utils/adt/regexp.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/regexp.c,v 1.81 2009/01/01 17:23:49 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/regexp.c,v 1.82 2009/06/11 14:49:04 momjian Exp $ * * Alistair Crooks added the code for the regex caching * agc - cached the regular expressions used - there's a good chance @@ -40,7 +40,7 @@ /* GUC-settable flavor parameter */ -int regex_flavor = REG_ADVANCED; +int regex_flavor = REG_ADVANCED; /* all the options of interest for regex functions */ @@ -582,10 +582,10 @@ textregexsubstr(PG_FUNCTION_ARGS) } /* - * It is possible to have a match to the whole pattern but no match - * for a subexpression; for example 'foo(bar)?' is considered to match - * 'foo' but there is no subexpression match. So this extra test for - * match failure is not redundant. + * It is possible to have a match to the whole pattern but no match for a + * subexpression; for example 'foo(bar)?' is considered to match 'foo' but + * there is no subexpression match. So this extra test for match failure + * is not redundant. */ if (so < 0 || eo < 0) PG_RETURN_NULL(); diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c index 53b9c43f08..5bcbd63304 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -15,7 +15,7 @@ * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.112 2009/01/07 13:44:36 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.113 2009/06/11 14:49:04 momjian Exp $ * * ---------- */ @@ -3620,7 +3620,7 @@ static SPIPlanPtr ri_FetchPreparedPlan(RI_QueryKey *key) { RI_QueryHashEntry *entry; - SPIPlanPtr plan; + SPIPlanPtr plan; /* * On the first call initialize the hashtable @@ -3638,11 +3638,11 @@ ri_FetchPreparedPlan(RI_QueryKey *key) return NULL; /* - * Check whether the plan is still valid. If it isn't, we don't want - * to simply rely on plancache.c to regenerate it; rather we should - * start from scratch and rebuild the query text too. This is to cover - * cases such as table/column renames. We depend on the plancache - * machinery to detect possible invalidations, though. + * Check whether the plan is still valid. If it isn't, we don't want to + * simply rely on plancache.c to regenerate it; rather we should start + * from scratch and rebuild the query text too. This is to cover cases + * such as table/column renames. We depend on the plancache machinery to + * detect possible invalidations, though. * * CAUTION: this check is only trustworthy if the caller has already * locked both FK and PK rels. @@ -3652,8 +3652,8 @@ ri_FetchPreparedPlan(RI_QueryKey *key) return plan; /* - * Otherwise we might as well flush the cached plan now, to free a - * little memory space before we make a new one. + * Otherwise we might as well flush the cached plan now, to free a little + * memory space before we make a new one. */ entry->plan = NULL; if (plan) @@ -3682,8 +3682,8 @@ ri_HashPreparedPlan(RI_QueryKey *key, SPIPlanPtr plan) ri_InitHashTables(); /* - * Add the new plan. We might be overwriting an entry previously - * found invalid by ri_FetchPreparedPlan. + * Add the new plan. We might be overwriting an entry previously found + * invalid by ri_FetchPreparedPlan. */ entry = (RI_QueryHashEntry *) hash_search(ri_query_cache, (void *) key, diff --git a/src/backend/utils/adt/rowtypes.c b/src/backend/utils/adt/rowtypes.c index c2a030baac..9ea8a2d80f 100644 --- a/src/backend/utils/adt/rowtypes.c +++ b/src/backend/utils/adt/rowtypes.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/rowtypes.c,v 1.24 2009/01/01 17:23:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/rowtypes.c,v 1.25 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -57,7 +57,7 @@ typedef struct RecordCompareData int32 record1_typmod; Oid record2_type; int32 record2_typmod; - ColumnCompareData columns[1]; /* VARIABLE LENGTH ARRAY */ + ColumnCompareData columns[1]; /* VARIABLE LENGTH ARRAY */ } RecordCompareData; @@ -822,7 +822,7 @@ record_cmp(FunctionCallInfo fcinfo) { fcinfo->flinfo->fn_extra = MemoryContextAlloc(fcinfo->flinfo->fn_mcxt, - sizeof(RecordCompareData) - sizeof(ColumnCompareData) + sizeof(RecordCompareData) - sizeof(ColumnCompareData) + ncols * sizeof(ColumnCompareData)); my_extra = (RecordCompareData *) fcinfo->flinfo->fn_extra; my_extra->ncolumns = ncols; @@ -854,8 +854,8 @@ record_cmp(FunctionCallInfo fcinfo) /* * Scan corresponding columns, allowing for dropped columns in different - * places in the two rows. i1 and i2 are physical column indexes, - * j is the logical column index. + * places in the two rows. i1 and i2 are physical column indexes, j is + * the logical column index. */ i1 = i2 = j = 0; while (i1 < ncolumns1 || i2 < ncolumns2) @@ -890,7 +890,7 @@ record_cmp(FunctionCallInfo fcinfo) errmsg("cannot compare dissimilar column types %s and %s at record column %d", format_type_be(tupdesc1->attrs[i1]->atttypid), format_type_be(tupdesc2->attrs[i2]->atttypid), - j+1))); + j + 1))); /* * Lookup the comparison function if not done already @@ -904,8 +904,8 @@ record_cmp(FunctionCallInfo fcinfo) if (!OidIsValid(typentry->cmp_proc_finfo.fn_oid)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), - errmsg("could not identify a comparison function for type %s", - format_type_be(typentry->type_id)))); + errmsg("could not identify a comparison function for type %s", + format_type_be(typentry->type_id)))); my_extra->columns[j].typentry = typentry; } @@ -957,8 +957,8 @@ record_cmp(FunctionCallInfo fcinfo) /* * If we didn't break out of the loop early, check for column count - * mismatch. (We do not report such mismatch if we found unequal - * column values; is that a feature or a bug?) + * mismatch. (We do not report such mismatch if we found unequal column + * values; is that a feature or a bug?) */ if (result == 0) { @@ -1048,7 +1048,7 @@ record_eq(PG_FUNCTION_ARGS) { fcinfo->flinfo->fn_extra = MemoryContextAlloc(fcinfo->flinfo->fn_mcxt, - sizeof(RecordCompareData) - sizeof(ColumnCompareData) + sizeof(RecordCompareData) - sizeof(ColumnCompareData) + ncols * sizeof(ColumnCompareData)); my_extra = (RecordCompareData *) fcinfo->flinfo->fn_extra; my_extra->ncolumns = ncols; @@ -1080,8 +1080,8 @@ record_eq(PG_FUNCTION_ARGS) /* * Scan corresponding columns, allowing for dropped columns in different - * places in the two rows. i1 and i2 are physical column indexes, - * j is the logical column index. + * places in the two rows. i1 and i2 are physical column indexes, j is + * the logical column index. */ i1 = i2 = j = 0; while (i1 < ncolumns1 || i2 < ncolumns2) @@ -1116,7 +1116,7 @@ record_eq(PG_FUNCTION_ARGS) errmsg("cannot compare dissimilar column types %s and %s at record column %d", format_type_be(tupdesc1->attrs[i1]->atttypid), format_type_be(tupdesc2->attrs[i2]->atttypid), - j+1))); + j + 1))); /* * Lookup the equality function if not done already @@ -1130,8 +1130,8 @@ record_eq(PG_FUNCTION_ARGS) if (!OidIsValid(typentry->eq_opr_finfo.fn_oid)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), - errmsg("could not identify an equality operator for type %s", - format_type_be(typentry->type_id)))); + errmsg("could not identify an equality operator for type %s", + format_type_be(typentry->type_id)))); my_extra->columns[j].typentry = typentry; } @@ -1168,8 +1168,8 @@ record_eq(PG_FUNCTION_ARGS) /* * If we didn't break out of the loop early, check for column count - * mismatch. (We do not report such mismatch if we found unequal - * column values; is that a feature or a bug?) + * mismatch. (We do not report such mismatch if we found unequal column + * values; is that a feature or a bug?) */ if (result) { diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 058899bcc6..f52bf8b5a1 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.299 2009/06/09 14:36:06 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.300 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -176,10 +176,10 @@ static Node *get_rule_sortgroupclause(SortGroupClause *srt, List *tlist, bool force_colno, deparse_context *context); static void get_rule_orderby(List *orderList, List *targetList, - bool force_colno, deparse_context *context); + bool force_colno, deparse_context *context); static void get_rule_windowclause(Query *query, deparse_context *context); static void get_rule_windowspec(WindowClause *wc, List *targetList, - deparse_context *context); + deparse_context *context); static void push_plan(deparse_namespace *dpns, Plan *subplan); static char *get_variable(Var *var, int levelsup, bool showstar, deparse_context *context); @@ -219,7 +219,7 @@ static Node *processIndirection(Node *node, deparse_context *context, static void printSubscripts(ArrayRef *aref, deparse_context *context); static char *generate_relation_name(Oid relid, List *namespaces); static char *generate_function_name(Oid funcid, int nargs, Oid *argtypes, - bool *is_variadic); + bool *is_variadic); static char *generate_operator_name(Oid operid, Oid arg1, Oid arg2); static text *string_to_text(char *str); static char *flatten_reloptions(Oid relid); @@ -1435,8 +1435,8 @@ pg_get_serial_sequence(PG_FUNCTION_ARGS) /* * pg_get_functiondef - * Returns the complete "CREATE OR REPLACE FUNCTION ..." statement for - * the specified function. + * Returns the complete "CREATE OR REPLACE FUNCTION ..." statement for + * the specified function. */ Datum pg_get_functiondef(PG_FUNCTION_ARGS) @@ -1481,8 +1481,8 @@ pg_get_functiondef(PG_FUNCTION_ARGS) lang = (Form_pg_language) GETSTRUCT(langtup); /* - * We always qualify the function name, to ensure the right function - * gets replaced. + * We always qualify the function name, to ensure the right function gets + * replaced. */ nsp = get_namespace_name(proc->pronamespace); appendStringInfo(&buf, "CREATE OR REPLACE FUNCTION %s(", @@ -1533,7 +1533,7 @@ pg_get_functiondef(PG_FUNCTION_ARGS) tmp = SysCacheGetAttr(PROCOID, proctup, Anum_pg_proc_proconfig, &isnull); if (!isnull) { - ArrayType *a = DatumGetArrayTypeP(tmp); + ArrayType *a = DatumGetArrayTypeP(tmp); int i; Assert(ARR_ELEMTYPE(a) == TEXTOID); @@ -1542,7 +1542,7 @@ pg_get_functiondef(PG_FUNCTION_ARGS) for (i = 1; i <= ARR_DIMS(a)[0]; i++) { - Datum d; + Datum d; d = array_ref(a, 1, &i, -1 /* varlenarray */ , @@ -1595,9 +1595,9 @@ pg_get_functiondef(PG_FUNCTION_ARGS) /* * We always use dollar quoting. Figure out a suitable delimiter. * - * Since the user is likely to be editing the function body string, - * we shouldn't use a short delimiter that he might easily create a - * conflict with. Hence prefer "$function$", but extend if needed. + * Since the user is likely to be editing the function body string, we + * shouldn't use a short delimiter that he might easily create a conflict + * with. Hence prefer "$function$", but extend if needed. */ initStringInfo(&dq); appendStringInfoString(&dq, "$function"); @@ -1771,8 +1771,8 @@ print_function_arguments(StringInfo buf, HeapTuple proctup, &isnull); if (!isnull) { - char *str; - List *argdefaults; + char *str; + List *argdefaults; str = TextDatumGetCString(proargdefaults); argdefaults = (List *) stringToNode(str); @@ -1788,11 +1788,11 @@ print_function_arguments(StringInfo buf, HeapTuple proctup, inputargno = 0; for (i = 0; i < numargs; i++) { - Oid argtype = argtypes[i]; - char *argname = argnames ? argnames[i] : NULL; - char argmode = argmodes ? argmodes[i] : PROARGMODE_IN; + Oid argtype = argtypes[i]; + char *argname = argnames ? argnames[i] : NULL; + char argmode = argmodes ? argmodes[i] : PROARGMODE_IN; const char *modename; - bool isinput; + bool isinput; switch (argmode) { @@ -1818,7 +1818,7 @@ print_function_arguments(StringInfo buf, HeapTuple proctup, break; default: elog(ERROR, "invalid parameter mode '%c'", argmode); - modename = NULL; /* keep compiler quiet */ + modename = NULL; /* keep compiler quiet */ isinput = false; break; } @@ -1836,7 +1836,7 @@ print_function_arguments(StringInfo buf, HeapTuple proctup, appendStringInfoString(buf, format_type_be(argtype)); if (print_defaults && isinput && inputargno > nlackdefaults) { - Node *expr; + Node *expr; Assert(nextargdefault != NULL); expr = (Node *) lfirst(nextargdefault); @@ -1949,7 +1949,7 @@ deparse_context_for(const char *aliasname, Oid relid) * right child plans. A special case is that a nestloop inner indexscan * might have OUTER Vars, but the outer side of the join is not a child * plan node. To handle such cases the outer plan node must be passed - * separately. (Pass NULL for outer_plan otherwise.) + * separately. (Pass NULL for outer_plan otherwise.) * * Note: plan and outer_plan really ought to be declared as "Plan *", but * we use "Node *" to avoid having to include plannodes.h in builtins.h. @@ -2370,8 +2370,8 @@ static void get_with_clause(Query *query, deparse_context *context) { StringInfo buf = context->buf; - const char *sep; - ListCell *l; + const char *sep; + ListCell *l; if (query->cteList == NIL) return; @@ -2808,11 +2808,11 @@ get_rule_sortgroupclause(SortGroupClause *srt, List *tlist, bool force_colno, /* * Use column-number form if requested by caller. Otherwise, if - * expression is a constant, force it to be dumped with an explicit - * cast as decoration --- this is because a simple integer constant - * is ambiguous (and will be misinterpreted by findTargetlistEntry()) - * if we dump it without any decoration. Otherwise, just dump the - * expression normally. + * expression is a constant, force it to be dumped with an explicit cast + * as decoration --- this is because a simple integer constant is + * ambiguous (and will be misinterpreted by findTargetlistEntry()) if we + * dump it without any decoration. Otherwise, just dump the expression + * normally. */ if (force_colno) { @@ -3328,7 +3328,7 @@ push_plan(deparse_namespace *dpns, Plan *subplan) dpns->inner_plan = ((SubqueryScan *) subplan)->subplan; else if (IsA(subplan, CteScan)) { - int ctePlanId = ((CteScan *) subplan)->ctePlanId; + int ctePlanId = ((CteScan *) subplan)->ctePlanId; if (ctePlanId > 0 && ctePlanId <= list_length(dpns->subplans)) dpns->inner_plan = list_nth(dpns->subplans, ctePlanId - 1); @@ -3555,7 +3555,7 @@ get_name_for_var_field(Var *var, int fieldno, */ if (IsA(var, RowExpr)) { - RowExpr *r = (RowExpr *) var; + RowExpr *r = (RowExpr *) var; if (fieldno > 0 && fieldno <= list_length(r->colnames)) return strVal(list_nth(r->colnames, fieldno - 1)); @@ -3659,8 +3659,8 @@ get_name_for_var_field(Var *var, int fieldno, * This part has essentially the same logic as the parser's * expandRecordVariable() function, but we are dealing with a different * representation of the input context, and we only need one field name - * not a TupleDesc. Also, we need special cases for finding subquery - * and CTE subplans when deparsing Plan trees. + * not a TupleDesc. Also, we need special cases for finding subquery and + * CTE subplans when deparsing Plan trees. */ expr = (Node *) var; /* default if we can't drill down */ @@ -3721,10 +3721,10 @@ get_name_for_var_field(Var *var, int fieldno, { /* * We're deparsing a Plan tree so we don't have complete - * RTE entries (in particular, rte->subquery is NULL). - * But the only place we'd see a Var directly referencing - * a SUBQUERY RTE is in a SubqueryScan plan node, and we - * can look into the child plan's tlist instead. + * RTE entries (in particular, rte->subquery is NULL). But + * the only place we'd see a Var directly referencing a + * SUBQUERY RTE is in a SubqueryScan plan node, and we can + * look into the child plan's tlist instead. */ TargetEntry *tle; Plan *save_outer; @@ -3811,11 +3811,11 @@ get_name_for_var_field(Var *var, int fieldno, if (IsA(expr, Var)) { /* - * Recurse into the CTE to see what its Var refers - * to. We have to build an additional level of - * namespace to keep in step with varlevelsup in the - * CTE. Furthermore it could be an outer CTE, so - * we may have to delete some levels of namespace. + * Recurse into the CTE to see what its Var refers to. + * We have to build an additional level of namespace + * to keep in step with varlevelsup in the CTE. + * Furthermore it could be an outer CTE, so we may + * have to delete some levels of namespace. */ List *save_nslist = context->namespaces; List *new_nslist; @@ -3845,8 +3845,8 @@ get_name_for_var_field(Var *var, int fieldno, /* * We're deparsing a Plan tree so we don't have a CTE * list. But the only place we'd see a Var directly - * referencing a CTE RTE is in a CteScan plan node, and - * we can look into the subplan's tlist instead. + * referencing a CTE RTE is in a CteScan plan node, and we + * can look into the subplan's tlist instead. */ TargetEntry *tle; Plan *save_outer; @@ -4428,11 +4428,11 @@ get_rule_expr(Node *node, deparse_context *context, case T_SubPlan: { - SubPlan *subplan = (SubPlan *) node; + SubPlan *subplan = (SubPlan *) node; /* * We cannot see an already-planned subplan in rule deparsing, - * only while EXPLAINing a query plan. We don't try to + * only while EXPLAINing a query plan. We don't try to * reconstruct the original SQL, just reference the subplan * that appears elsewhere in EXPLAIN's result. */ @@ -4452,7 +4452,7 @@ get_rule_expr(Node *node, deparse_context *context, appendStringInfo(buf, "(alternatives: "); foreach(lc, asplan->subplans) { - SubPlan *splan = (SubPlan *) lfirst(lc); + SubPlan *splan = (SubPlan *) lfirst(lc); Assert(IsA(splan, SubPlan)); if (splan->useHashTable) @@ -4675,6 +4675,7 @@ get_rule_expr(Node *node, deparse_context *context, appendStringInfo(buf, "ARRAY["); get_rule_expr((Node *) arrayexpr->elements, context, true); appendStringInfoChar(buf, ']'); + /* * If the array isn't empty, we assume its elements are * coerced to the desired type. If it's empty, though, we @@ -4682,7 +4683,7 @@ get_rule_expr(Node *node, deparse_context *context, */ if (arrayexpr->elements == NIL) appendStringInfo(buf, "::%s", - format_type_with_typemod(arrayexpr->array_typeid, -1)); + format_type_with_typemod(arrayexpr->array_typeid, -1)); } break; @@ -5333,9 +5334,10 @@ get_windowfunc_expr(WindowFunc *wfunc, deparse_context *context) if (context->windowClause) elog(ERROR, "could not find window clause for winref %u", wfunc->winref); + /* - * In EXPLAIN, we don't have window context information available, - * so we have to settle for this: + * In EXPLAIN, we don't have window context information available, so + * we have to settle for this: */ appendStringInfoString(buf, "(?)"); } @@ -5523,9 +5525,9 @@ simple_quote_literal(StringInfo buf, const char *val) const char *valptr; /* - * We form the string literal according to the prevailing setting - * of standard_conforming_strings; we never use E''. User is - * responsible for making sure result is used correctly. + * We form the string literal according to the prevailing setting of + * standard_conforming_strings; we never use E''. User is responsible for + * making sure result is used correctly. */ appendStringInfoChar(buf, '\''); for (valptr = val; *valptr; valptr++) @@ -6335,7 +6337,7 @@ generate_relation_name(Oid relid, List *namespaces) * given that it is being called with the specified actual arg types. * (Arg types matter because of ambiguous-function resolution rules.) * - * The result includes all necessary quoting and schema-prefixing. We can + * The result includes all necessary quoting and schema-prefixing. We can * also pass back an indication of whether the function is variadic. */ static char * diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index 3f07db6857..3d60885a79 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.260 2009/04/19 19:46:33 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.261 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -72,7 +72,7 @@ * float8 oprjoin (internal, oid, internal, int2, internal); * * (Before Postgres 8.4, join estimators had only the first four of these - * parameters. That signature is still allowed, but deprecated.) The + * parameters. That signature is still allowed, but deprecated.) The * relationship between jointype and sjinfo is explained in the comments for * clause_selectivity() --- the short version is that jointype is usually * best ignored in favor of examining sjinfo. @@ -135,7 +135,7 @@ static double ineq_histogram_selectivity(VariableStatData *vardata, static double eqjoinsel_inner(Oid operator, VariableStatData *vardata1, VariableStatData *vardata2); static double eqjoinsel_semi(Oid operator, - VariableStatData *vardata1, VariableStatData *vardata2); + VariableStatData *vardata1, VariableStatData *vardata2); static bool convert_to_scalar(Datum value, Oid valuetypid, double *scaledvalue, Datum lobound, Datum hibound, Oid boundstypid, double *scaledlobound, double *scaledhibound); @@ -159,7 +159,7 @@ static double convert_one_bytea_to_scalar(unsigned char *value, int valuelen, static char *convert_string_datum(Datum value, Oid typid); static double convert_timevalue_to_scalar(Datum value, Oid typid); static bool get_variable_range(PlannerInfo *root, VariableStatData *vardata, - Oid sortop, Datum *min, Datum *max); + Oid sortop, Datum *min, Datum *max); static Selectivity prefix_selectivity(VariableStatData *vardata, Oid vartype, Oid opfamily, Const *prefixcon); static Selectivity pattern_selectivity(Const *patt, Pattern_Type ptype); @@ -228,17 +228,17 @@ var_eq_const(VariableStatData *vardata, Oid operator, double selec; /* - * If the constant is NULL, assume operator is strict and - * return zero, ie, operator will never return TRUE. + * If the constant is NULL, assume operator is strict and return zero, ie, + * operator will never return TRUE. */ if (constisnull) return 0.0; /* * If we matched the var to a unique index, assume there is exactly one - * match regardless of anything else. (This is slightly bogus, since - * the index's equality operator might be different from ours, but it's - * more likely to be right than ignoring the information.) + * match regardless of anything else. (This is slightly bogus, since the + * index's equality operator might be different from ours, but it's more + * likely to be right than ignoring the information.) */ if (vardata->isunique && vardata->rel && vardata->rel->tuples >= 1.0) return 1.0 / vardata->rel->tuples; @@ -257,10 +257,10 @@ var_eq_const(VariableStatData *vardata, Oid operator, /* * Is the constant "=" to any of the column's most common values? - * (Although the given operator may not really be "=", we will - * assume that seeing whether it returns TRUE is an appropriate - * test. If you don't like this, maybe you shouldn't be using - * eqsel for your operator...) + * (Although the given operator may not really be "=", we will assume + * that seeing whether it returns TRUE is an appropriate test. If you + * don't like this, maybe you shouldn't be using eqsel for your + * operator...) */ if (get_attstatsslot(vardata->statsTuple, vardata->atttype, vardata->atttypmod, @@ -299,17 +299,16 @@ var_eq_const(VariableStatData *vardata, Oid operator, { /* * Constant is "=" to this common value. We know selectivity - * exactly (or as exactly as ANALYZE could calculate it, - * anyway). + * exactly (or as exactly as ANALYZE could calculate it, anyway). */ selec = numbers[i]; } else { /* - * Comparison is against a constant that is neither NULL nor - * any of the common values. Its selectivity cannot be more - * than this: + * Comparison is against a constant that is neither NULL nor any + * of the common values. Its selectivity cannot be more than + * this: */ double sumcommon = 0.0; double otherdistinct; @@ -320,18 +319,17 @@ var_eq_const(VariableStatData *vardata, Oid operator, CLAMP_PROBABILITY(selec); /* - * and in fact it's probably a good deal less. We approximate - * that all the not-common values share this remaining - * fraction equally, so we divide by the number of other - * distinct values. + * and in fact it's probably a good deal less. We approximate that + * all the not-common values share this remaining fraction + * equally, so we divide by the number of other distinct values. */ otherdistinct = get_variable_numdistinct(vardata) - nnumbers; if (otherdistinct > 1) selec /= otherdistinct; /* - * Another cross-check: selectivity shouldn't be estimated as - * more than the least common "most common value". + * Another cross-check: selectivity shouldn't be estimated as more + * than the least common "most common value". */ if (nnumbers > 0 && selec > numbers[nnumbers - 1]) selec = numbers[nnumbers - 1]; @@ -368,9 +366,9 @@ var_eq_non_const(VariableStatData *vardata, Oid operator, /* * If we matched the var to a unique index, assume there is exactly one - * match regardless of anything else. (This is slightly bogus, since - * the index's equality operator might be different from ours, but it's - * more likely to be right than ignoring the information.) + * match regardless of anything else. (This is slightly bogus, since the + * index's equality operator might be different from ours, but it's more + * likely to be right than ignoring the information.) */ if (vardata->isunique && vardata->rel && vardata->rel->tuples >= 1.0) return 1.0 / vardata->rel->tuples; @@ -391,8 +389,8 @@ var_eq_non_const(VariableStatData *vardata, Oid operator, * result averaged over all possible values whether common or * uncommon. (Essentially, we are assuming that the not-yet-known * comparison value is equally likely to be any of the possible - * values, regardless of their frequency in the table. Is that a - * good idea?) + * values, regardless of their frequency in the table. Is that a good + * idea?) */ selec = 1.0 - stats->stanullfrac; ndistinct = get_variable_numdistinct(vardata); @@ -400,8 +398,8 @@ var_eq_non_const(VariableStatData *vardata, Oid operator, selec /= ndistinct; /* - * Cross-check: selectivity should never be estimated as more than - * the most common value's. + * Cross-check: selectivity should never be estimated as more than the + * most common value's. */ if (get_attstatsslot(vardata->statsTuple, vardata->atttype, vardata->atttypmod, @@ -610,7 +608,7 @@ mcv_selectivity(VariableStatData *vardata, FmgrInfo *opproc, * essentially using the histogram just as a representative sample. However, * small histograms are unlikely to be all that representative, so the caller * should be prepared to fall back on some other estimation approach when the - * histogram is missing or very small. It may also be prudent to combine this + * histogram is missing or very small. It may also be prudent to combine this * approach with another one when the histogram is small. * * If the actual histogram size is not at least min_hist_size, we won't bother @@ -1169,7 +1167,8 @@ patternsel(PG_FUNCTION_ARGS, Pattern_Type ptype, bool negate) * selectivity of the fixed prefix and remainder of pattern * separately, then combine the two to get an estimate of the * selectivity for the part of the column population represented by - * the histogram. (For small histograms, we combine these approaches.) + * the histogram. (For small histograms, we combine these + * approaches.) * * We then add up data for any most-common-values values; these are * not in the histogram population, and we can get exact answers for @@ -1205,7 +1204,7 @@ patternsel(PG_FUNCTION_ARGS, Pattern_Type ptype, bool negate) restsel = pattern_selectivity(rest, ptype); heursel = prefixsel * restsel; - if (selec < 0) /* fewer than 10 histogram entries? */ + if (selec < 0) /* fewer than 10 histogram entries? */ selec = heursel; else { @@ -1214,7 +1213,7 @@ patternsel(PG_FUNCTION_ARGS, Pattern_Type ptype, bool negate) * histogram and heuristic selectivities, putting increasingly * more trust in the histogram for larger sizes. */ - double hist_weight = hist_size / 100.0; + double hist_weight = hist_size / 100.0; selec = selec * hist_weight + heursel * (1.0 - hist_weight); } @@ -1863,22 +1862,22 @@ rowcomparesel(PlannerInfo *root, /* * Decide if it's a join clause. This should match clausesel.c's - * treat_as_join_clause(), except that we intentionally consider only - * the leading columns and not the rest of the clause. + * treat_as_join_clause(), except that we intentionally consider only the + * leading columns and not the rest of the clause. */ if (varRelid != 0) { /* - * Caller is forcing restriction mode (eg, because we are examining - * an inner indexscan qual). + * Caller is forcing restriction mode (eg, because we are examining an + * inner indexscan qual). */ is_join_clause = false; } else if (sjinfo == NULL) { /* - * It must be a restriction clause, since it's being evaluated at - * a scan node. + * It must be a restriction clause, since it's being evaluated at a + * scan node. */ is_join_clause = false; } @@ -1918,6 +1917,7 @@ eqjoinsel(PG_FUNCTION_ARGS) PlannerInfo *root = (PlannerInfo *) PG_GETARG_POINTER(0); Oid operator = PG_GETARG_OID(1); List *args = (List *) PG_GETARG_POINTER(2); + #ifdef NOT_USED JoinType jointype = (JoinType) PG_GETARG_INT16(3); #endif @@ -2163,11 +2163,11 @@ eqjoinsel_inner(Oid operator, * end up with the same answer anyway. * * An additional hack we use here is to clamp the nd1 and nd2 values - * to not more than what we are estimating the input relation sizes - * to be, providing a crude correction for the selectivity of - * restriction clauses on those relations. (We don't do that in the - * other path since there we are comparing the nd values to stats for - * the whole relations.) + * to not more than what we are estimating the input relation sizes to + * be, providing a crude correction for the selectivity of restriction + * clauses on those relations. (We don't do that in the other path + * since there we are comparing the nd values to stats for the whole + * relations.) */ double nullfrac1 = stats1 ? stats1->stanullfrac : 0.0; double nullfrac2 = stats2 ? stats2->stanullfrac : 0.0; @@ -2307,13 +2307,13 @@ eqjoinsel_semi(Oid operator, /* * Now we need to estimate the fraction of relation 1 that has at - * least one join partner. We know for certain that the matched - * MCVs do, so that gives us a lower bound, but we're really in the - * dark about everything else. Our crude approach is: if nd1 <= nd2 - * then assume all non-null rel1 rows have join partners, else assume - * for the uncertain rows that a fraction nd2/nd1 have join partners. - * We can discount the known-matched MCVs from the distinct-values - * counts before doing the division. + * least one join partner. We know for certain that the matched MCVs + * do, so that gives us a lower bound, but we're really in the dark + * about everything else. Our crude approach is: if nd1 <= nd2 then + * assume all non-null rel1 rows have join partners, else assume for + * the uncertain rows that a fraction nd2/nd1 have join partners. We + * can discount the known-matched MCVs from the distinct-values counts + * before doing the division. */ nd1 -= nmatches; nd2 -= nmatches; @@ -2321,10 +2321,10 @@ eqjoinsel_semi(Oid operator, selec = Max(matchfreq1, 1.0 - nullfrac1); else { - double uncertain = 1.0 - matchfreq1 - nullfrac1; + double uncertain = 1.0 - matchfreq1 - nullfrac1; CLAMP_PROBABILITY(uncertain); - selec = matchfreq1 + (nd2/nd1) * uncertain; + selec = matchfreq1 + (nd2 / nd1) * uncertain; } } else @@ -2343,7 +2343,7 @@ eqjoinsel_semi(Oid operator, if (nd1 <= nd2 || nd2 <= 0) selec = 1.0 - nullfrac1; else - selec = (nd2/nd1) * (1.0 - nullfrac1); + selec = (nd2 / nd1) * (1.0 - nullfrac1); } if (have_mcvs1) @@ -2572,8 +2572,8 @@ mergejoinscansel(PlannerInfo *root, Node *clause, * Look up the various operators we need. If we don't find them all, it * probably means the opfamily is broken, but we just fail silently. * - * Note: we expect that pg_statistic histograms will be sorted by the - * '<' operator, regardless of which sort direction we are considering. + * Note: we expect that pg_statistic histograms will be sorted by the '<' + * operator, regardless of which sort direction we are considering. */ switch (strategy) { @@ -2721,9 +2721,9 @@ mergejoinscansel(PlannerInfo *root, Node *clause, /* * Only one of the two "end" fractions can really be less than 1.0; - * believe the smaller estimate and reset the other one to exactly 1.0. - * If we get exactly equal estimates (as can easily happen with - * self-joins), believe neither. + * believe the smaller estimate and reset the other one to exactly 1.0. If + * we get exactly equal estimates (as can easily happen with self-joins), + * believe neither. */ if (*leftend > *rightend) *leftend = 1.0; @@ -2733,8 +2733,8 @@ mergejoinscansel(PlannerInfo *root, Node *clause, *leftend = *rightend = 1.0; /* - * Also, the fraction of the left variable that will be scanned before - * the first join pair is found is the fraction that's < the right-side + * Also, the fraction of the left variable that will be scanned before the + * first join pair is found is the fraction that's < the right-side * minimum value. But only believe non-default estimates, else stick with * our own default. */ @@ -2751,9 +2751,9 @@ mergejoinscansel(PlannerInfo *root, Node *clause, /* * Only one of the two "start" fractions can really be more than zero; - * believe the larger estimate and reset the other one to exactly 0.0. - * If we get exactly equal estimates (as can easily happen with - * self-joins), believe neither. + * believe the larger estimate and reset the other one to exactly 0.0. If + * we get exactly equal estimates (as can easily happen with self-joins), + * believe neither. */ if (*leftstart < *rightstart) *leftstart = 0.0; @@ -2764,8 +2764,8 @@ mergejoinscansel(PlannerInfo *root, Node *clause, /* * If the sort order is nulls-first, we're going to have to skip over any - * nulls too. These would not have been counted by scalarineqsel, and - * we can safely add in this fraction regardless of whether we believe + * nulls too. These would not have been counted by scalarineqsel, and we + * can safely add in this fraction regardless of whether we believe * scalarineqsel's results or not. But be sure to clamp the sum to 1.0! */ if (nulls_first) @@ -2898,7 +2898,7 @@ add_unique_group_var(PlannerInfo *root, List *varinfos, * is as follows: * 1. Expressions yielding boolean are assumed to contribute two groups, * independently of their content, and are ignored in the subsequent - * steps. This is mainly because tests like "col IS NULL" break the + * steps. This is mainly because tests like "col IS NULL" break the * heuristic used in step 2 especially badly. * 2. Reduce the given expressions to a list of unique Vars used. For * example, GROUP BY a, a + b is treated the same as GROUP BY a, b. @@ -2946,7 +2946,7 @@ estimate_num_groups(PlannerInfo *root, List *groupExprs, double input_rows) Assert(groupExprs != NIL); /* - * Count groups derived from boolean grouping expressions. For other + * Count groups derived from boolean grouping expressions. For other * expressions, find the unique Vars used, treating an expression as a Var * if we can find stats for it. For each one, record the statistical * estimate of number of distinct values (total in its table, without @@ -3655,7 +3655,9 @@ convert_string_datum(Datum value, Oid typid) #if _MSC_VER == 1400 /* VS.Net 2005 */ /* - * http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99694 + * + * http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx? + * FeedbackID=99694 */ { char x[1]; @@ -3958,10 +3960,10 @@ get_join_variables(PlannerInfo *root, List *args, SpecialJoinInfo *sjinfo, if (vardata1->rel && bms_is_subset(vardata1->rel->relids, sjinfo->syn_righthand)) - *join_is_reversed = true; /* var1 is on RHS */ + *join_is_reversed = true; /* var1 is on RHS */ else if (vardata2->rel && bms_is_subset(vardata2->rel->relids, sjinfo->syn_lefthand)) - *join_is_reversed = true; /* var2 is on LHS */ + *join_is_reversed = true; /* var2 is on LHS */ else *join_is_reversed = false; } @@ -4036,8 +4038,8 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid, (*get_relation_stats_hook) (root, rte, var->varattno, vardata)) { /* - * The hook took control of acquiring a stats tuple. If it - * did supply a tuple, it'd better have supplied a freefunc. + * The hook took control of acquiring a stats tuple. If it did + * supply a tuple, it'd better have supplied a freefunc. */ if (HeapTupleIsValid(vardata->statsTuple) && !vardata->freefunc) @@ -4169,10 +4171,10 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid, /* * Has it got stats? We only consider stats for - * non-partial indexes, since partial indexes - * probably don't reflect whole-relation statistics; - * the above check for uniqueness is the only info - * we take from a partial index. + * non-partial indexes, since partial indexes probably + * don't reflect whole-relation statistics; the above + * check for uniqueness is the only info we take from + * a partial index. * * An index stats hook, however, must make its own * decisions about what to do with partial indexes. @@ -4194,7 +4196,7 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid, { vardata->statsTuple = SearchSysCache(STATRELATT, - ObjectIdGetDatum(index->indexoid), + ObjectIdGetDatum(index->indexoid), Int16GetDatum(pos + 1), 0, 0); vardata->freefunc = ReleaseSysCache; @@ -4281,9 +4283,9 @@ get_variable_numdistinct(VariableStatData *vardata) /* * If there is a unique index for the variable, assume it is unique no - * matter what pg_statistic says; the statistics could be out of date, - * or we might have found a partial unique index that proves the var - * is unique for this query. + * matter what pg_statistic says; the statistics could be out of date, or + * we might have found a partial unique index that proves the var is + * unique for this query. */ if (vardata->isunique) stadistinct = -1.0; @@ -4817,7 +4819,7 @@ prefix_selectivity(VariableStatData *vardata, Oid cmpopr; FmgrInfo opproc; Const *greaterstrcon; - Selectivity eq_sel; + Selectivity eq_sel; cmpopr = get_opfamily_member(opfamily, vartype, vartype, BTGreaterEqualStrategyNumber); @@ -4868,17 +4870,17 @@ prefix_selectivity(VariableStatData *vardata, } /* - * If the prefix is long then the two bounding values might be too - * close together for the histogram to distinguish them usefully, - * resulting in a zero estimate (plus or minus roundoff error). - * To avoid returning a ridiculously small estimate, compute the - * estimated selectivity for "variable = 'foo'", and clamp to that. - * (Obviously, the resultant estimate should be at least that.) + * If the prefix is long then the two bounding values might be too close + * together for the histogram to distinguish them usefully, resulting in a + * zero estimate (plus or minus roundoff error). To avoid returning a + * ridiculously small estimate, compute the estimated selectivity for + * "variable = 'foo'", and clamp to that. (Obviously, the resultant + * estimate should be at least that.) * * We apply this even if we couldn't make a greater string. That case * suggests that the prefix is near the maximum possible, and thus - * probably off the end of the histogram, and thus we probably got a - * very small estimate from the >= condition; so we still need to clamp. + * probably off the end of the histogram, and thus we probably got a very + * small estimate from the >= condition; so we still need to clamp. */ cmpopr = get_opfamily_member(opfamily, vartype, vartype, BTEqualStrategyNumber); diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c index 3fb4ebe285..f4687d4ea9 100644 --- a/src/backend/utils/adt/timestamp.c +++ b/src/backend/utils/adt/timestamp.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.200 2009/06/01 23:55:15 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.201 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -43,6 +43,7 @@ /* Set at postmaster start */ TimestampTz PgStartTime; + /* Set at configuration reload */ TimestampTz PgReloadTime; @@ -56,8 +57,8 @@ typedef struct typedef struct { - TimestampTz current; - TimestampTz finish; + TimestampTz current; + TimestampTz finish; Interval step; int step_sign; } generate_series_timestamptz_fctx; @@ -631,7 +632,7 @@ interval_in(PG_FUNCTION_ARGS) /* if those functions think it's a bad format, try ISO8601 style */ if (dterr == DTERR_BAD_FORMAT) - dterr = DecodeISO8601Interval(str, + dterr = DecodeISO8601Interval(str, &dtype, tm, &fsec); if (dterr != 0) @@ -750,7 +751,7 @@ intervaltypmodin(PG_FUNCTION_ARGS) tl = ArrayGetIntegerTypmods(ta, &n); /* - * tl[0] - interval range (fields bitmask) tl[1] - precision (optional) + * tl[0] - interval range (fields bitmask) tl[1] - precision (optional) * * Note we must validate tl[0] even though it's normally guaranteed * correct by the grammar --- consider SELECT 'foo'::"interval"(1000). @@ -963,22 +964,22 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod) int precision = INTERVAL_PRECISION(typmod); /* - * Our interpretation of intervals with a limited set of fields - * is that fields to the right of the last one specified are zeroed - * out, but those to the left of it remain valid. Thus for example - * there is no operational difference between INTERVAL YEAR TO MONTH - * and INTERVAL MONTH. In some cases we could meaningfully enforce - * that higher-order fields are zero; for example INTERVAL DAY could - * reject nonzero "month" field. However that seems a bit pointless - * when we can't do it consistently. (We cannot enforce a range limit - * on the highest expected field, since we do not have any equivalent - * of SQL's <interval leading field precision>.) + * Our interpretation of intervals with a limited set of fields is + * that fields to the right of the last one specified are zeroed out, + * but those to the left of it remain valid. Thus for example there + * is no operational difference between INTERVAL YEAR TO MONTH and + * INTERVAL MONTH. In some cases we could meaningfully enforce that + * higher-order fields are zero; for example INTERVAL DAY could reject + * nonzero "month" field. However that seems a bit pointless when we + * can't do it consistently. (We cannot enforce a range limit on the + * highest expected field, since we do not have any equivalent of + * SQL's <interval leading field precision>.) * * Note: before PG 8.4 we interpreted a limited set of fields as * actually causing a "modulo" operation on a given value, potentially - * losing high-order as well as low-order information. But there is + * losing high-order as well as low-order information. But there is * no support for such behavior in the standard, and it seems fairly - * undesirable on data consistency grounds anyway. Now we only + * undesirable on data consistency grounds anyway. Now we only * perform truncation or rounding of low-order fields. */ if (range == INTERVAL_FULL_RANGE) @@ -1137,7 +1138,7 @@ EncodeSpecialTimestamp(Timestamp dt, char *str) strcpy(str, EARLY); else if (TIMESTAMP_IS_NOEND(dt)) strcpy(str, LATE); - else /* shouldn't happen */ + else /* shouldn't happen */ elog(ERROR, "invalid argument for EncodeSpecialTimestamp"); } @@ -4394,7 +4395,7 @@ timestamp_zone(PG_FUNCTION_ARGS) PG_RETURN_TIMESTAMPTZ(timestamp); /* - * Look up the requested timezone. First we look in the date token table + * Look up the requested timezone. First we look in the date token table * (to handle cases like "EST"), and if that fails, we look in the * timezone database (to handle cases like "America/New_York"). (This * matches the order in which timestamp input checks the cases; it's @@ -4438,7 +4439,7 @@ timestamp_zone(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("time zone \"%s\" not recognized", tzname))); - result = 0; /* keep compiler quiet */ + result = 0; /* keep compiler quiet */ } } @@ -4568,7 +4569,7 @@ timestamptz_zone(PG_FUNCTION_ARGS) PG_RETURN_TIMESTAMP(timestamp); /* - * Look up the requested timezone. First we look in the date token table + * Look up the requested timezone. First we look in the date token table * (to handle cases like "EST"), and if that fails, we look in the * timezone database (to handle cases like "America/New_York"). (This * matches the order in which timestamp input checks the cases; it's @@ -4611,7 +4612,7 @@ timestamptz_zone(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("time zone \"%s\" not recognized", tzname))); - result = 0; /* keep compiler quiet */ + result = 0; /* keep compiler quiet */ } } @@ -4659,16 +4660,16 @@ generate_series_timestamp(PG_FUNCTION_ARGS) { FuncCallContext *funcctx; generate_series_timestamp_fctx *fctx; - Timestamp result; + Timestamp result; /* stuff done only on the first call of the function */ if (SRF_IS_FIRSTCALL()) { - Timestamp start = PG_GETARG_TIMESTAMP(0); - Timestamp finish = PG_GETARG_TIMESTAMP(1); - Interval *step = PG_GETARG_INTERVAL_P(2); + Timestamp start = PG_GETARG_TIMESTAMP(0); + Timestamp finish = PG_GETARG_TIMESTAMP(1); + Interval *step = PG_GETARG_INTERVAL_P(2); MemoryContext oldcontext; - Interval interval_zero; + Interval interval_zero; /* create a function context for cross-call persistence */ funcctx = SRF_FIRSTCALL_INIT(); @@ -4718,9 +4719,9 @@ generate_series_timestamp(PG_FUNCTION_ARGS) { /* increment current in preparation for next iteration */ fctx->current = DatumGetTimestamp( - DirectFunctionCall2(timestamp_pl_interval, - TimestampGetDatum(fctx->current), - PointerGetDatum(&fctx->step))); + DirectFunctionCall2(timestamp_pl_interval, + TimestampGetDatum(fctx->current), + PointerGetDatum(&fctx->step))); /* do when there is more left to send */ SRF_RETURN_NEXT(funcctx, TimestampGetDatum(result)); @@ -4747,9 +4748,9 @@ generate_series_timestamptz(PG_FUNCTION_ARGS) { TimestampTz start = PG_GETARG_TIMESTAMPTZ(0); TimestampTz finish = PG_GETARG_TIMESTAMPTZ(1); - Interval *step = PG_GETARG_INTERVAL_P(2); + Interval *step = PG_GETARG_INTERVAL_P(2); MemoryContext oldcontext; - Interval interval_zero; + Interval interval_zero; /* create a function context for cross-call persistence */ funcctx = SRF_FIRSTCALL_INIT(); @@ -4799,9 +4800,9 @@ generate_series_timestamptz(PG_FUNCTION_ARGS) { /* increment current in preparation for next iteration */ fctx->current = DatumGetTimestampTz( - DirectFunctionCall2(timestamptz_pl_interval, - TimestampTzGetDatum(fctx->current), - PointerGetDatum(&fctx->step))); + DirectFunctionCall2(timestamptz_pl_interval, + TimestampTzGetDatum(fctx->current), + PointerGetDatum(&fctx->step))); /* do when there is more left to send */ SRF_RETURN_NEXT(funcctx, TimestampTzGetDatum(result)); diff --git a/src/backend/utils/adt/trigfuncs.c b/src/backend/utils/adt/trigfuncs.c index b34046a7c3..380d174a6a 100644 --- a/src/backend/utils/adt/trigfuncs.c +++ b/src/backend/utils/adt/trigfuncs.c @@ -1,13 +1,13 @@ /*------------------------------------------------------------------------- * * trigfuncs.c - * Builtin functions for useful trigger support. + * Builtin functions for useful trigger support. * * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/utils/adt/trigfuncs.c,v 1.6 2009/01/01 17:23:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/trigfuncs.c,v 1.7 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -27,61 +27,64 @@ Datum suppress_redundant_updates_trigger(PG_FUNCTION_ARGS) { - TriggerData *trigdata = (TriggerData *) fcinfo->context; - HeapTuple newtuple, oldtuple, rettuple; - HeapTupleHeader newheader, oldheader; + TriggerData *trigdata = (TriggerData *) fcinfo->context; + HeapTuple newtuple, + oldtuple, + rettuple; + HeapTupleHeader newheader, + oldheader; - /* make sure it's called as a trigger */ - if (!CALLED_AS_TRIGGER(fcinfo)) - ereport(ERROR, + /* make sure it's called as a trigger */ + if (!CALLED_AS_TRIGGER(fcinfo)) + ereport(ERROR, (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED), errmsg("suppress_redundant_updates_trigger: must be called as trigger"))); - - /* and that it's called on update */ - if (! TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event)) - ereport(ERROR, + + /* and that it's called on update */ + if (!TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event)) + ereport(ERROR, (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED), errmsg("suppress_redundant_updates_trigger: must be called on update"))); - /* and that it's called before update */ - if (! TRIGGER_FIRED_BEFORE(trigdata->tg_event)) - ereport(ERROR, + /* and that it's called before update */ + if (!TRIGGER_FIRED_BEFORE(trigdata->tg_event)) + ereport(ERROR, (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED), errmsg("suppress_redundant_updates_trigger: must be called before update"))); - /* and that it's called for each row */ - if (! TRIGGER_FIRED_FOR_ROW(trigdata->tg_event)) - ereport(ERROR, + /* and that it's called for each row */ + if (!TRIGGER_FIRED_FOR_ROW(trigdata->tg_event)) + ereport(ERROR, (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED), errmsg("suppress_redundant_updates_trigger: must be called for each row"))); /* get tuple data, set default result */ - rettuple = newtuple = trigdata->tg_newtuple; + rettuple = newtuple = trigdata->tg_newtuple; oldtuple = trigdata->tg_trigtuple; newheader = newtuple->t_data; oldheader = oldtuple->t_data; /* - * We are called before the OID, if any, has been transcribed from the - * old tuple to the new (in heap_update). To avoid a bogus compare - * failure, copy the OID now. But check that someone didn't already put - * another OID value into newtuple. (That's not actually possible at - * present, but maybe someday.) + * We are called before the OID, if any, has been transcribed from the old + * tuple to the new (in heap_update). To avoid a bogus compare failure, + * copy the OID now. But check that someone didn't already put another + * OID value into newtuple. (That's not actually possible at present, but + * maybe someday.) */ - if (trigdata->tg_relation->rd_rel->relhasoids && + if (trigdata->tg_relation->rd_rel->relhasoids && !OidIsValid(HeapTupleHeaderGetOid(newheader))) HeapTupleHeaderSetOid(newheader, HeapTupleHeaderGetOid(oldheader)); /* if the tuple payload is the same ... */ - if (newtuple->t_len == oldtuple->t_len && + if (newtuple->t_len == oldtuple->t_len && newheader->t_hoff == oldheader->t_hoff && - (HeapTupleHeaderGetNatts(newheader) == + (HeapTupleHeaderGetNatts(newheader) == HeapTupleHeaderGetNatts(oldheader)) && - ((newheader->t_infomask & ~HEAP_XACT_MASK) == + ((newheader->t_infomask & ~HEAP_XACT_MASK) == (oldheader->t_infomask & ~HEAP_XACT_MASK)) && - memcmp(((char *)newheader) + offsetof(HeapTupleHeaderData, t_bits), - ((char *)oldheader) + offsetof(HeapTupleHeaderData, t_bits), + memcmp(((char *) newheader) + offsetof(HeapTupleHeaderData, t_bits), + ((char *) oldheader) + offsetof(HeapTupleHeaderData, t_bits), newtuple->t_len - offsetof(HeapTupleHeaderData, t_bits)) == 0) { /* ... then suppress the update */ diff --git a/src/backend/utils/adt/tsginidx.c b/src/backend/utils/adt/tsginidx.c index 262a604ded..6b43585965 100644 --- a/src/backend/utils/adt/tsginidx.c +++ b/src/backend/utils/adt/tsginidx.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/tsginidx.c,v 1.15 2009/03/25 22:19:01 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/tsginidx.c,v 1.16 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -22,42 +22,43 @@ Datum gin_cmp_tslexeme(PG_FUNCTION_ARGS) { - text *a = PG_GETARG_TEXT_PP(0); - text *b = PG_GETARG_TEXT_PP(1); - int cmp; + text *a = PG_GETARG_TEXT_PP(0); + text *b = PG_GETARG_TEXT_PP(1); + int cmp; cmp = tsCompareString( - VARDATA_ANY(a), VARSIZE_ANY_EXHDR(a), - VARDATA_ANY(b), VARSIZE_ANY_EXHDR(b), - false ); + VARDATA_ANY(a), VARSIZE_ANY_EXHDR(a), + VARDATA_ANY(b), VARSIZE_ANY_EXHDR(b), + false); - PG_FREE_IF_COPY(a,0); - PG_FREE_IF_COPY(b,1); - PG_RETURN_INT32( cmp ); + PG_FREE_IF_COPY(a, 0); + PG_FREE_IF_COPY(b, 1); + PG_RETURN_INT32(cmp); } Datum gin_cmp_prefix(PG_FUNCTION_ARGS) { - text *a = PG_GETARG_TEXT_PP(0); - text *b = PG_GETARG_TEXT_PP(1); + text *a = PG_GETARG_TEXT_PP(0); + text *b = PG_GETARG_TEXT_PP(1); + #ifdef NOT_USED StrategyNumber strategy = PG_GETARG_UINT16(2); - Pointer extra_data = PG_GETARG_POINTER(3); + Pointer extra_data = PG_GETARG_POINTER(3); #endif - int cmp; + int cmp; cmp = tsCompareString( - VARDATA_ANY(a), VARSIZE_ANY_EXHDR(a), - VARDATA_ANY(b), VARSIZE_ANY_EXHDR(b), - true ); + VARDATA_ANY(a), VARSIZE_ANY_EXHDR(a), + VARDATA_ANY(b), VARSIZE_ANY_EXHDR(b), + true); - if ( cmp < 0 ) - cmp = 1; /* prevent continue scan */ + if (cmp < 0) + cmp = 1; /* prevent continue scan */ - PG_FREE_IF_COPY(a,0); - PG_FREE_IF_COPY(b,1); - PG_RETURN_INT32( cmp ); + PG_FREE_IF_COPY(a, 0); + PG_FREE_IF_COPY(b, 1); + PG_RETURN_INT32(cmp); } Datum @@ -95,11 +96,12 @@ gin_extract_tsquery(PG_FUNCTION_ARGS) { TSQuery query = PG_GETARG_TSQUERY(0); int32 *nentries = (int32 *) PG_GETARG_POINTER(1); + /* StrategyNumber strategy = PG_GETARG_UINT16(2); */ - bool **ptr_partialmatch = (bool**) PG_GETARG_POINTER(3); - Pointer **extra_data = (Pointer **) PG_GETARG_POINTER(4); + bool **ptr_partialmatch = (bool **) PG_GETARG_POINTER(3); + Pointer **extra_data = (Pointer **) PG_GETARG_POINTER(4); Datum *entries = NULL; - bool *partialmatch; + bool *partialmatch; *nentries = 0; @@ -109,7 +111,7 @@ gin_extract_tsquery(PG_FUNCTION_ARGS) j = 0, len; QueryItem *item; - bool use_fullscan=false; + bool use_fullscan = false; int *map_item_operand; item = clean_NOT(GETQUERY(query), &len); @@ -126,15 +128,14 @@ gin_extract_tsquery(PG_FUNCTION_ARGS) (*nentries)++; entries = (Datum *) palloc(sizeof(Datum) * (*nentries)); - partialmatch = *ptr_partialmatch = (bool*) palloc(sizeof(bool) * (*nentries)); + partialmatch = *ptr_partialmatch = (bool *) palloc(sizeof(bool) * (*nentries)); /* - * Make map to convert item's number to corresponding - * operand's (the same, entry's) number. Entry's number - * is used in check array in consistent method. We use - * the same map for each entry. + * Make map to convert item's number to corresponding operand's (the + * same, entry's) number. Entry's number is used in check array in + * consistent method. We use the same map for each entry. */ - *extra_data = (Pointer*) palloc0(sizeof(Pointer)*(*nentries)); + *extra_data = (Pointer *) palloc0(sizeof(Pointer) * (*nentries)); map_item_operand = palloc0(sizeof(int) * (query->size + 1)); for (i = 0; i < query->size; i++) @@ -145,15 +146,15 @@ gin_extract_tsquery(PG_FUNCTION_ARGS) txt = cstring_to_text_with_len(GETOPERAND(query) + val->distance, val->length); - (*extra_data)[j] = (Pointer)map_item_operand; + (*extra_data)[j] = (Pointer) map_item_operand; map_item_operand[i] = j; partialmatch[j] = val->prefix; entries[j++] = PointerGetDatum(txt); } - if ( use_fullscan ) + if (use_fullscan) { - (*extra_data)[j] = (Pointer)map_item_operand; + (*extra_data)[j] = (Pointer) map_item_operand; map_item_operand[i] = j; entries[j++] = PointerGetDatum(cstring_to_text_with_len("", 0)); } @@ -185,7 +186,7 @@ checkcondition_gin(void *checkval, QueryOperand *val) *(gcv->need_recheck) = true; /* convert item's number to corresponding entry's (operand's) number */ - j = gcv->map_item_operand[ ((QueryItem *) val) - gcv->first_item ]; + j = gcv->map_item_operand[((QueryItem *) val) - gcv->first_item]; /* return presence of current entry in indexed value */ return gcv->check[j]; @@ -195,10 +196,12 @@ Datum gin_tsquery_consistent(PG_FUNCTION_ARGS) { bool *check = (bool *) PG_GETARG_POINTER(0); + /* StrategyNumber strategy = PG_GETARG_UINT16(1); */ TSQuery query = PG_GETARG_TSQUERY(2); + /* int32 nkeys = PG_GETARG_INT32(3); */ - Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); + Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); bool *recheck = (bool *) PG_GETARG_POINTER(5); bool res = FALSE; @@ -216,7 +219,7 @@ gin_tsquery_consistent(PG_FUNCTION_ARGS) */ gcv.first_item = item = GETQUERY(query); gcv.check = check; - gcv.map_item_operand = (int*)(extra_data[0]); + gcv.map_item_operand = (int *) (extra_data[0]); gcv.need_recheck = recheck; res = TS_execute( diff --git a/src/backend/utils/adt/tsgistidx.c b/src/backend/utils/adt/tsgistidx.c index 3f1c84d14b..72e45dcf0b 100644 --- a/src/backend/utils/adt/tsgistidx.c +++ b/src/backend/utils/adt/tsgistidx.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/tsgistidx.c,v 1.10 2009/01/01 17:23:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/tsgistidx.c,v 1.11 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -307,10 +307,10 @@ checkcondition_arr(void *checkval, QueryOperand *val) /* Loop invariant: StopLow <= val < StopHigh */ - /* - * we are not able to find a a prefix by hash value + /* + * we are not able to find a a prefix by hash value */ - if ( val->prefix ) + if (val->prefix) return true; while (StopLow < StopHigh) @@ -330,11 +330,11 @@ checkcondition_arr(void *checkval, QueryOperand *val) static bool checkcondition_bit(void *checkval, QueryOperand *val) { - /* - * we are not able to find a a prefix in signature tree + /* + * we are not able to find a a prefix in signature tree */ - if ( val->prefix ) - return true; + if (val->prefix) + return true; return GETBIT(checkval, HASHVAL(val->valcrc)); } @@ -343,6 +343,7 @@ gtsvector_consistent(PG_FUNCTION_ARGS) { GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); TSQuery query = PG_GETARG_TSQUERY(1); + /* StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); */ /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); diff --git a/src/backend/utils/adt/tsquery.c b/src/backend/utils/adt/tsquery.c index 8b9c3d485d..7ca8467833 100644 --- a/src/backend/utils/adt/tsquery.c +++ b/src/backend/utils/adt/tsquery.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery.c,v 1.19 2009/01/01 17:23:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery.c,v 1.20 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -56,7 +56,7 @@ struct TSQueryParserStateData #define WAITSINGLEOPERAND 4 /* - * subroutine to parse the modifiers (weight and prefix flag currently) + * subroutine to parse the modifiers (weight and prefix flag currently) * part, like ':1AB' of a query. */ static char * @@ -642,7 +642,7 @@ infix(INFIX *in, bool first) { *(in->cur) = ':'; in->cur++; - if ( curpol->prefix ) + if (curpol->prefix) { *(in->cur) = '*'; in->cur++; diff --git a/src/backend/utils/adt/tsquery_gist.c b/src/backend/utils/adt/tsquery_gist.c index 10d9fd01ec..be0b39bf1e 100644 --- a/src/backend/utils/adt/tsquery_gist.c +++ b/src/backend/utils/adt/tsquery_gist.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_gist.c,v 1.8 2009/01/01 17:23:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_gist.c,v 1.9 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -55,9 +55,10 @@ gtsquery_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); TSQuery query = PG_GETARG_TSQUERY(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); - TSQuerySign key = DatumGetTSQuerySign(entry->key); + TSQuerySign key = DatumGetTSQuerySign(entry->key); TSQuerySign sq = makeTSQuerySign(query); bool retval; diff --git a/src/backend/utils/adt/tsquery_op.c b/src/backend/utils/adt/tsquery_op.c index d3fc368769..6b7e976a43 100644 --- a/src/backend/utils/adt/tsquery_op.c +++ b/src/backend/utils/adt/tsquery_op.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_op.c,v 1.5 2009/05/27 19:41:58 petere Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_op.c,v 1.6 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -188,7 +188,7 @@ NAME(PG_FUNCTION_ARGS) { \ PG_FREE_IF_COPY(b,1); \ \ PG_RETURN_BOOL( CONDITION ); \ -} \ +} \ /* keep compiler quiet - no extra ; */ \ extern int no_such_variable diff --git a/src/backend/utils/adt/tsquery_util.c b/src/backend/utils/adt/tsquery_util.c index 78814feca6..9efd5fa8d3 100644 --- a/src/backend/utils/adt/tsquery_util.c +++ b/src/backend/utils/adt/tsquery_util.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_util.c,v 1.10 2009/01/01 17:23:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_util.c,v 1.11 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -125,7 +125,7 @@ QTNodeCompare(QTNode *an, QTNode *bn) return (ao->valcrc > bo->valcrc) ? -1 : 1; } - return tsCompareString( an->word, ao->length, bn->word, bo->length, false); + return tsCompareString(an->word, ao->length, bn->word, bo->length, false); } } diff --git a/src/backend/utils/adt/tsrank.c b/src/backend/utils/adt/tsrank.c index f1b7b8ea56..3dac5ce0cd 100644 --- a/src/backend/utils/adt/tsrank.c +++ b/src/backend/utils/adt/tsrank.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/tsrank.c,v 1.14 2009/01/01 17:23:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/tsrank.c,v 1.15 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -72,9 +72,9 @@ cnt_length(TSVector t) } -#define WordECompareQueryItem(e,q,p,i,m) \ +#define WordECompareQueryItem(e,q,p,i,m) \ tsCompareString((q) + (i)->distance, (i)->length, \ - (e) + (p)->pos, (p)->len, (m)) + (e) + (p)->pos, (p)->len, (m)) /* @@ -90,7 +90,7 @@ find_wordentry(TSVector t, TSQuery q, QueryOperand *item, int32 *nitem) WordEntry *StopMiddle = StopHigh; int difference; - *nitem=0; + *nitem = 0; /* Loop invariant: StopLow <= item < StopHigh */ while (StopLow < StopHigh) @@ -100,7 +100,7 @@ find_wordentry(TSVector t, TSQuery q, QueryOperand *item, int32 *nitem) if (difference == 0) { StopHigh = StopMiddle; - *nitem=1; + *nitem = 1; break; } else if (difference > 0) @@ -109,22 +109,22 @@ find_wordentry(TSVector t, TSQuery q, QueryOperand *item, int32 *nitem) StopHigh = StopMiddle; } - if ( item->prefix == true ) + if (item->prefix == true) { - if ( StopLow >= StopHigh ) + if (StopLow >= StopHigh) StopMiddle = StopHigh; - *nitem=0; + *nitem = 0; - while( StopMiddle < (WordEntry *) STRPTR(t) && - WordECompareQueryItem(STRPTR(t), GETOPERAND(q), StopMiddle, item, true) == 0 ) + while (StopMiddle < (WordEntry *) STRPTR(t) && + WordECompareQueryItem(STRPTR(t), GETOPERAND(q), StopMiddle, item, true) == 0) { (*nitem)++; StopMiddle++; } } - return ( *nitem > 0 ) ? StopHigh : NULL; + return (*nitem > 0) ? StopHigh : NULL; } @@ -237,7 +237,7 @@ calc_rank_and(float *w, TSVector t, TSQuery q) if (!entry) continue; - while( entry - firstentry < nitem ) + while (entry - firstentry < nitem) { if (entry->haspos) pos[i] = _POSVECPTR(t, entry); @@ -260,7 +260,7 @@ calc_rank_and(float *w, TSVector t, TSQuery q) if (dist || (dist == 0 && (pos[i] == &POSNULL || pos[k] == &POSNULL))) { float curw; - + if (!dist) dist = MAXENTRYPOS; curw = sqrt(wpos(post[l]) * wpos(ct[p]) * word_distance(dist)); @@ -304,7 +304,7 @@ calc_rank_or(float *w, TSVector t, TSQuery q) if (!entry) continue; - while( entry - firstentry < nitem ) + while (entry - firstentry < nitem) { if (entry->haspos) { @@ -650,7 +650,7 @@ get_docrep(TSVector txt, QueryRepresentation *qr, int *doclen) if (!entry) continue; - while( entry - firstentry < nitem ) + while (entry - firstentry < nitem) { if (entry->haspos) { @@ -674,22 +674,22 @@ get_docrep(TSVector txt, QueryRepresentation *qr, int *doclen) if (j == 0) { int k; - + doc[cur].nitem = 0; doc[cur].item = (QueryItem **) palloc(sizeof(QueryItem *) * qr->query->size); - + for (k = 0; k < qr->query->size; k++) { QueryOperand *kptr = &item[k].operand; QueryOperand *iptr = &item[i].operand; - + if (k == i || (item[k].type == QI_VAL && compareQueryOperand(&kptr, &iptr, operand) == 0)) { /* - * if k == i, we've already checked above that it's - * type == Q_VAL + * if k == i, we've already checked above that + * it's type == Q_VAL */ doc[cur].item[doc[cur].nitem] = item + k; doc[cur].nitem++; diff --git a/src/backend/utils/adt/tsvector.c b/src/backend/utils/adt/tsvector.c index f449695725..397e6c780b 100644 --- a/src/backend/utils/adt/tsvector.c +++ b/src/backend/utils/adt/tsvector.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/tsvector.c,v 1.17 2009/05/21 20:09:36 teodor Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/tsvector.c,v 1.18 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -85,9 +85,9 @@ compareentry(const void *va, const void *vb, void *arg) const WordEntryIN *b = (const WordEntryIN *) vb; char *BufferStr = (char *) arg; - return tsCompareString( &BufferStr[a->entry.pos], a->entry.len, - &BufferStr[b->entry.pos], b->entry.len, - false ); + return tsCompareString(&BufferStr[a->entry.pos], a->entry.len, + &BufferStr[b->entry.pos], b->entry.len, + false); } /* @@ -219,7 +219,7 @@ tsvectorin(PG_FUNCTION_ARGS) if (cur - tmpbuf > MAXSTRPOS) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("string is too long for tsvector (%ld bytes, max %ld bytes)", + errmsg("string is too long for tsvector (%ld bytes, max %ld bytes)", (long) (cur - tmpbuf), (long) MAXSTRPOS))); /* @@ -544,8 +544,8 @@ tsvectorrecv(PG_FUNCTION_ARGS) SET_VARSIZE(vec, hdrlen + datalen); if (needSort) - qsort_arg((void *) ARRPTR(vec), vec->size, sizeof(WordEntry), - compareentry, (void*)STRPTR(vec)); + qsort_arg((void *) ARRPTR(vec), vec->size, sizeof(WordEntry), + compareentry, (void *) STRPTR(vec)); PG_RETURN_TSVECTOR(vec); } diff --git a/src/backend/utils/adt/tsvector_op.c b/src/backend/utils/adt/tsvector_op.c index e7bce9a707..093f2a348a 100644 --- a/src/backend/utils/adt/tsvector_op.c +++ b/src/backend/utils/adt/tsvector_op.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/tsvector_op.c,v 1.22 2009/05/27 19:41:58 petere Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/tsvector_op.c,v 1.23 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -38,8 +38,8 @@ typedef struct typedef struct StatEntry { - uint32 ndoc; /* zero indicates that we already was here while - walking throug the tree */ + uint32 ndoc; /* zero indicates that we already was here + * while walking throug the tree */ uint32 nentry; struct StatEntry *left; struct StatEntry *right; @@ -54,11 +54,11 @@ typedef struct int4 weight; uint32 maxdepth; - - StatEntry **stack; + + StatEntry **stack; uint32 stackpos; - StatEntry* root; + StatEntry *root; } TSVectorStat; #define STATHDRSIZE (offsetof(TSVectorStat, data)) @@ -127,7 +127,7 @@ silly_cmp_tsvector(const TSVector a, const TSVector b) { return (aptr->haspos > bptr->haspos) ? -1 : 1; } - else if ( (res=tsCompareString( STRPTR(a) + aptr->pos, aptr->len, STRPTR(b) + bptr->pos, bptr->len, false)) !=0 ) + else if ((res = tsCompareString(STRPTR(a) + aptr->pos, aptr->len, STRPTR(b) + bptr->pos, bptr->len, false)) != 0) { return res; } @@ -172,7 +172,7 @@ tsvector_##type(PG_FUNCTION_ARGS) \ PG_FREE_IF_COPY(a,0); \ PG_FREE_IF_COPY(b,1); \ PG_RETURN_##ret( res action 0 ); \ -} \ +} \ /* keep compiler quiet - no extra ; */ \ extern int no_such_variable @@ -524,40 +524,41 @@ tsvector_concat(PG_FUNCTION_ARGS) } /* - * Compare two strings by tsvector rules. + * Compare two strings by tsvector rules. * if isPrefix = true then it returns not-zero value if b has prefix a */ int4 tsCompareString(char *a, int lena, char *b, int lenb, bool prefix) { - int cmp; + int cmp; - if ( lena == 0 ) + if (lena == 0) { - if ( prefix ) - cmp = 0; /* emtry string is equal to any if a prefix match */ + if (prefix) + cmp = 0; /* emtry string is equal to any if a prefix + * match */ else - cmp = (lenb>0) ? -1 : 0; + cmp = (lenb > 0) ? -1 : 0; } - else if ( lenb == 0 ) + else if (lenb == 0) { - cmp = (lena>0) ? 1 : 0; + cmp = (lena > 0) ? 1 : 0; } else { cmp = memcmp(a, b, Min(lena, lenb)); - if ( prefix ) + if (prefix) { - if ( cmp == 0 && lena > lenb ) + if (cmp == 0 && lena > lenb) { /* * b argument is not beginning with argument a */ - cmp=1; + cmp = 1; } } - else if ( (cmp == 0) && (lena != lenb) ) + else if ((cmp == 0) && (lena != lenb)) { cmp = (lena < lenb) ? -1 : 1; } @@ -601,16 +602,16 @@ checkcondition_str(void *checkval, QueryOperand *val) WordEntry *StopLow = chkval->arrb; WordEntry *StopHigh = chkval->arre; WordEntry *StopMiddle = StopHigh; - int difference = -1; - bool res=false; + int difference = -1; + bool res = false; /* Loop invariant: StopLow <= val < StopHigh */ while (StopLow < StopHigh) { StopMiddle = StopLow + (StopHigh - StopLow) / 2; - difference = tsCompareString( chkval->operand + val->distance, val->length, - chkval->values + StopMiddle->pos, StopMiddle->len, - false); + difference = tsCompareString(chkval->operand + val->distance, val->length, + chkval->values + StopMiddle->pos, StopMiddle->len, + false); if (difference == 0) { @@ -624,19 +625,19 @@ checkcondition_str(void *checkval, QueryOperand *val) StopHigh = StopMiddle; } - if ( res == false && val->prefix == true ) + if (res == false && val->prefix == true) { /* * there was a failed exact search, so we should scan further to find * a prefix match. */ - if ( StopLow >= StopHigh ) + if (StopLow >= StopHigh) StopMiddle = StopHigh; - while( res == false && StopMiddle < chkval->arre && - tsCompareString( chkval->operand + val->distance, val->length, - chkval->values + StopMiddle->pos, StopMiddle->len, - true) == 0 ) + while (res == false && StopMiddle < chkval->arre && + tsCompareString(chkval->operand + val->distance, val->length, + chkval->values + StopMiddle->pos, StopMiddle->len, + true) == 0) { res = (val->weight && StopMiddle->haspos) ? checkclass_str(chkval, StopMiddle, val) : true; @@ -645,7 +646,7 @@ checkcondition_str(void *checkval, QueryOperand *val) } } - return res; + return res; } /* @@ -803,7 +804,7 @@ check_weight(TSVector txt, WordEntry *wptr, int8 weight) return num; } -#define compareStatWord(a,e,t) \ +#define compareStatWord(a,e,t) \ tsCompareString((a)->lexeme, (a)->lenlexeme, \ STRPTR(t) + (e)->pos, (e)->len, \ false) @@ -811,22 +812,22 @@ check_weight(TSVector txt, WordEntry *wptr, int8 weight) static void insertStatEntry(MemoryContext persistentContext, TSVectorStat *stat, TSVector txt, uint32 off) { - WordEntry *we = ARRPTR(txt) + off; - StatEntry *node = stat->root, - *pnode=NULL; + WordEntry *we = ARRPTR(txt) + off; + StatEntry *node = stat->root, + *pnode = NULL; int n, res = 0; - uint32 depth=1; + uint32 depth = 1; - if (stat->weight == 0) + if (stat->weight == 0) n = (we->haspos) ? POSDATALEN(txt, we) : 1; else n = (we->haspos) ? check_weight(txt, we, stat->weight) : 0; - if ( n == 0 ) - return; /* nothing to insert */ + if (n == 0) + return; /* nothing to insert */ - while( node ) + while (node) { res = compareStatWord(node, we, txt); @@ -837,7 +838,7 @@ insertStatEntry(MemoryContext persistentContext, TSVectorStat *stat, TSVector tx else { pnode = node; - node = ( res < 0 ) ? node->left : node->right; + node = (res < 0) ? node->left : node->right; } depth++; } @@ -847,14 +848,14 @@ insertStatEntry(MemoryContext persistentContext, TSVectorStat *stat, TSVector tx if (node == NULL) { - node = MemoryContextAlloc(persistentContext, STATENTRYHDRSZ + we->len ); + node = MemoryContextAlloc(persistentContext, STATENTRYHDRSZ + we->len); node->left = node->right = NULL; node->ndoc = 1; node->nentry = n; node->lenlexeme = we->len; memcpy(node->lexeme, STRPTR(txt) + we->pos, node->lenlexeme); - if ( pnode==NULL ) + if (pnode == NULL) { stat->root = node; } @@ -865,7 +866,7 @@ insertStatEntry(MemoryContext persistentContext, TSVectorStat *stat, TSVector tx else pnode->right = node; } - + } else { @@ -875,18 +876,18 @@ insertStatEntry(MemoryContext persistentContext, TSVectorStat *stat, TSVector tx } static void -chooseNextStatEntry(MemoryContext persistentContext, TSVectorStat *stat, TSVector txt, - uint32 low, uint32 high, uint32 offset) +chooseNextStatEntry(MemoryContext persistentContext, TSVectorStat *stat, TSVector txt, + uint32 low, uint32 high, uint32 offset) { - uint32 pos; - uint32 middle = (low + high) >> 1; + uint32 pos; + uint32 middle = (low + high) >> 1; pos = (low + middle) >> 1; if (low != middle && pos >= offset && pos - offset < txt->size) - insertStatEntry( persistentContext, stat, txt, pos - offset ); + insertStatEntry(persistentContext, stat, txt, pos - offset); pos = (high + middle + 1) >> 1; if (middle + 1 != high && pos >= offset && pos - offset < txt->size) - insertStatEntry( persistentContext, stat, txt, pos - offset ); + insertStatEntry(persistentContext, stat, txt, pos - offset); if (low != middle) chooseNextStatEntry(persistentContext, stat, txt, low, middle, offset); @@ -909,13 +910,13 @@ chooseNextStatEntry(MemoryContext persistentContext, TSVectorStat *stat, TSVecto static TSVectorStat * ts_accum(MemoryContext persistentContext, TSVectorStat *stat, Datum data) { - TSVector txt = DatumGetTSVector(data); - uint32 i, - nbit = 0, - offset; + TSVector txt = DatumGetTSVector(data); + uint32 i, + nbit = 0, + offset; if (stat == NULL) - { /* Init in first */ + { /* Init in first */ stat = MemoryContextAllocZero(persistentContext, sizeof(TSVectorStat)); stat->maxdepth = 1; } @@ -935,7 +936,7 @@ ts_accum(MemoryContext persistentContext, TSVectorStat *stat, Datum data) nbit = 1 << nbit; offset = (nbit - txt->size) / 2; - insertStatEntry( persistentContext, stat, txt, (nbit >> 1) - offset ); + insertStatEntry(persistentContext, stat, txt, (nbit >> 1) - offset); chooseNextStatEntry(persistentContext, stat, txt, 0, nbit, offset); return stat; @@ -945,22 +946,22 @@ static void ts_setup_firstcall(FunctionCallInfo fcinfo, FuncCallContext *funcctx, TSVectorStat *stat) { - TupleDesc tupdesc; - MemoryContext oldcontext; - StatEntry *node; + TupleDesc tupdesc; + MemoryContext oldcontext; + StatEntry *node; funcctx->user_fctx = (void *) stat; oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx); stat->stack = palloc0(sizeof(StatEntry *) * (stat->maxdepth + 1)); - stat->stackpos = 0; + stat->stackpos = 0; node = stat->root; /* find leftmost value */ for (;;) { - stat->stack[ stat->stackpos ] = node; + stat->stack[stat->stackpos] = node; if (node->left) { stat->stackpos++; @@ -984,14 +985,14 @@ ts_setup_firstcall(FunctionCallInfo fcinfo, FuncCallContext *funcctx, } static StatEntry * -walkStatEntryTree(TSVectorStat *stat) +walkStatEntryTree(TSVectorStat *stat) { - StatEntry *node = stat->stack[ stat->stackpos ]; + StatEntry *node = stat->stack[stat->stackpos]; - if ( node == NULL ) + if (node == NULL) return NULL; - if ( node->ndoc != 0 ) + if (node->ndoc != 0) { /* return entry itself: we already was at left sublink */ return node; @@ -1031,8 +1032,8 @@ walkStatEntryTree(TSVectorStat *stat) static Datum ts_process_call(FuncCallContext *funcctx) { - TSVectorStat *st; - StatEntry *entry; + TSVectorStat *st; + StatEntry *entry; st = (TSVectorStat *) funcctx->user_fctx; @@ -1164,7 +1165,7 @@ ts_stat1(PG_FUNCTION_ARGS) if (SRF_IS_FIRSTCALL()) { - TSVectorStat *stat; + TSVectorStat *stat; text *txt = PG_GETARG_TEXT_P(0); funcctx = SRF_FIRSTCALL_INIT(); @@ -1189,7 +1190,7 @@ ts_stat2(PG_FUNCTION_ARGS) if (SRF_IS_FIRSTCALL()) { - TSVectorStat *stat; + TSVectorStat *stat; text *txt = PG_GETARG_TEXT_P(0); text *ws = PG_GETARG_TEXT_P(1); diff --git a/src/backend/utils/adt/uuid.c b/src/backend/utils/adt/uuid.c index cd11c22c5e..3c95bef6b5 100644 --- a/src/backend/utils/adt/uuid.c +++ b/src/backend/utils/adt/uuid.c @@ -6,7 +6,7 @@ * Copyright (c) 2007-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/uuid.c,v 1.10 2009/01/01 17:23:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/uuid.c,v 1.11 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -84,7 +84,7 @@ string_to_uuid(const char *source, pg_uuid_t *uuid) { const char *src = source; bool braces = false; - int i; + int i; if (src[0] == '{') { diff --git a/src/backend/utils/adt/varchar.c b/src/backend/utils/adt/varchar.c index 673dacbf45..c25385dee7 100644 --- a/src/backend/utils/adt/varchar.c +++ b/src/backend/utils/adt/varchar.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/varchar.c,v 1.130 2009/01/01 17:23:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/varchar.c,v 1.131 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -595,7 +595,7 @@ varchar(PG_FUNCTION_ARGS) maxlen))); } - PG_RETURN_VARCHAR_P((VarChar *) cstring_to_text_with_len(s_data, + PG_RETURN_VARCHAR_P((VarChar *) cstring_to_text_with_len(s_data, maxmblen)); } diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c index 052d0578ac..b9b54e6db6 100644 --- a/src/backend/utils/adt/varlena.c +++ b/src/backend/utils/adt/varlena.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.170 2009/04/23 07:19:09 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.171 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -41,7 +41,7 @@ typedef struct int len2; /* Skip table for Boyer-Moore-Horspool search algorithm: */ int skiptablemask; /* mask for ANDing with skiptable subscripts */ - int skiptable[256]; /* skip distance for given mismatched char */ + int skiptable[256]; /* skip distance for given mismatched char */ } TextPositionState; #define DatumGetUnknownP(X) ((unknown *) PG_DETOAST_DATUM(X)) @@ -121,7 +121,7 @@ text_to_cstring(const text *t) if (tunpacked != t) pfree(tunpacked); - + return result; } @@ -150,7 +150,7 @@ text_to_cstring_buffer(const text *src, char *dst, size_t dst_len) dst_len--; if (dst_len >= src_len) dst_len = src_len; - else /* ensure truncation is encoding-safe */ + else /* ensure truncation is encoding-safe */ dst_len = pg_mbcliplen(VARDATA_ANY(srcunpacked), src_len, dst_len); memcpy(dst, VARDATA_ANY(srcunpacked), dst_len); dst[dst_len] = '\0'; @@ -186,10 +186,10 @@ byteain(PG_FUNCTION_ARGS) char *inputText = PG_GETARG_CSTRING(0); char *tp; char *rp; - int byte; + int byte; bytea *result; - for (byte = 0, tp = inputText; *tp != '\0'; byte++) + for (byte = 0, tp = inputText; *tp != '\0'; byte ++) { if (tp[0] != '\\') tp++; @@ -212,7 +212,8 @@ byteain(PG_FUNCTION_ARGS) } } - byte += VARHDRSZ; + byte +=VARHDRSZ; + result = (bytea *) palloc(byte); SET_VARSIZE(result, byte); @@ -228,10 +229,11 @@ byteain(PG_FUNCTION_ARGS) (tp[3] >= '0' && tp[3] <= '7')) { byte = VAL(tp[1]); - byte <<= 3; - byte += VAL(tp[2]); - byte <<= 3; - *rp++ = byte + VAL(tp[3]); + byte <<=3; + byte +=VAL(tp[2]); + byte <<=3; + *rp++ = byte +VAL(tp[3]); + tp += 4; } else if ((tp[0] == '\\') && @@ -920,23 +922,23 @@ text_position_setup(text *t1, text *t2, TextPositionState *state) * searched (t1) and the "needle" is the pattern being sought (t2). * * If the needle is empty or bigger than the haystack then there is no - * point in wasting cycles initializing the table. We also choose not - * to use B-M-H for needles of length 1, since the skip table can't - * possibly save anything in that case. + * point in wasting cycles initializing the table. We also choose not to + * use B-M-H for needles of length 1, since the skip table can't possibly + * save anything in that case. */ if (len1 >= len2 && len2 > 1) { - int searchlength = len1 - len2; - int skiptablemask; - int last; - int i; + int searchlength = len1 - len2; + int skiptablemask; + int last; + int i; /* * First we must determine how much of the skip table to use. The * declaration of TextPositionState allows up to 256 elements, but for * short search problems we don't really want to have to initialize so * many elements --- it would take too long in comparison to the - * actual search time. So we choose a useful skip table size based on + * actual search time. So we choose a useful skip table size based on * the haystack length minus the needle length. The closer the needle * length is to the haystack length the less useful skipping becomes. * @@ -968,10 +970,11 @@ text_position_setup(text *t1, text *t2, TextPositionState *state) state->skiptable[i] = len2; /* - * Now examine the needle. For each character except the last one, + * Now examine the needle. For each character except the last one, * set the corresponding table element to the appropriate skip * distance. Note that when two characters share the same skip table - * entry, the one later in the needle must determine the skip distance. + * entry, the one later in the needle must determine the skip + * distance. */ last = len2 - 1; @@ -1021,7 +1024,7 @@ text_position_next(int start_pos, TextPositionState *state) if (needle_len == 1) { /* No point in using B-M-H for a one-character needle */ - char nchar = *needle; + char nchar = *needle; hptr = &haystack[start_pos]; while (hptr < haystack_end) @@ -1047,18 +1050,19 @@ text_position_next(int start_pos, TextPositionState *state) p = hptr; while (*nptr == *p) { - /* Matched it all? If so, return 1-based position */ + /* Matched it all? If so, return 1-based position */ if (nptr == needle) return p - haystack + 1; nptr--, p--; } + /* * No match, so use the haystack char at hptr to decide how - * far to advance. If the needle had any occurrence of that + * far to advance. If the needle had any occurrence of that * character (or more precisely, one sharing the same * skiptable entry) before its last character, then we advance * far enough to align the last such needle character with - * that haystack position. Otherwise we can advance by the + * that haystack position. Otherwise we can advance by the * whole needle length. */ hptr += state->skiptable[(unsigned char) *hptr & skiptablemask]; @@ -1102,18 +1106,19 @@ text_position_next(int start_pos, TextPositionState *state) p = hptr; while (*nptr == *p) { - /* Matched it all? If so, return 1-based position */ + /* Matched it all? If so, return 1-based position */ if (nptr == needle) return p - haystack + 1; nptr--, p--; } + /* * No match, so use the haystack char at hptr to decide how - * far to advance. If the needle had any occurrence of that + * far to advance. If the needle had any occurrence of that * character (or more precisely, one sharing the same * skiptable entry) before its last character, then we advance * far enough to align the last such needle character with - * that haystack position. Otherwise we can advance by the + * that haystack position. Otherwise we can advance by the * whole needle length. */ hptr += state->skiptable[*hptr & skiptablemask]; @@ -1764,7 +1769,7 @@ byteaGetByte(PG_FUNCTION_ARGS) bytea *v = PG_GETARG_BYTEA_PP(0); int32 n = PG_GETARG_INT32(1); int len; - int byte; + int byte; len = VARSIZE_ANY_EXHDR(v); @@ -1795,7 +1800,7 @@ byteaGetBit(PG_FUNCTION_ARGS) int byteNo, bitNo; int len; - int byte; + int byte; len = VARSIZE_ANY_EXHDR(v); @@ -1810,7 +1815,7 @@ byteaGetBit(PG_FUNCTION_ARGS) byte = ((unsigned char *) VARDATA_ANY(v))[byteNo]; - if (byte & (1 << bitNo)) + if (byte &(1 << bitNo)) PG_RETURN_INT32(1); else PG_RETURN_INT32(0); diff --git a/src/backend/utils/adt/windowfuncs.c b/src/backend/utils/adt/windowfuncs.c index a7d890577c..28a7847506 100644 --- a/src/backend/utils/adt/windowfuncs.c +++ b/src/backend/utils/adt/windowfuncs.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/windowfuncs.c,v 1.2 2009/01/01 17:23:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/windowfuncs.c,v 1.3 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -21,7 +21,7 @@ */ typedef struct rank_context { - int64 rank; /* current rank */ + int64 rank; /* current rank */ } rank_context; /* @@ -29,15 +29,15 @@ typedef struct rank_context */ typedef struct { - int32 ntile; /* current result */ + int32 ntile; /* current result */ int64 rows_per_bucket; /* row number of current bucket */ - int64 boundary; /* how many rows should be in the bucket */ - int64 remainder; /* (total rows) % (bucket num) */ + int64 boundary; /* how many rows should be in the bucket */ + int64 remainder; /* (total rows) % (bucket num) */ } ntile_context; static bool rank_up(WindowObject winobj); static Datum leadlag_common(FunctionCallInfo fcinfo, - bool forward, bool withoffset, bool withdefault); + bool forward, bool withoffset, bool withdefault); /* @@ -81,7 +81,7 @@ rank_up(WindowObject winobj) Datum window_row_number(PG_FUNCTION_ARGS) { - WindowObject winobj = PG_WINDOW_OBJECT(); + WindowObject winobj = PG_WINDOW_OBJECT(); int64 curpos = WinGetCurrentPosition(winobj); WinSetMarkPosition(winobj, curpos); @@ -97,9 +97,9 @@ window_row_number(PG_FUNCTION_ARGS) Datum window_rank(PG_FUNCTION_ARGS) { - WindowObject winobj = PG_WINDOW_OBJECT(); - rank_context *context; - bool up; + WindowObject winobj = PG_WINDOW_OBJECT(); + rank_context *context; + bool up; up = rank_up(winobj); context = (rank_context *) @@ -117,9 +117,9 @@ window_rank(PG_FUNCTION_ARGS) Datum window_dense_rank(PG_FUNCTION_ARGS) { - WindowObject winobj = PG_WINDOW_OBJECT(); - rank_context *context; - bool up; + WindowObject winobj = PG_WINDOW_OBJECT(); + rank_context *context; + bool up; up = rank_up(winobj); context = (rank_context *) @@ -139,10 +139,10 @@ window_dense_rank(PG_FUNCTION_ARGS) Datum window_percent_rank(PG_FUNCTION_ARGS) { - WindowObject winobj = PG_WINDOW_OBJECT(); - rank_context *context; - bool up; - int64 totalrows = WinGetPartitionRowCount(winobj); + WindowObject winobj = PG_WINDOW_OBJECT(); + rank_context *context; + bool up; + int64 totalrows = WinGetPartitionRowCount(winobj); Assert(totalrows > 0); @@ -168,10 +168,10 @@ window_percent_rank(PG_FUNCTION_ARGS) Datum window_cume_dist(PG_FUNCTION_ARGS) { - WindowObject winobj = PG_WINDOW_OBJECT(); - rank_context *context; - bool up; - int64 totalrows = WinGetPartitionRowCount(winobj); + WindowObject winobj = PG_WINDOW_OBJECT(); + rank_context *context; + bool up; + int64 totalrows = WinGetPartitionRowCount(winobj); Assert(totalrows > 0); @@ -181,10 +181,10 @@ window_cume_dist(PG_FUNCTION_ARGS) if (up || context->rank == 1) { /* - * The current row is not peer to prior row or is just the first, - * so count up the number of rows that are peer to the current. + * The current row is not peer to prior row or is just the first, so + * count up the number of rows that are peer to the current. */ - int64 row; + int64 row; context->rank = WinGetCurrentPosition(winobj) + 1; @@ -210,8 +210,8 @@ window_cume_dist(PG_FUNCTION_ARGS) Datum window_ntile(PG_FUNCTION_ARGS) { - WindowObject winobj = PG_WINDOW_OBJECT(); - ntile_context *context; + WindowObject winobj = PG_WINDOW_OBJECT(); + ntile_context *context; context = (ntile_context *) WinGetPartitionLocalMemory(winobj, sizeof(ntile_context)); @@ -227,16 +227,15 @@ window_ntile(PG_FUNCTION_ARGS) nbuckets = DatumGetInt32(WinGetFuncArgCurrent(winobj, 0, &isnull)); /* - * per spec: - * If NT is the null value, then the result is the null value. + * per spec: If NT is the null value, then the result is the null + * value. */ if (isnull) PG_RETURN_NULL(); /* - * per spec: - * If NT is less than or equal to 0 (zero), then an exception - * condition is raised. + * per spec: If NT is less than or equal to 0 (zero), then an + * exception condition is raised. */ if (nbuckets <= 0) ereport(ERROR, @@ -251,8 +250,8 @@ window_ntile(PG_FUNCTION_ARGS) else { /* - * If the total number is not divisible, add 1 row to - * leading buckets. + * If the total number is not divisible, add 1 row to leading + * buckets. */ context->remainder = total % nbuckets; if (context->remainder != 0) @@ -287,12 +286,12 @@ static Datum leadlag_common(FunctionCallInfo fcinfo, bool forward, bool withoffset, bool withdefault) { - WindowObject winobj = PG_WINDOW_OBJECT(); - int32 offset; - bool const_offset; - Datum result; - bool isnull; - bool isout; + WindowObject winobj = PG_WINDOW_OBJECT(); + int32 offset; + bool const_offset; + Datum result; + bool isnull; + bool isout; if (withoffset) { @@ -407,9 +406,9 @@ window_lead_with_offset_and_default(PG_FUNCTION_ARGS) Datum window_first_value(PG_FUNCTION_ARGS) { - WindowObject winobj = PG_WINDOW_OBJECT(); - Datum result; - bool isnull; + WindowObject winobj = PG_WINDOW_OBJECT(); + Datum result; + bool isnull; result = WinGetFuncArgInFrame(winobj, 0, 0, WINDOW_SEEK_HEAD, true, @@ -428,9 +427,9 @@ window_first_value(PG_FUNCTION_ARGS) Datum window_last_value(PG_FUNCTION_ARGS) { - WindowObject winobj = PG_WINDOW_OBJECT(); - Datum result; - bool isnull; + WindowObject winobj = PG_WINDOW_OBJECT(); + Datum result; + bool isnull; result = WinGetFuncArgInFrame(winobj, 0, 0, WINDOW_SEEK_TAIL, true, @@ -449,11 +448,11 @@ window_last_value(PG_FUNCTION_ARGS) Datum window_nth_value(PG_FUNCTION_ARGS) { - WindowObject winobj = PG_WINDOW_OBJECT(); - bool const_offset; - Datum result; - bool isnull; - int32 nth; + WindowObject winobj = PG_WINDOW_OBJECT(); + bool const_offset; + Datum result; + bool isnull; + int32 nth; nth = DatumGetInt32(WinGetFuncArgCurrent(winobj, 1, &isnull)); if (isnull) diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c index 18f209489e..b92d41b93c 100644 --- a/src/backend/utils/adt/xml.c +++ b/src/backend/utils/adt/xml.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.91 2009/06/10 03:44:35 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.92 2009/06/11 14:49:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -79,8 +79,8 @@ /* GUC variables */ -int xmlbinary; -int xmloption; +int xmlbinary; +int xmloption; #ifdef USE_LIBXML @@ -100,17 +100,16 @@ static void *xml_palloc(size_t size); static void *xml_repalloc(void *ptr, size_t size); static void xml_pfree(void *ptr); static char *xml_pstrdup(const char *string); - -#endif /* USE_LIBXMLCONTEXT */ +#endif /* USE_LIBXMLCONTEXT */ static void xml_init(void); static xmlChar *xml_text2xmlChar(text *in); -static int parse_xml_decl(const xmlChar * str, size_t *lenp, - xmlChar ** version, xmlChar ** encoding, int *standalone); -static bool print_xml_decl(StringInfo buf, const xmlChar * version, +static int parse_xml_decl(const xmlChar *str, size_t *lenp, + xmlChar **version, xmlChar **encoding, int *standalone); +static bool print_xml_decl(StringInfo buf, const xmlChar *version, pg_enc encoding, int standalone); static xmlDocPtr xml_parse(text *data, XmlOptionType xmloption_arg, - bool preserve_whitespace, xmlChar * encoding); + bool preserve_whitespace, xmlChar *encoding); static text *xml_xmlnodetoxmltype(xmlNodePtr cur); #endif /* USE_LIBXML */ @@ -587,7 +586,7 @@ xmlelement(XmlExprState *xmlExpr, ExprContext *econtext) if (!isnull) { str = map_sql_value_to_xml_value(value, - exprType((Node *) e->expr), true); + exprType((Node *) e->expr), true); arg_strings = lappend(arg_strings, str); } } @@ -597,42 +596,42 @@ xmlelement(XmlExprState *xmlExpr, ExprContext *econtext) PG_TRY(); { - buf = xmlBufferCreate(); - if (!buf) - xml_ereport(ERROR, ERRCODE_OUT_OF_MEMORY, - "could not allocate xmlBuffer"); - writer = xmlNewTextWriterMemory(buf, 0); - if (!writer) - xml_ereport(ERROR, ERRCODE_OUT_OF_MEMORY, - "could not allocate xmlTextWriter"); + buf = xmlBufferCreate(); + if (!buf) + xml_ereport(ERROR, ERRCODE_OUT_OF_MEMORY, + "could not allocate xmlBuffer"); + writer = xmlNewTextWriterMemory(buf, 0); + if (!writer) + xml_ereport(ERROR, ERRCODE_OUT_OF_MEMORY, + "could not allocate xmlTextWriter"); - xmlTextWriterStartElement(writer, (xmlChar *) xexpr->name); + xmlTextWriterStartElement(writer, (xmlChar *) xexpr->name); - forboth(arg, named_arg_strings, narg, xexpr->arg_names) - { - char *str = (char *) lfirst(arg); - char *argname = strVal(lfirst(narg)); + forboth(arg, named_arg_strings, narg, xexpr->arg_names) + { + char *str = (char *) lfirst(arg); + char *argname = strVal(lfirst(narg)); - if (str) - xmlTextWriterWriteAttribute(writer, - (xmlChar *) argname, - (xmlChar *) str); - } + if (str) + xmlTextWriterWriteAttribute(writer, + (xmlChar *) argname, + (xmlChar *) str); + } - foreach(arg, arg_strings) - { - char *str = (char *) lfirst(arg); + foreach(arg, arg_strings) + { + char *str = (char *) lfirst(arg); - xmlTextWriterWriteRaw(writer, (xmlChar *) str); - } + xmlTextWriterWriteRaw(writer, (xmlChar *) str); + } - xmlTextWriterEndElement(writer); + xmlTextWriterEndElement(writer); - /* we MUST do this now to flush data out to the buffer ... */ - xmlFreeTextWriter(writer); - writer = NULL; + /* we MUST do this now to flush data out to the buffer ... */ + xmlFreeTextWriter(writer); + writer = NULL; - result = xmlBuffer_to_xmltype(buf); + result = xmlBuffer_to_xmltype(buf); } PG_CATCH(); { @@ -888,7 +887,7 @@ xml_init(void) resetStringInfo(xml_err_buf); /* - * We re-establish the error callback function every time. This makes + * We re-establish the error callback function every time. This makes * it safe for other subsystems (PL/Perl, say) to also use libxml with * their own callbacks ... so long as they likewise set up the * callbacks on every use. It's cheap enough to not be worth worrying @@ -930,7 +929,7 @@ xml_init(void) static xmlChar * xml_pnstrdup(const xmlChar *str, size_t len) { - xmlChar *result; + xmlChar *result; result = (xmlChar *) palloc((len + 1) * sizeof(xmlChar)); memcpy(result, str, len * sizeof(xmlChar)); @@ -945,8 +944,8 @@ xml_pnstrdup(const xmlChar *str, size_t len) * Result is 0 if OK, an error code if not. */ static int -parse_xml_decl(const xmlChar * str, size_t *lenp, - xmlChar ** version, xmlChar ** encoding, int *standalone) +parse_xml_decl(const xmlChar *str, size_t *lenp, + xmlChar **version, xmlChar **encoding, int *standalone) { const xmlChar *p; const xmlChar *save_p; @@ -1103,7 +1102,7 @@ finished: * which is the default version specified in SQL:2003. */ static bool -print_xml_decl(StringInfo buf, const xmlChar * version, +print_xml_decl(StringInfo buf, const xmlChar *version, pg_enc encoding, int standalone) { xml_init(); /* why is this here? */ @@ -1153,7 +1152,7 @@ print_xml_decl(StringInfo buf, const xmlChar * version, */ static xmlDocPtr xml_parse(text *data, XmlOptionType xmloption_arg, bool preserve_whitespace, - xmlChar * encoding) + xmlChar *encoding) { int32 len; xmlChar *string; @@ -1183,51 +1182,51 @@ xml_parse(text *data, XmlOptionType xmloption_arg, bool preserve_whitespace, /* Use a TRY block to ensure the ctxt is released */ PG_TRY(); { - if (xmloption_arg == XMLOPTION_DOCUMENT) - { - /* - * Note, that here we try to apply DTD defaults - * (XML_PARSE_DTDATTR) according to SQL/XML:10.16.7.d: 'Default - * values defined by internal DTD are applied'. As for external - * DTDs, we try to support them too, (see SQL/XML:10.16.7.e) - */ - doc = xmlCtxtReadDoc(ctxt, utf8string, - NULL, - "UTF-8", - XML_PARSE_NOENT | XML_PARSE_DTDATTR - | (preserve_whitespace ? 0 : XML_PARSE_NOBLANKS)); - if (doc == NULL) - xml_ereport(ERROR, ERRCODE_INVALID_XML_DOCUMENT, - "invalid XML document"); - } - else - { - int res_code; - size_t count; - xmlChar *version = NULL; - int standalone = -1; - - res_code = parse_xml_decl(utf8string, - &count, &version, NULL, &standalone); - if (res_code != 0) - xml_ereport_by_code(ERROR, ERRCODE_INVALID_XML_CONTENT, - "invalid XML content: invalid XML declaration", - res_code); - - doc = xmlNewDoc(version); - Assert(doc->encoding == NULL); - doc->encoding = xmlStrdup((const xmlChar *) "UTF-8"); - doc->standalone = standalone; - - res_code = xmlParseBalancedChunkMemory(doc, NULL, NULL, 0, - utf8string + count, NULL); - if (res_code != 0) + if (xmloption_arg == XMLOPTION_DOCUMENT) { - xmlFreeDoc(doc); - xml_ereport(ERROR, ERRCODE_INVALID_XML_CONTENT, - "invalid XML content"); + /* + * Note, that here we try to apply DTD defaults + * (XML_PARSE_DTDATTR) according to SQL/XML:10.16.7.d: 'Default + * values defined by internal DTD are applied'. As for external + * DTDs, we try to support them too, (see SQL/XML:10.16.7.e) + */ + doc = xmlCtxtReadDoc(ctxt, utf8string, + NULL, + "UTF-8", + XML_PARSE_NOENT | XML_PARSE_DTDATTR + | (preserve_whitespace ? 0 : XML_PARSE_NOBLANKS)); + if (doc == NULL) + xml_ereport(ERROR, ERRCODE_INVALID_XML_DOCUMENT, + "invalid XML document"); + } + else + { + int res_code; + size_t count; + xmlChar *version = NULL; + int standalone = -1; + + res_code = parse_xml_decl(utf8string, + &count, &version, NULL, &standalone); + if (res_code != 0) + xml_ereport_by_code(ERROR, ERRCODE_INVALID_XML_CONTENT, + "invalid XML content: invalid XML declaration", + res_code); + + doc = xmlNewDoc(version); + Assert(doc->encoding == NULL); + doc->encoding = xmlStrdup((const xmlChar *) "UTF-8"); + doc->standalone = standalone; + + res_code = xmlParseBalancedChunkMemory(doc, NULL, NULL, 0, + utf8string + count, NULL); + if (res_code != 0) + { + xmlFreeDoc(doc); + xml_ereport(ERROR, ERRCODE_INVALID_XML_CONTENT, + "invalid XML content"); + } } - } } PG_CATCH(); { @@ -1304,8 +1303,7 @@ xml_pstrdup(const char *string) { return MemoryContextStrdup(LibxmlContext, string); } - -#endif /* USE_LIBXMLCONTEXT */ +#endif /* USE_LIBXMLCONTEXT */ /* @@ -1529,7 +1527,7 @@ map_sql_identifier_to_xml_name(char *ident, bool fully_escaped, static char * unicode_to_sqlchar(pg_wchar c) { - unsigned char utf8string[5]; /* need room for trailing zero */ + unsigned char utf8string[5]; /* need room for trailing zero */ char *result; memset(utf8string, 0, sizeof(utf8string)); @@ -1537,7 +1535,7 @@ unicode_to_sqlchar(pg_wchar c) result = (char *) pg_do_encoding_conversion(utf8string, pg_encoding_mblen(PG_UTF8, - (char *) utf8string), + (char *) utf8string), PG_UTF8, GetDatabaseEncoding()); /* if pg_do_encoding_conversion didn't strdup, we must */ @@ -1585,8 +1583,8 @@ map_xml_name_to_sql_identifier(char *name) * * When xml_escape_strings is true, then certain characters in string * values are replaced by entity references (< etc.), as specified - * in SQL/XML:2003 section 9.16 GR 8) ii). This is normally what is - * wanted. The false case is mainly useful when the resulting value + * in SQL/XML:2003 section 9.16 GR 8) ii). This is normally what is + * wanted. The false case is mainly useful when the resulting value * is used with xmlTextWriterWriteAttribute() to write out an * attribute, because that function does the escaping itself. The SQL * standard of 2003 is somewhat buggy in this regard, so we do our @@ -1750,10 +1748,10 @@ map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings) if (xmlbinary == XMLBINARY_BASE64) xmlTextWriterWriteBase64(writer, VARDATA_ANY(bstr), - 0, VARSIZE_ANY_EXHDR(bstr)); + 0, VARSIZE_ANY_EXHDR(bstr)); else xmlTextWriterWriteBinHex(writer, VARDATA_ANY(bstr), - 0, VARSIZE_ANY_EXHDR(bstr)); + 0, VARSIZE_ANY_EXHDR(bstr)); /* we MUST do this now to flush data out to the buffer */ xmlFreeTextWriter(writer); @@ -3194,7 +3192,7 @@ SPI_sql_row_to_xmlelement(int rownum, StringInfo result, char *tablename, appendStringInfo(result, " <%s>%s</%s>\n", colname, map_sql_value_to_xml_value(colval, - SPI_gettypeid(SPI_tuptable->tupdesc, i), true), + SPI_gettypeid(SPI_tuptable->tupdesc, i), true), colname); } @@ -3349,7 +3347,7 @@ xpath(PG_FUNCTION_ARGS) memcpy(string, datastr, len); string[len] = '\0'; - xpath_expr = (xmlChar *) palloc((xpath_len +1) * sizeof(xmlChar)); + xpath_expr = (xmlChar *) palloc((xpath_len + 1) * sizeof(xmlChar)); memcpy(xpath_expr, VARDATA(xpath_expr_text), xpath_len); xpath_expr[xpath_len] = '\0'; @@ -3358,81 +3356,81 @@ xpath(PG_FUNCTION_ARGS) PG_TRY(); { - /* - * redundant XML parsing (two parsings for the same value during one - * command execution are possible) - */ - ctxt = xmlNewParserCtxt(); - if (ctxt == NULL) - xml_ereport(ERROR, ERRCODE_OUT_OF_MEMORY, - "could not allocate parser context"); - doc = xmlCtxtReadMemory(ctxt, (char *) string, len, NULL, NULL, 0); - if (doc == NULL) - xml_ereport(ERROR, ERRCODE_INVALID_XML_DOCUMENT, - "could not parse XML document"); - xpathctx = xmlXPathNewContext(doc); - if (xpathctx == NULL) - xml_ereport(ERROR, ERRCODE_OUT_OF_MEMORY, - "could not allocate XPath context"); - xpathctx->node = xmlDocGetRootElement(doc); - if (xpathctx->node == NULL) - xml_ereport(ERROR, ERRCODE_INTERNAL_ERROR, - "could not find root XML element"); - - /* register namespaces, if any */ - if (ns_count > 0) - { - for (i = 0; i < ns_count; i++) + /* + * redundant XML parsing (two parsings for the same value during one + * command execution are possible) + */ + ctxt = xmlNewParserCtxt(); + if (ctxt == NULL) + xml_ereport(ERROR, ERRCODE_OUT_OF_MEMORY, + "could not allocate parser context"); + doc = xmlCtxtReadMemory(ctxt, (char *) string, len, NULL, NULL, 0); + if (doc == NULL) + xml_ereport(ERROR, ERRCODE_INVALID_XML_DOCUMENT, + "could not parse XML document"); + xpathctx = xmlXPathNewContext(doc); + if (xpathctx == NULL) + xml_ereport(ERROR, ERRCODE_OUT_OF_MEMORY, + "could not allocate XPath context"); + xpathctx->node = xmlDocGetRootElement(doc); + if (xpathctx->node == NULL) + xml_ereport(ERROR, ERRCODE_INTERNAL_ERROR, + "could not find root XML element"); + + /* register namespaces, if any */ + if (ns_count > 0) { - char *ns_name; - char *ns_uri; - - if (ns_names_uris_nulls[i * 2] || - ns_names_uris_nulls[i * 2 + 1]) - ereport(ERROR, - (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), - errmsg("neither namespace name nor URI may be null"))); - ns_name = TextDatumGetCString(ns_names_uris[i * 2]); - ns_uri = TextDatumGetCString(ns_names_uris[i * 2 + 1]); - if (xmlXPathRegisterNs(xpathctx, - (xmlChar *) ns_name, - (xmlChar *) ns_uri) != 0) - ereport(ERROR, /* is this an internal error??? */ - (errmsg("could not register XML namespace with name \"%s\" and URI \"%s\"", - ns_name, ns_uri))); + for (i = 0; i < ns_count; i++) + { + char *ns_name; + char *ns_uri; + + if (ns_names_uris_nulls[i * 2] || + ns_names_uris_nulls[i * 2 + 1]) + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("neither namespace name nor URI may be null"))); + ns_name = TextDatumGetCString(ns_names_uris[i * 2]); + ns_uri = TextDatumGetCString(ns_names_uris[i * 2 + 1]); + if (xmlXPathRegisterNs(xpathctx, + (xmlChar *) ns_name, + (xmlChar *) ns_uri) != 0) + ereport(ERROR, /* is this an internal error??? */ + (errmsg("could not register XML namespace with name \"%s\" and URI \"%s\"", + ns_name, ns_uri))); + } } - } - xpathcomp = xmlXPathCompile(xpath_expr); - if (xpathcomp == NULL) /* TODO: show proper XPath error details */ - xml_ereport(ERROR, ERRCODE_INTERNAL_ERROR, - "invalid XPath expression"); + xpathcomp = xmlXPathCompile(xpath_expr); + if (xpathcomp == NULL) /* TODO: show proper XPath error details */ + xml_ereport(ERROR, ERRCODE_INTERNAL_ERROR, + "invalid XPath expression"); - xpathobj = xmlXPathCompiledEval(xpathcomp, xpathctx); - if (xpathobj == NULL) /* TODO: reason? */ - xml_ereport(ERROR, ERRCODE_INTERNAL_ERROR, - "could not create XPath object"); + xpathobj = xmlXPathCompiledEval(xpathcomp, xpathctx); + if (xpathobj == NULL) /* TODO: reason? */ + xml_ereport(ERROR, ERRCODE_INTERNAL_ERROR, + "could not create XPath object"); - /* return empty array in cases when nothing is found */ - if (xpathobj->nodesetval == NULL) - res_nitems = 0; - else - res_nitems = xpathobj->nodesetval->nodeNr; + /* return empty array in cases when nothing is found */ + if (xpathobj->nodesetval == NULL) + res_nitems = 0; + else + res_nitems = xpathobj->nodesetval->nodeNr; - if (res_nitems) - { - for (i = 0; i < xpathobj->nodesetval->nodeNr; i++) + if (res_nitems) { - Datum elem; - bool elemisnull = false; + for (i = 0; i < xpathobj->nodesetval->nodeNr; i++) + { + Datum elem; + bool elemisnull = false; - elem = PointerGetDatum(xml_xmlnodetoxmltype(xpathobj->nodesetval->nodeTab[i])); - astate = accumArrayResult(astate, elem, - elemisnull, XMLOID, - CurrentMemoryContext); + elem = PointerGetDatum(xml_xmlnodetoxmltype(xpathobj->nodesetval->nodeTab[i])); + astate = accumArrayResult(astate, elem, + elemisnull, XMLOID, + CurrentMemoryContext); + } } } - } PG_CATCH(); { if (xpathobj) diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c index a29c5c91aa..6fd672435f 100644 --- a/src/backend/utils/cache/catcache.c +++ b/src/backend/utils/cache/catcache.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.146 2009/01/01 17:23:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.147 2009/06/11 14:49:05 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -104,30 +104,37 @@ GetCCHashEqFuncs(Oid keytype, PGFunction *hashfunc, RegProcedure *eqfunc) { case BOOLOID: *hashfunc = hashchar; + *eqfunc = F_BOOLEQ; break; case CHAROID: *hashfunc = hashchar; + *eqfunc = F_CHAREQ; break; case NAMEOID: *hashfunc = hashname; + *eqfunc = F_NAMEEQ; break; case INT2OID: *hashfunc = hashint2; + *eqfunc = F_INT2EQ; break; case INT2VECTOROID: *hashfunc = hashint2vector; + *eqfunc = F_INT2VECTOREQ; break; case INT4OID: *hashfunc = hashint4; + *eqfunc = F_INT4EQ; break; case TEXTOID: *hashfunc = hashtext; + *eqfunc = F_TEXTEQ; break; case OIDOID: @@ -140,15 +147,18 @@ GetCCHashEqFuncs(Oid keytype, PGFunction *hashfunc, RegProcedure *eqfunc) case REGCONFIGOID: case REGDICTIONARYOID: *hashfunc = hashoid; + *eqfunc = F_OIDEQ; break; case OIDVECTOROID: *hashfunc = hashoidvector; + *eqfunc = F_OIDVECTOREQ; break; default: elog(FATAL, "type %u not supported as catcache key", keytype); *hashfunc = NULL; /* keep compiler quiet */ + *eqfunc = InvalidOid; break; } diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c index 398eb39dc5..5fac924207 100644 --- a/src/backend/utils/cache/inval.c +++ b/src/backend/utils/cache/inval.c @@ -80,7 +80,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/inval.c,v 1.88 2009/01/01 17:23:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/inval.c,v 1.89 2009/06/11 14:49:05 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -403,7 +403,7 @@ ProcessInvalidationMessages(InvalidationListHeader *hdr, */ static void ProcessInvalidationMessagesMulti(InvalidationListHeader *hdr, - void (*func) (const SharedInvalidationMessage *msgs, int n)) + void (*func) (const SharedInvalidationMessage *msgs, int n)) { ProcessMessageListMulti(hdr->cclist, func(msgs, n)); ProcessMessageListMulti(hdr->rclist, func(msgs, n)); @@ -442,9 +442,9 @@ RegisterRelcacheInvalidation(Oid dbId, Oid relId) /* * Most of the time, relcache invalidation is associated with system - * catalog updates, but there are a few cases where it isn't. Quick - * hack to ensure that the next CommandCounterIncrement() will think - * that we need to do CommandEndInvalidationMessages(). + * catalog updates, but there are a few cases where it isn't. Quick hack + * to ensure that the next CommandCounterIncrement() will think that we + * need to do CommandEndInvalidationMessages(). */ (void) GetCurrentCommandId(true); @@ -1015,7 +1015,7 @@ CommandEndInvalidationMessages(void) * Prepare for invalidation messages for nontransactional updates. * * A nontransactional invalidation is one that must be sent whether or not - * the current transaction eventually commits. We arrange for all invals + * the current transaction eventually commits. We arrange for all invals * queued between this call and EndNonTransactionalInvalidation() to be sent * immediately when the latter is called. * @@ -1069,10 +1069,10 @@ EndNonTransactionalInvalidation(void) Assert(transInvalInfo->PriorCmdInvalidMsgs.rclist == NULL); /* - * At present, this function is only used for CTID-changing updates; - * since the relcache init file doesn't store any tuple CTIDs, we - * don't have to invalidate it. That might not be true forever - * though, in which case we'd need code similar to AtEOXact_Inval. + * At present, this function is only used for CTID-changing updates; since + * the relcache init file doesn't store any tuple CTIDs, we don't have to + * invalidate it. That might not be true forever though, in which case + * we'd need code similar to AtEOXact_Inval. */ /* Send out the invals */ diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index b3ec6ad341..8247516bd1 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.161 2009/01/01 17:23:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.162 2009/06/11 14:49:05 momjian Exp $ * * NOTES * Eventually, the index information should go through here, too. @@ -239,6 +239,7 @@ get_compare_function_for_ordering_op(Oid opno, Oid *cmpfunc, bool *reverse) opcintype, opcintype, BTORDER_PROC); + if (!OidIsValid(*cmpfunc)) /* should not happen */ elog(ERROR, "missing support function %d(%u,%u) in opfamily %u", BTORDER_PROC, opcintype, opcintype, opfamily); @@ -248,6 +249,7 @@ get_compare_function_for_ordering_op(Oid opno, Oid *cmpfunc, bool *reverse) /* ensure outputs are set on failure */ *cmpfunc = InvalidOid; + *reverse = false; return false; } diff --git a/src/backend/utils/cache/plancache.c b/src/backend/utils/cache/plancache.c index 6c0f90f1ad..437b7d1114 100644 --- a/src/backend/utils/cache/plancache.c +++ b/src/backend/utils/cache/plancache.c @@ -12,7 +12,7 @@ * * The plan cache manager itself is principally responsible for tracking * whether cached plans should be invalidated because of schema changes in - * the objects they depend on. When (and if) the next demand for a cached + * the objects they depend on. When (and if) the next demand for a cached * plan occurs, the query will be replanned. Note that this could result * in an error, for example if a column referenced by the query is no * longer present. The creator of a cached plan can specify whether it @@ -21,7 +21,7 @@ * caller to notice changes and cope with them. * * Currently, we track exactly the dependencies of plans on relations and - * user-defined functions. On relcache invalidation events or pg_proc + * user-defined functions. On relcache invalidation events or pg_proc * syscache invalidation events, we invalidate just those plans that depend * on the particular object being modified. (Note: this scheme assumes * that any table modification that requires replanning will generate a @@ -35,7 +35,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/plancache.c,v 1.26 2009/01/01 17:23:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/plancache.c,v 1.27 2009/06/11 14:49:05 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -120,7 +120,7 @@ CreateCachedPlan(Node *raw_parse_tree, MemoryContext source_context; MemoryContext oldcxt; - Assert(query_string != NULL); /* required as of 8.4 */ + Assert(query_string != NULL); /* required as of 8.4 */ /* * Make a dedicated memory context for the CachedPlanSource and its @@ -220,7 +220,7 @@ FastCreateCachedPlan(Node *raw_parse_tree, OverrideSearchPath *search_path; MemoryContext oldcxt; - Assert(query_string != NULL); /* required as of 8.4 */ + Assert(query_string != NULL); /* required as of 8.4 */ /* * Fetch current search_path into given context, but do any recalculation @@ -475,8 +475,8 @@ RevalidateCachedPlan(CachedPlanSource *plansource, bool useResOwner) /* * If a snapshot is already set (the normal case), we can just use - * that for parsing/planning. But if it isn't, install one. Note: - * no point in checking whether parse analysis requires a snapshot; + * that for parsing/planning. But if it isn't, install one. Note: no + * point in checking whether parse analysis requires a snapshot; * utility commands don't have invalidatable plans, so we'd not get * here for such a command. */ @@ -609,8 +609,8 @@ CachedPlanIsValid(CachedPlanSource *plansource) Assert(plan->refcount > 0); /* - * Although we don't want to acquire locks here, it still seems - * useful to check for expiration of a transient plan. + * Although we don't want to acquire locks here, it still seems useful + * to check for expiration of a transient plan. */ if (TransactionIdIsValid(plan->saved_xmin) && !TransactionIdEquals(plan->saved_xmin, TransactionXmin)) @@ -990,7 +990,7 @@ PlanCacheFuncCallback(Datum arg, int cacheid, ItemPointer tuplePtr) { /* Invalidate the plan! */ plan->dead = true; - break; /* out of invalItems scan */ + break; /* out of invalItems scan */ } } if (plan->dead) diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index ae6fcea7e6..775865d569 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.286 2009/03/31 22:12:48 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.287 2009/06/11 14:49:05 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -1129,7 +1129,7 @@ IndexSupportInitialize(oidvector *indclass, * Note there is no provision for flushing the cache. This is OK at the * moment because there is no way to ALTER any interesting properties of an * existing opclass --- all you can do is drop it, which will result in - * a useless but harmless dead entry in the cache. To support altering + * a useless but harmless dead entry in the cache. To support altering * opclass membership (not the same as opfamily membership!), we'd need to * be able to flush this cache as well as the contents of relcache entries * for indexes. @@ -1196,10 +1196,10 @@ LookupOpclassInfo(Oid operatorClassOid, /* * When testing for cache-flush hazards, we intentionally disable the - * operator class cache and force reloading of the info on each call. - * This is helpful because we want to test the case where a cache flush - * occurs while we are loading the info, and it's very hard to provoke - * that if this happens only once per opclass per backend. + * operator class cache and force reloading of the info on each call. This + * is helpful because we want to test the case where a cache flush occurs + * while we are loading the info, and it's very hard to provoke that if + * this happens only once per opclass per backend. */ #if defined(CLOBBER_CACHE_ALWAYS) opcentry->valid = false; @@ -1402,8 +1402,8 @@ formrdesc(const char *relationName, Oid relationReltype, relation->rd_rel->relisshared = false; /* - * Likewise, we must know if a relation is temp ... but formrdesc is - * not used for any temp relations. + * Likewise, we must know if a relation is temp ... but formrdesc is not + * used for any temp relations. */ relation->rd_rel->relistemp = false; @@ -1657,6 +1657,7 @@ RelationReloadIndexInfo(Relation relation) heap_freetuple(pg_class_tuple); /* We must recalculate physical address in case it changed */ RelationInitPhysicalAddr(relation); + /* * Must reset targblock, fsm_nblocks and vm_nblocks in case rel was * truncated @@ -2792,7 +2793,7 @@ AttrDefaultFetch(Relation relation) RelationGetRelationName(relation)); else attrdef[i].adbin = MemoryContextStrdup(CacheMemoryContext, - TextDatumGetCString(val)); + TextDatumGetCString(val)); break; } diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c index 4de61e7f94..922c4a626f 100644 --- a/src/backend/utils/cache/syscache.c +++ b/src/backend/utils/cache/syscache.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/syscache.c,v 1.119 2009/01/01 17:23:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/syscache.c,v 1.120 2009/06/11 14:49:05 momjian Exp $ * * NOTES * These routines allow the parser/planner/executor to perform @@ -368,7 +368,7 @@ static const struct cachedesc cacheinfo[] = { }, 256 }, - {ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPERNAME */ + {ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPERNAME */ ForeignDataWrapperNameIndexId, 0, 1, @@ -380,7 +380,7 @@ static const struct cachedesc cacheinfo[] = { }, 8 }, - {ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPEROID */ + {ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPEROID */ ForeignDataWrapperOidIndexId, 0, 1, @@ -392,7 +392,7 @@ static const struct cachedesc cacheinfo[] = { }, 8 }, - {ForeignServerRelationId, /* FOREIGNSERVERNAME */ + {ForeignServerRelationId, /* FOREIGNSERVERNAME */ ForeignServerNameIndexId, 0, 1, @@ -404,7 +404,7 @@ static const struct cachedesc cacheinfo[] = { }, 32 }, - {ForeignServerRelationId, /* FOREIGNSERVEROID */ + {ForeignServerRelationId, /* FOREIGNSERVEROID */ ForeignServerOidIndexId, 0, 1, @@ -728,7 +728,7 @@ static const struct cachedesc cacheinfo[] = { }, 1024 }, - {UserMappingRelationId, /* USERMAPPINGOID */ + {UserMappingRelationId, /* USERMAPPINGOID */ UserMappingOidIndexId, 0, 1, @@ -740,7 +740,7 @@ static const struct cachedesc cacheinfo[] = { }, 128 }, - {UserMappingRelationId, /* USERMAPPINGUSERSERVER */ + {UserMappingRelationId, /* USERMAPPINGUSERSERVER */ UserMappingUserServerIndexId, 0, 2, diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index d93aaeb54d..ba529002f0 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -42,7 +42,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.214 2009/06/04 18:33:07 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.215 2009/06/11 14:49:05 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -92,7 +92,7 @@ int Log_destination = LOG_DESTINATION_STDERR; /* * Max string length to send to syslog(). Note that this doesn't count the * sequence-number prefix we add, and of course it doesn't count the prefix - * added by syslog itself. On many implementations it seems that the hard + * added by syslog itself. On many implementations it seems that the hard * limit is approximately 2K bytes including both those prefixes. */ #ifndef PG_SYSLOG_LIMIT @@ -298,8 +298,8 @@ errstart(int elevel, const char *filename, int lineno, MemoryContextReset(ErrorContext); /* - * Infinite error recursion might be due to something broken - * in a context traceback routine. Abandon them too. We also abandon + * Infinite error recursion might be due to something broken in a + * context traceback routine. Abandon them too. We also abandon * attempting to print the error statement (which, if long, could * itself be the source of the recursive failure). */ @@ -785,7 +785,7 @@ errmsg_internal(const char *fmt,...) */ int errmsg_plural(const char *fmt_singular, const char *fmt_plural, - unsigned long n, ...) + unsigned long n,...) { ErrorData *edata = &errordata[errordata_stack_depth]; MemoryContext oldcontext; @@ -850,7 +850,7 @@ errdetail_log(const char *fmt,...) */ int errdetail_plural(const char *fmt_singular, const char *fmt_plural, - unsigned long n, ...) + unsigned long n,...) { ErrorData *edata = &errordata[errordata_stack_depth]; MemoryContext oldcontext; @@ -1637,7 +1637,7 @@ setup_formatted_log_time(void) tz = log_timezone ? log_timezone : gmt_timezone; pg_strftime(formatted_log_time, FORMATTED_TS_LEN, - /* leave room for milliseconds... */ + /* leave room for milliseconds... */ "%Y-%m-%d %H:%M:%S %Z", pg_localtime(&stamp_time, tz)); @@ -1852,7 +1852,7 @@ static void write_csvlog(ErrorData *edata) { StringInfoData buf; - bool print_stmt = false; + bool print_stmt = false; /* static counter for line numbers */ static long log_line_number = 0; @@ -1934,7 +1934,7 @@ write_csvlog(ErrorData *edata) psdisp = get_ps_display(&displen); appendStringInfo(&msgbuf, "%.*s", displen, psdisp); appendCSVLiteral(&buf, msgbuf.data); - + pfree(msgbuf.data); } appendStringInfoChar(&buf, ','); @@ -2006,7 +2006,7 @@ write_csvlog(ErrorData *edata) /* file error location */ if (Log_error_verbosity >= PGERROR_VERBOSE) { - StringInfoData msgbuf; + StringInfoData msgbuf; initStringInfo(&msgbuf); diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c index 125e880408..8b819df279 100644 --- a/src/backend/utils/fmgr/dfmgr.c +++ b/src/backend/utils/fmgr/dfmgr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.98 2009/01/01 17:23:51 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.99 2009/06/11 14:49:05 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -73,7 +73,7 @@ char *Dynamic_library_path; static void *internal_load_library(const char *libname); static void incompatible_module_error(const char *libname, - const Pg_magic_struct *module_magic_data); + const Pg_magic_struct *module_magic_data); static void internal_unload_library(const char *libname); static bool file_exists(const char *name); static char *expand_dynamic_library_name(const char *name); @@ -301,7 +301,7 @@ static void incompatible_module_error(const char *libname, const Pg_magic_struct *module_magic_data) { - StringInfoData details; + StringInfoData details; /* * If the version doesn't match, just report that, because the rest of the @@ -311,11 +311,11 @@ incompatible_module_error(const char *libname, ereport(ERROR, (errmsg("incompatible library \"%s\": version mismatch", libname), - errdetail("Server is version %d.%d, library is version %d.%d.", - magic_data.version / 100, - magic_data.version % 100, - module_magic_data->version / 100, - module_magic_data->version % 100))); + errdetail("Server is version %d.%d, library is version %d.%d.", + magic_data.version / 100, + magic_data.version % 100, + module_magic_data->version / 100, + module_magic_data->version % 100))); /* * Otherwise, spell out which fields don't agree. @@ -357,7 +357,7 @@ incompatible_module_error(const char *libname, if (details.len) appendStringInfoChar(&details, '\n'); appendStringInfo(&details, - _("Server has FLOAT4PASSBYVAL = %s, library has %s."), + _("Server has FLOAT4PASSBYVAL = %s, library has %s."), magic_data.float4byval ? "true" : "false", module_magic_data->float4byval ? "true" : "false"); } @@ -366,14 +366,14 @@ incompatible_module_error(const char *libname, if (details.len) appendStringInfoChar(&details, '\n'); appendStringInfo(&details, - _("Server has FLOAT8PASSBYVAL = %s, library has %s."), + _("Server has FLOAT8PASSBYVAL = %s, library has %s."), magic_data.float8byval ? "true" : "false", module_magic_data->float8byval ? "true" : "false"); } if (details.len == 0) appendStringInfo(&details, - _("Magic block has unexpected length or padding difference.")); + _("Magic block has unexpected length or padding difference.")); ereport(ERROR, (errmsg("incompatible library \"%s\": magic block mismatch", diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c index 34777b7606..1256e7c88d 100644 --- a/src/backend/utils/fmgr/fmgr.c +++ b/src/backend/utils/fmgr/fmgr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.125 2009/01/07 20:38:56 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.126 2009/06/11 14:49:05 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -199,7 +199,7 @@ fmgr_info_cxt_security(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt, finfo->fn_nargs = fbp->nargs; finfo->fn_strict = fbp->strict; finfo->fn_retset = fbp->retset; - finfo->fn_stats = TRACK_FUNC_ALL; /* ie, never track */ + finfo->fn_stats = TRACK_FUNC_ALL; /* ie, never track */ finfo->fn_addr = fbp->func; finfo->fn_oid = functionId; return; @@ -219,23 +219,23 @@ fmgr_info_cxt_security(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt, /* * If it has prosecdef set, or non-null proconfig, use - * fmgr_security_definer call handler --- unless we are being called - * again by fmgr_security_definer. + * fmgr_security_definer call handler --- unless we are being called again + * by fmgr_security_definer. * * When using fmgr_security_definer, function stats tracking is always - * disabled at the outer level, and instead we set the flag properly - * in fmgr_security_definer's private flinfo and implement the tracking + * disabled at the outer level, and instead we set the flag properly in + * fmgr_security_definer's private flinfo and implement the tracking * inside fmgr_security_definer. This loses the ability to charge the * overhead of fmgr_security_definer to the function, but gains the - * ability to set the track_functions GUC as a local GUC parameter of - * an interesting function and have the right things happen. + * ability to set the track_functions GUC as a local GUC parameter of an + * interesting function and have the right things happen. */ if (!ignore_security && (procedureStruct->prosecdef || !heap_attisnull(procedureTuple, Anum_pg_proc_proconfig))) { finfo->fn_addr = fmgr_security_definer; - finfo->fn_stats = TRACK_FUNC_ALL; /* ie, never track */ + finfo->fn_stats = TRACK_FUNC_ALL; /* ie, never track */ finfo->fn_oid = functionId; ReleaseSysCache(procedureTuple); return; @@ -946,7 +946,7 @@ fmgr_security_definer(PG_FUNCTION_ARGS) /* * We don't need to restore GUC or userid settings on error, because the - * ensuing xact or subxact abort will do that. The PG_TRY block is only + * ensuing xact or subxact abort will do that. The PG_TRY block is only * needed to clean up the flinfo link. */ save_flinfo = fcinfo->flinfo; @@ -1850,7 +1850,7 @@ OidFunctionCall9(Oid functionId, Datum arg1, Datum arg2, * * One important difference from the bare function call is that we will * push any active SPI context, allowing SPI-using I/O functions to be - * called from other SPI functions without extra notation. This is a hack, + * called from other SPI functions without extra notation. This is a hack, * but the alternative of expecting all SPI functions to do SPI_push/SPI_pop * around I/O calls seems worse. */ @@ -2130,17 +2130,17 @@ Int64GetDatum(int64 X) return PointerGetDatum(retval); #endif /* INT64_IS_BUSTED */ } - -#endif /* USE_FLOAT8_BYVAL */ +#endif /* USE_FLOAT8_BYVAL */ Datum Float4GetDatum(float4 X) { #ifdef USE_FLOAT4_BYVAL - union { - float4 value; - int32 retval; - } myunion; + union + { + float4 value; + int32 retval; + } myunion; myunion.value = X; return SET_4_BYTES(myunion.retval); @@ -2157,25 +2157,26 @@ Float4GetDatum(float4 X) float4 DatumGetFloat4(Datum X) { - union { - int32 value; - float4 retval; - } myunion; + union + { + int32 value; + float4 retval; + } myunion; myunion.value = GET_4_BYTES(X); return myunion.retval; } - -#endif /* USE_FLOAT4_BYVAL */ +#endif /* USE_FLOAT4_BYVAL */ Datum Float8GetDatum(float8 X) { #ifdef USE_FLOAT8_BYVAL - union { - float8 value; - int64 retval; - } myunion; + union + { + float8 value; + int64 retval; + } myunion; myunion.value = X; return SET_8_BYTES(myunion.retval); @@ -2192,16 +2193,16 @@ Float8GetDatum(float8 X) float8 DatumGetFloat8(Datum X) { - union { - int64 value; - float8 retval; - } myunion; + union + { + int64 value; + float8 retval; + } myunion; myunion.value = GET_8_BYTES(X); return myunion.retval; } - -#endif /* USE_FLOAT8_BYVAL */ +#endif /* USE_FLOAT8_BYVAL */ /*------------------------------------------------------------------------- @@ -2408,9 +2409,9 @@ get_call_expr_arg_stable(Node *expr, int argnum) arg = (Node *) list_nth(args, argnum); /* - * Either a true Const or an external Param will have a value that - * doesn't change during the execution of the query. In future we - * might want to consider other cases too, e.g. now(). + * Either a true Const or an external Param will have a value that doesn't + * change during the execution of the query. In future we might want to + * consider other cases too, e.g. now(). */ if (IsA(arg, Const)) return true; diff --git a/src/backend/utils/fmgr/funcapi.c b/src/backend/utils/fmgr/funcapi.c index c0cd71419a..7ecd781220 100644 --- a/src/backend/utils/fmgr/funcapi.c +++ b/src/backend/utils/fmgr/funcapi.c @@ -7,7 +7,7 @@ * Copyright (c) 2002-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/fmgr/funcapi.c,v 1.44 2009/01/01 17:23:51 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/fmgr/funcapi.c,v 1.45 2009/06/11 14:49:05 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -64,8 +64,8 @@ init_MultiFuncCall(PG_FUNCTION_ARGS) /* * First call */ - ReturnSetInfo *rsi = (ReturnSetInfo *) fcinfo->resultinfo; - MemoryContext multi_call_ctx; + ReturnSetInfo *rsi = (ReturnSetInfo *) fcinfo->resultinfo; + MemoryContext multi_call_ctx; /* * Create a suitably long-lived context to hold cross-call data diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c index 2fcb23628d..7bdfb67204 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/init/miscinit.c,v 1.174 2009/04/08 09:50:48 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/utils/init/miscinit.c,v 1.175 2009/06/11 14:49:05 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -363,7 +363,7 @@ SetSessionUserId(Oid userid, bool is_superuser) * ever throw any kind of error. This is because they are used by * StartTransaction and AbortTransaction to save/restore the settings, * and during the first transaction within a backend, the value to be saved - * and perhaps restored is indeed invalid. We have to be able to get + * and perhaps restored is indeed invalid. We have to be able to get * through AbortTransaction without asserting in case InitPostgres fails. */ void @@ -1170,7 +1170,7 @@ load_libraries(const char *libraries, const char *gucname, bool restricted) /* * Choose notice level: avoid repeat messages when re-loading a library - * that was preloaded into the postmaster. (Only possible in EXEC_BACKEND + * that was preloaded into the postmaster. (Only possible in EXEC_BACKEND * configurations) */ #ifdef EXEC_BACKEND @@ -1238,7 +1238,7 @@ pg_bindtextdomain(const char *domain) #ifdef ENABLE_NLS if (my_exec_path[0] != '\0') { - char locale_path[MAXPGPATH]; + char locale_path[MAXPGPATH]; get_locale_path(my_exec_path, locale_path); bindtextdomain(domain, locale_path); diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 9b48b7671d..34685cba3c 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.190 2009/04/08 13:08:09 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.191 2009/06/11 14:49:05 momjian Exp $ * * *------------------------------------------------------------------------- @@ -242,25 +242,25 @@ CheckMyDatabase(const char *name, bool am_superuser) /* If we have no other source of client_encoding, use server encoding */ SetConfigOption("client_encoding", GetDatabaseEncodingName(), PGC_BACKEND, PGC_S_DEFAULT); - - /* assign locale variables */ + + /* assign locale variables */ collate = NameStr(dbform->datcollate); ctype = NameStr(dbform->datctype); - + if (setlocale(LC_COLLATE, collate) == NULL) - ereport(FATAL, + ereport(FATAL, (errmsg("database locale is incompatible with operating system"), - errdetail("The database was initialized with LC_COLLATE \"%s\", " - " which is not recognized by setlocale().", collate), - errhint("Recreate the database with another locale or install the missing locale."))); - + errdetail("The database was initialized with LC_COLLATE \"%s\", " + " which is not recognized by setlocale().", collate), + errhint("Recreate the database with another locale or install the missing locale."))); + if (setlocale(LC_CTYPE, ctype) == NULL) - ereport(FATAL, + ereport(FATAL, (errmsg("database locale is incompatible with operating system"), - errdetail("The database was initialized with LC_CTYPE \"%s\", " - " which is not recognized by setlocale().", ctype), - errhint("Recreate the database with another locale or install the missing locale."))); - + errdetail("The database was initialized with LC_CTYPE \"%s\", " + " which is not recognized by setlocale().", ctype), + errhint("Recreate the database with another locale or install the missing locale."))); + /* Make the locale settings visible as GUC variables, too */ SetConfigOption("lc_collate", collate, PGC_INTERNAL, PGC_S_OVERRIDE); SetConfigOption("lc_ctype", ctype, PGC_INTERNAL, PGC_S_OVERRIDE); @@ -623,7 +623,7 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username, MyProcPort->canAcceptConnections == CAC_WAITBACKUP) ereport(FATAL, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("must be superuser to connect during database shutdown"))); + errmsg("must be superuser to connect during database shutdown"))); /* * Check a normal user hasn't connected to a superuser reserved slot. diff --git a/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c b/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c index dfc1671604..ab149f7e39 100644 --- a/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c +++ b/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c,v 1.20 2009/02/28 18:49:42 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c,v 1.21 2009/06/11 14:49:06 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -278,8 +278,8 @@ win866_to_win1251(PG_FUNCTION_ARGS) /* * Note: There are a few characters like the "Numero" sign that exist in * all the other cyrillic encodings (win1251, ISO_8859-5 and cp866), but - * not in KOI8R. As we use MULE_INTERNAL/KOI8R as an intermediary, we - * will fail to convert those characters. + * not in KOI8R. As we use MULE_INTERNAL/KOI8R as an intermediary, we will + * fail to convert those characters. */ buf = palloc(len * ENCODING_GROWTH_RATE + 1); win8662mic(src, buf, len); diff --git a/src/backend/utils/mb/mbutils.c b/src/backend/utils/mb/mbutils.c index 5dcf922794..9a73901953 100644 --- a/src/backend/utils/mb/mbutils.c +++ b/src/backend/utils/mb/mbutils.c @@ -4,7 +4,7 @@ * * Tatsuo Ishii * - * $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.86 2009/04/24 08:43:50 mha Exp $ + * $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.87 2009/06/11 14:49:05 momjian Exp $ */ #include "postgres.h" @@ -30,7 +30,7 @@ /* * We maintain a simple linked list caching the fmgr lookup info for the * currently selected conversion functions, as well as any that have been - * selected previously in the current session. (We remember previous + * selected previously in the current session. (We remember previous * settings because we must be able to restore a previous setting during * transaction rollback, without doing any fresh catalog accesses.) * @@ -40,7 +40,7 @@ typedef struct ConvProcInfo { int s_encoding; /* server and client encoding IDs */ int c_encoding; - FmgrInfo to_server_info; /* lookup info for conversion procs */ + FmgrInfo to_server_info; /* lookup info for conversion procs */ FmgrInfo to_client_info; } ConvProcInfo; @@ -119,9 +119,9 @@ SetClientEncoding(int encoding, bool doit) { /* * If we're in a live transaction, it's safe to access the catalogs, - * so look up the functions. We repeat the lookup even if the info - * is already cached, so that we can react to changes in the contents - * of pg_conversion. + * so look up the functions. We repeat the lookup even if the info is + * already cached, so that we can react to changes in the contents of + * pg_conversion. */ Oid to_server_proc, to_client_proc; @@ -168,8 +168,8 @@ SetClientEncoding(int encoding, bool doit) ToClientConvProc = &convinfo->to_client_info; /* - * Remove any older entry for the same encoding pair (this is just - * to avoid memory leakage). + * Remove any older entry for the same encoding pair (this is just to + * avoid memory leakage). */ foreach(lc, ConvProcList) { @@ -191,10 +191,10 @@ SetClientEncoding(int encoding, bool doit) else { /* - * If we're not in a live transaction, the only thing we can do - * is restore a previous setting using the cache. This covers all - * transaction-rollback cases. The only case it might not work for - * is trying to change client_encoding on the fly by editing + * If we're not in a live transaction, the only thing we can do is + * restore a previous setting using the cache. This covers all + * transaction-rollback cases. The only case it might not work for is + * trying to change client_encoding on the fly by editing * postgresql.conf and SIGHUP'ing. Which would probably be a stupid * thing to do anyway. */ @@ -275,7 +275,7 @@ pg_get_client_encoding_name(void) * * CAUTION: although the presence of a length argument means that callers * can pass non-null-terminated strings, care is required because the same - * string will be passed back if no conversion occurs. Such callers *must* + * string will be passed back if no conversion occurs. Such callers *must* * check whether result == src and handle that case differently. * * Note: we try to avoid raising error, since that could get us into @@ -622,21 +622,22 @@ perform_default_encoding_conversion(const char *src, int len, bool is_client_to_ size_t wchar2char(char *to, const wchar_t *from, size_t tolen) { - size_t result; - + size_t result; + if (tolen == 0) return 0; #ifdef WIN32 + /* - * On Windows, the "Unicode" locales assume UTF16 not UTF8 encoding, - * and for some reason mbstowcs and wcstombs won't do this for us, - * so we use MultiByteToWideChar(). + * On Windows, the "Unicode" locales assume UTF16 not UTF8 encoding, and + * for some reason mbstowcs and wcstombs won't do this for us, so we use + * MultiByteToWideChar(). */ if (GetDatabaseEncoding() == PG_UTF8) { result = WideCharToMultiByte(CP_UTF8, 0, from, -1, to, tolen, - NULL, NULL); + NULL, NULL); /* A zero return is failure */ if (result <= 0) result = -1; @@ -650,7 +651,7 @@ wchar2char(char *to, const wchar_t *from, size_t tolen) else #endif /* WIN32 */ { - Assert( !lc_ctype_is_c() ); + Assert(!lc_ctype_is_c()); result = wcstombs(to, from, tolen); } return result; @@ -701,7 +702,7 @@ char2wchar(wchar_t *to, size_t tolen, const char *from, size_t fromlen) /* mbstowcs requires ending '\0' */ char *str = pnstrdup(from, fromlen); - Assert( !lc_ctype_is_c() ); + Assert(!lc_ctype_is_c()); result = mbstowcs(to, str, tolen); pfree(str); } @@ -722,11 +723,10 @@ char2wchar(wchar_t *to, size_t tolen, const char *from, size_t fromlen) (errcode(ERRCODE_CHARACTER_NOT_IN_REPERTOIRE), errmsg("invalid multibyte character for locale"), errhint("The server's LC_CTYPE locale is probably incompatible with the database encoding."))); - } + } return result; } - #endif /* convert a multibyte string to a wchar */ @@ -907,19 +907,18 @@ void pg_bind_textdomain_codeset(const char *domainname) { #if defined(ENABLE_NLS) - int encoding = GetDatabaseEncoding(); - int i; + int encoding = GetDatabaseEncoding(); + int i; /* - * gettext() uses the codeset specified by LC_CTYPE by default, - * so if that matches the database encoding we don't need to do - * anything. In CREATE DATABASE, we enforce or trust that the - * locale's codeset matches database encoding, except for the C - * locale. In C locale, we bind gettext() explicitly to the right - * codeset. + * gettext() uses the codeset specified by LC_CTYPE by default, so if that + * matches the database encoding we don't need to do anything. In CREATE + * DATABASE, we enforce or trust that the locale's codeset matches + * database encoding, except for the C locale. In C locale, we bind + * gettext() explicitly to the right codeset. * - * On Windows, though, gettext() tends to get confused so we always - * bind it. + * On Windows, though, gettext() tends to get confused so we always bind + * it. */ #ifndef WIN32 const char *ctype = setlocale(LC_CTYPE, NULL); diff --git a/src/backend/utils/mb/wchar.c b/src/backend/utils/mb/wchar.c index 8da81b9f22..9bff635b88 100644 --- a/src/backend/utils/mb/wchar.c +++ b/src/backend/utils/mb/wchar.c @@ -1,7 +1,7 @@ /* * conversion functions between pg_wchar and multibyte streams. * Tatsuo Ishii - * $PostgreSQL: pgsql/src/backend/utils/mb/wchar.c,v 1.72 2009/03/02 21:18:43 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/mb/wchar.c,v 1.73 2009/06/11 14:49:05 momjian Exp $ * */ /* can be used in either frontend or backend */ @@ -1339,7 +1339,7 @@ pg_utf8_islegal(const unsigned char *source, int length) *------------------------------------------------------------------- */ pg_wchar_tbl pg_wchar_table[] = { - {pg_ascii2wchar_with_len, pg_ascii_mblen, pg_ascii_dsplen, pg_ascii_verifier, 1}, /* PG_SQL_ASCII */ + {pg_ascii2wchar_with_len, pg_ascii_mblen, pg_ascii_dsplen, pg_ascii_verifier, 1}, /* PG_SQL_ASCII */ {pg_eucjp2wchar_with_len, pg_eucjp_mblen, pg_eucjp_dsplen, pg_eucjp_verifier, 3}, /* PG_EUC_JP */ {pg_euccn2wchar_with_len, pg_euccn_mblen, pg_euccn_dsplen, pg_euccn_verifier, 2}, /* PG_EUC_CN */ {pg_euckr2wchar_with_len, pg_euckr_mblen, pg_euckr_dsplen, pg_euckr_verifier, 3}, /* PG_EUC_KR */ @@ -1638,10 +1638,10 @@ report_untranslatable_char(int src_encoding, int dest_encoding, ereport(ERROR, (errcode(ERRCODE_UNTRANSLATABLE_CHARACTER), - errmsg("character 0x%s of encoding \"%s\" has no equivalent in \"%s\"", - buf, - pg_enc2name_tbl[src_encoding].name, - pg_enc2name_tbl[dest_encoding].name))); + errmsg("character 0x%s of encoding \"%s\" has no equivalent in \"%s\"", + buf, + pg_enc2name_tbl[src_encoding].name, + pg_enc2name_tbl[dest_encoding].name))); } #endif diff --git a/src/backend/utils/mb/wstrcmp.c b/src/backend/utils/mb/wstrcmp.c index 2bd55d1bee..22cd7e93c0 100644 --- a/src/backend/utils/mb/wstrcmp.c +++ b/src/backend/utils/mb/wstrcmp.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/backend/utils/mb/wstrcmp.c,v 1.9 2008/05/17 01:28:24 adunstan Exp $ + * $PostgreSQL: pgsql/src/backend/utils/mb/wstrcmp.c,v 1.10 2009/06/11 14:49:06 momjian Exp $ * *- * Copyright (c) 1990, 1993 diff --git a/src/backend/utils/mb/wstrncmp.c b/src/backend/utils/mb/wstrncmp.c index 3de672c779..60400e903b 100644 --- a/src/backend/utils/mb/wstrncmp.c +++ b/src/backend/utils/mb/wstrncmp.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/backend/utils/mb/wstrncmp.c,v 1.9 2008/05/17 01:28:24 adunstan Exp $ + * $PostgreSQL: pgsql/src/backend/utils/mb/wstrncmp.c,v 1.10 2009/06/11 14:49:06 momjian Exp $ * * * Copyright (c) 1989, 1993 diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 41368bf1e9..210bd6ba6a 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut <peter_e@gmx.net>. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.504 2009/05/03 20:09:54 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.505 2009/06/11 14:49:06 momjian Exp $ * *-------------------------------------------------------------------- */ @@ -139,7 +139,7 @@ static const char *assign_log_destination(const char *value, static int syslog_facility = LOG_LOCAL0; static bool assign_syslog_facility(int newval, - bool doit, GucSource source); + bool doit, GucSource source); static const char *assign_syslog_ident(const char *ident, bool doit, GucSource source); #endif @@ -169,9 +169,9 @@ static bool assign_autovacuum_max_workers(int newval, bool doit, GucSource sourc static bool assign_effective_io_concurrency(int newval, bool doit, GucSource source); static const char *assign_pgstat_temp_directory(const char *newval, bool doit, GucSource source); -static char *config_enum_get_options(struct config_enum *record, - const char *prefix, const char *suffix, - const char *separator); +static char *config_enum_get_options(struct config_enum * record, + const char *prefix, const char *suffix, + const char *separator); /* @@ -242,10 +242,10 @@ static const struct config_enum_entry log_statement_options[] = { }; static const struct config_enum_entry regex_flavor_options[] = { - {"advanced", REG_ADVANCED, false}, - {"extended", REG_EXTENDED, false}, - {"basic", REG_BASIC, false}, - {NULL, 0, false} + {"advanced", REG_ADVANCED, false}, + {"extended", REG_EXTENDED, false}, + {"basic", REG_BASIC, false}, + {NULL, 0, false} }; static const struct config_enum_entry isolation_level_options[] = { @@ -1715,11 +1715,11 @@ static struct config_int ConfigureNamesInt[] = { {"effective_io_concurrency", #ifdef USE_PREFETCH - PGC_USERSET, + PGC_USERSET, #else - PGC_INTERNAL, + PGC_INTERNAL, #endif - RESOURCES, + RESOURCES, gettext_noop("Number of simultaneous requests that can be handled efficiently by the disk subsystem."), gettext_noop("For RAID arrays, this should be approximately the number of drive spindles in the array.") }, @@ -1794,9 +1794,9 @@ static struct config_int ConfigureNamesInt[] = { {"segment_size", PGC_INTERNAL, PRESET_OPTIONS, - gettext_noop("Shows the number of pages per disk file."), - NULL, - GUC_UNIT_BLOCKS | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE + gettext_noop("Shows the number of pages per disk file."), + NULL, + GUC_UNIT_BLOCKS | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE }, &segment_size, RELSEG_SIZE, RELSEG_SIZE, RELSEG_SIZE, NULL, NULL @@ -1819,8 +1819,8 @@ static struct config_int ConfigureNamesInt[] = GUC_UNIT_XBLOCKS | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE }, &wal_segment_size, - (XLOG_SEG_SIZE / XLOG_BLCKSZ), - (XLOG_SEG_SIZE / XLOG_BLCKSZ), + (XLOG_SEG_SIZE / XLOG_BLCKSZ), + (XLOG_SEG_SIZE / XLOG_BLCKSZ), (XLOG_SEG_SIZE / XLOG_BLCKSZ), NULL, NULL }, @@ -2562,7 +2562,7 @@ static struct config_enum ConfigureNamesEnum[] = XACT_READ_COMMITTED, isolation_level_options, NULL, NULL }, - { + { {"IntervalStyle", PGC_USERSET, CLIENT_CONN_LOCALE, gettext_noop("Sets the display format for interval values."), NULL, @@ -2655,7 +2655,7 @@ static struct config_enum ConfigureNamesEnum[] = NULL }, &sync_method, - DEFAULT_SYNC_METHOD, sync_method_options, + DEFAULT_SYNC_METHOD, sync_method_options, assign_xlog_sync_method, NULL }, @@ -2722,7 +2722,7 @@ static int GUCNestLevel = 0; /* 1 when in main transaction */ static int guc_var_compare(const void *a, const void *b); static int guc_name_compare(const char *namea, const char *nameb); -static void InitializeOneGUCOption(struct config_generic *gconf); +static void InitializeOneGUCOption(struct config_generic * gconf); static void push_old_value(struct config_generic * gconf, GucAction action); static void ReportGUCOption(struct config_generic * record); static void ShowGUCConfigOption(const char *name, DestReceiver *dest); @@ -2853,7 +2853,7 @@ set_stack_value(struct config_generic * gconf, union config_var_value * val) *((struct config_string *) gconf)->variable); break; case PGC_ENUM: - val->enumval = + val->enumval = *((struct config_enum *) gconf)->variable; break; } @@ -3290,7 +3290,7 @@ InitializeGUCOptions(void) * Initialize one GUC option variable to its compiled-in default. */ static void -InitializeOneGUCOption(struct config_generic *gconf) +InitializeOneGUCOption(struct config_generic * gconf) { gconf->status = 0; gconf->reset_source = PGC_S_DEFAULT; @@ -3302,100 +3302,100 @@ InitializeOneGUCOption(struct config_generic *gconf) switch (gconf->vartype) { case PGC_BOOL: - { - struct config_bool *conf = (struct config_bool *) gconf; - - if (conf->assign_hook) - if (!(*conf->assign_hook) (conf->boot_val, true, - PGC_S_DEFAULT)) - elog(FATAL, "failed to initialize %s to %d", - conf->gen.name, (int) conf->boot_val); - *conf->variable = conf->reset_val = conf->boot_val; - break; - } - case PGC_INT: - { - struct config_int *conf = (struct config_int *) gconf; - - Assert(conf->boot_val >= conf->min); - Assert(conf->boot_val <= conf->max); - if (conf->assign_hook) - if (!(*conf->assign_hook) (conf->boot_val, true, - PGC_S_DEFAULT)) - elog(FATAL, "failed to initialize %s to %d", - conf->gen.name, conf->boot_val); - *conf->variable = conf->reset_val = conf->boot_val; - break; - } - case PGC_REAL: - { - struct config_real *conf = (struct config_real *) gconf; - - Assert(conf->boot_val >= conf->min); - Assert(conf->boot_val <= conf->max); - if (conf->assign_hook) - if (!(*conf->assign_hook) (conf->boot_val, true, - PGC_S_DEFAULT)) - elog(FATAL, "failed to initialize %s to %g", - conf->gen.name, conf->boot_val); - *conf->variable = conf->reset_val = conf->boot_val; - break; - } - case PGC_STRING: - { - struct config_string *conf = (struct config_string *) gconf; - char *str; - - *conf->variable = NULL; - conf->reset_val = NULL; - - if (conf->boot_val == NULL) { - /* leave the value NULL, do not call assign hook */ + struct config_bool *conf = (struct config_bool *) gconf; + + if (conf->assign_hook) + if (!(*conf->assign_hook) (conf->boot_val, true, + PGC_S_DEFAULT)) + elog(FATAL, "failed to initialize %s to %d", + conf->gen.name, (int) conf->boot_val); + *conf->variable = conf->reset_val = conf->boot_val; break; } + case PGC_INT: + { + struct config_int *conf = (struct config_int *) gconf; - str = guc_strdup(FATAL, conf->boot_val); - conf->reset_val = str; + Assert(conf->boot_val >= conf->min); + Assert(conf->boot_val <= conf->max); + if (conf->assign_hook) + if (!(*conf->assign_hook) (conf->boot_val, true, + PGC_S_DEFAULT)) + elog(FATAL, "failed to initialize %s to %d", + conf->gen.name, conf->boot_val); + *conf->variable = conf->reset_val = conf->boot_val; + break; + } + case PGC_REAL: + { + struct config_real *conf = (struct config_real *) gconf; - if (conf->assign_hook) + Assert(conf->boot_val >= conf->min); + Assert(conf->boot_val <= conf->max); + if (conf->assign_hook) + if (!(*conf->assign_hook) (conf->boot_val, true, + PGC_S_DEFAULT)) + elog(FATAL, "failed to initialize %s to %g", + conf->gen.name, conf->boot_val); + *conf->variable = conf->reset_val = conf->boot_val; + break; + } + case PGC_STRING: { - const char *newstr; + struct config_string *conf = (struct config_string *) gconf; + char *str; + + *conf->variable = NULL; + conf->reset_val = NULL; - newstr = (*conf->assign_hook) (str, true, - PGC_S_DEFAULT); - if (newstr == NULL) + if (conf->boot_val == NULL) { - elog(FATAL, "failed to initialize %s to \"%s\"", - conf->gen.name, str); + /* leave the value NULL, do not call assign hook */ + break; } - else if (newstr != str) + + str = guc_strdup(FATAL, conf->boot_val); + conf->reset_val = str; + + if (conf->assign_hook) { - free(str); + const char *newstr; - /* - * See notes in set_config_option about casting - */ - str = (char *) newstr; - conf->reset_val = str; + newstr = (*conf->assign_hook) (str, true, + PGC_S_DEFAULT); + if (newstr == NULL) + { + elog(FATAL, "failed to initialize %s to \"%s\"", + conf->gen.name, str); + } + else if (newstr != str) + { + free(str); + + /* + * See notes in set_config_option about casting + */ + str = (char *) newstr; + conf->reset_val = str; + } } + *conf->variable = str; + break; } - *conf->variable = str; - break; - } case PGC_ENUM: - { - struct config_enum *conf = (struct config_enum *) gconf; - - if (conf->assign_hook) - if (!(*conf->assign_hook) (conf->boot_val, true, - PGC_S_DEFAULT)) - elog(FATAL, "failed to initialize %s to %s", - conf->gen.name, - config_enum_lookup_by_value(conf, conf->boot_val)); - *conf->variable = conf->reset_val = conf->boot_val; - break; - } + { + struct config_enum *conf = (struct config_enum *) gconf; + + if (conf->assign_hook) + if (!(*conf->assign_hook) (conf->boot_val, true, + PGC_S_DEFAULT)) + elog(FATAL, "failed to initialize %s to %s", + conf->gen.name, + config_enum_lookup_by_value(conf, conf->boot_val)); + *conf->variable = conf->reset_val = conf->boot_val; + break; + } } } @@ -4009,13 +4009,13 @@ AtEOXact_GUC(bool isCommit, int nestLevel) case PGC_ENUM: { struct config_enum *conf = (struct config_enum *) gconf; - int newval = newvalue.enumval; + int newval = newvalue.enumval; if (*conf->variable != newval) { if (conf->assign_hook) if (!(*conf->assign_hook) (newval, - true, PGC_S_OVERRIDE)) + true, PGC_S_OVERRIDE)) elog(LOG, "failed to commit %s as %s", conf->gen.name, config_enum_lookup_by_value(conf, newval)); @@ -4351,7 +4351,7 @@ parse_real(const char *value, double *result) * allocated for modification. */ const char * -config_enum_lookup_by_value(struct config_enum *record, int val) +config_enum_lookup_by_value(struct config_enum * record, int val) { const struct config_enum_entry *entry; @@ -4363,7 +4363,7 @@ config_enum_lookup_by_value(struct config_enum *record, int val) elog(ERROR, "could not find enum option %d for %s", val, record->gen.name); - return NULL; /* silence compiler */ + return NULL; /* silence compiler */ } @@ -4374,7 +4374,7 @@ config_enum_lookup_by_value(struct config_enum *record, int val) * true. If it's not found, return FALSE and retval is set to 0. */ bool -config_enum_lookup_by_name(struct config_enum *record, const char *value, +config_enum_lookup_by_name(struct config_enum * record, const char *value, int *retval) { const struct config_enum_entry *entry; @@ -4400,16 +4400,16 @@ config_enum_lookup_by_name(struct config_enum *record, const char *value, * If suffix is non-NULL, it is added to the end of the string. */ static char * -config_enum_get_options(struct config_enum *record, const char *prefix, +config_enum_get_options(struct config_enum * record, const char *prefix, const char *suffix, const char *separator) { const struct config_enum_entry *entry; - StringInfoData retstr; + StringInfoData retstr; int seplen; initStringInfo(&retstr); appendStringInfoString(&retstr, prefix); - + seplen = strlen(separator); for (entry = record->options; entry && entry->name; entry++) { @@ -4421,11 +4421,11 @@ config_enum_get_options(struct config_enum *record, const char *prefix, } /* - * All the entries may have been hidden, leaving the string empty - * if no prefix was given. This indicates a broken GUC setup, since - * there is no use for an enum without any values, so we just check - * to make sure we don't write to invalid memory instead of actually - * trying to do something smart with it. + * All the entries may have been hidden, leaving the string empty if no + * prefix was given. This indicates a broken GUC setup, since there is no + * use for an enum without any values, so we just check to make sure we + * don't write to invalid memory instead of actually trying to do + * something smart with it. */ if (retstr.len >= seplen) { @@ -4565,8 +4565,8 @@ set_config_option(const char *name, const char *value, if (changeVal && !is_newvalue_equal(record, value)) ereport(elevel, (errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM), - errmsg("attempted change of parameter \"%s\" ignored", - name), + errmsg("attempted change of parameter \"%s\" ignored", + name), errdetail("This parameter cannot be changed after server start."))); return true; } @@ -4574,8 +4574,8 @@ set_config_option(const char *name, const char *value, { ereport(elevel, (errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM), - errmsg("attempted change of parameter \"%s\" ignored", - name), + errmsg("attempted change of parameter \"%s\" ignored", + name), errdetail("This parameter cannot be changed after server start."))); return false; } @@ -5004,16 +5004,16 @@ set_config_option(const char *name, const char *value, { if (!config_enum_lookup_by_name(conf, value, &newval)) { - char *hintmsg; - - hintmsg = config_enum_get_options(conf, - "Available values: ", + char *hintmsg; + + hintmsg = config_enum_get_options(conf, + "Available values: ", ".", ", "); ereport(elevel, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid value for parameter \"%s\": \"%s\"", - name, value), + errmsg("invalid value for parameter \"%s\": \"%s\"", + name, value), hintmsg ? errhint("%s", _(hintmsg)) : 0)); if (hintmsg) @@ -5038,9 +5038,9 @@ set_config_option(const char *name, const char *value, { ereport(elevel, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid value for parameter \"%s\": \"%s\"", - name, - config_enum_lookup_by_value(conf, newval)))); + errmsg("invalid value for parameter \"%s\": \"%s\"", + name, + config_enum_lookup_by_value(conf, newval)))); return false; } @@ -5088,8 +5088,8 @@ set_config_sourcefile(const char *name, char *sourcefile, int sourceline) int elevel; /* - * To avoid cluttering the log, only the postmaster bleats loudly - * about problems with the config file. + * To avoid cluttering the log, only the postmaster bleats loudly about + * problems with the config file. */ elevel = IsUnderPostmaster ? DEBUG3 : LOG; @@ -5166,7 +5166,7 @@ GetConfigOption(const char *name) case PGC_ENUM: return config_enum_lookup_by_value((struct config_enum *) record, - *((struct config_enum *) record)->variable); + *((struct config_enum *) record)->variable); } return NULL; } @@ -5214,7 +5214,7 @@ GetConfigOptionResetString(const char *name) case PGC_ENUM: return config_enum_lookup_by_value((struct config_enum *) record, - ((struct config_enum *) record)->reset_val); + ((struct config_enum *) record)->reset_val); } return NULL; } @@ -5244,7 +5244,7 @@ IsSuperuserConfigOption(const char *name) * report (in addition to the generic "invalid value for option FOO" that * guc.c will provide). Note that the result might be ERROR or a lower * level, so the caller must be prepared for control to return from ereport, - * or not. If control does return, return false/NULL from the hook function. + * or not. If control does return, return false/NULL from the hook function. * * At some point it'd be nice to replace this with a mechanism that allows * the custom message to become the DETAIL line of guc.c's generic message. @@ -5266,9 +5266,9 @@ GUC_complaint_elevel(GucSource source) { /* * If we're a postmaster child, this is probably "undo" during - * transaction abort, so we don't want to clutter the log. There's - * a small chance of a real problem with an OVERRIDE setting, - * though, so suppressing the message entirely wouldn't be desirable. + * transaction abort, so we don't want to clutter the log. There's a + * small chance of a real problem with an OVERRIDE setting, though, so + * suppressing the message entirely wouldn't be desirable. */ elevel = IsUnderPostmaster ? DEBUG5 : LOG; } @@ -5324,22 +5324,22 @@ flatten_set_variable_args(const char *name, List *args) /* * Each list member may be a plain A_Const node, or an A_Const within a - * TypeCast; the latter case is supported only for ConstInterval - * arguments (for SET TIME ZONE). + * TypeCast; the latter case is supported only for ConstInterval arguments + * (for SET TIME ZONE). */ foreach(l, args) { - Node *arg = (Node *) lfirst(l); + Node *arg = (Node *) lfirst(l); char *val; TypeName *typename = NULL; - A_Const *con; + A_Const *con; if (l != list_head(args)) appendStringInfo(&buf, ", "); if (IsA(arg, TypeCast)) { - TypeCast *tc = (TypeCast *) arg; + TypeCast *tc = (TypeCast *) arg; arg = tc->arg; typename = tc->typename; @@ -5597,11 +5597,11 @@ init_custom_variable(const char *name, struct config_generic *gen; /* - * Only allow custom PGC_POSTMASTER variables to be created during - * shared library preload; any later than that, we can't ensure that - * the value doesn't change after startup. This is a fatal elog if it - * happens; just erroring out isn't safe because we don't know what - * the calling loadable module might already have hooked into. + * Only allow custom PGC_POSTMASTER variables to be created during shared + * library preload; any later than that, we can't ensure that the value + * doesn't change after startup. This is a fatal elog if it happens; just + * erroring out isn't safe because we don't know what the calling loadable + * module might already have hooked into. */ if (context == PGC_POSTMASTER && !process_shared_preload_libraries_in_progress) @@ -5632,7 +5632,7 @@ define_custom_variable(struct config_generic * variable) const char **nameAddr = &name; const char *value; struct config_string *pHolder; - GucContext phcontext; + GucContext phcontext; struct config_generic **res; /* @@ -5679,9 +5679,9 @@ define_custom_variable(struct config_generic * variable) *res = variable; /* - * Infer context for assignment based on source of existing value. - * We can't tell this with exact accuracy, but we can at least do - * something reasonable in typical cases. + * Infer context for assignment based on source of existing value. We + * can't tell this with exact accuracy, but we can at least do something + * reasonable in typical cases. */ switch (pHolder->gen.source) { @@ -5689,10 +5689,11 @@ define_custom_variable(struct config_generic * variable) case PGC_S_ENV_VAR: case PGC_S_FILE: case PGC_S_ARGV: + /* - * If we got past the check in init_custom_variable, we can - * safely assume that any existing value for a PGC_POSTMASTER - * variable was set in postmaster context. + * If we got past the check in init_custom_variable, we can safely + * assume that any existing value for a PGC_POSTMASTER variable + * was set in postmaster context. */ if (variable->context == PGC_POSTMASTER) phcontext = PGC_POSTMASTER; @@ -5852,7 +5853,7 @@ DefineCustomEnumVariable(const char *name, const char *long_desc, int *valueAddr, int bootValue, - const struct config_enum_entry *options, + const struct config_enum_entry * options, GucContext context, int flags, GucEnumAssignHook assign_hook, @@ -6165,13 +6166,13 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow) /* enumvals */ values[11] = NULL; - /* boot_val */ - snprintf(buffer, sizeof(buffer), "%d", lconf->boot_val); - values[12] = pstrdup(buffer); + /* boot_val */ + snprintf(buffer, sizeof(buffer), "%d", lconf->boot_val); + values[12] = pstrdup(buffer); - /* reset_val */ - snprintf(buffer, sizeof(buffer), "%d", lconf->reset_val); - values[13] = pstrdup(buffer); + /* reset_val */ + snprintf(buffer, sizeof(buffer), "%d", lconf->reset_val); + values[13] = pstrdup(buffer); } break; @@ -6190,19 +6191,19 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow) /* enumvals */ values[11] = NULL; - /* boot_val */ - snprintf(buffer, sizeof(buffer), "%g", lconf->boot_val); - values[12] = pstrdup(buffer); + /* boot_val */ + snprintf(buffer, sizeof(buffer), "%g", lconf->boot_val); + values[12] = pstrdup(buffer); - /* reset_val */ - snprintf(buffer, sizeof(buffer), "%g", lconf->reset_val); - values[13] = pstrdup(buffer); + /* reset_val */ + snprintf(buffer, sizeof(buffer), "%g", lconf->reset_val); + values[13] = pstrdup(buffer); } break; case PGC_STRING: { - struct config_string *lconf = (struct config_string *) conf; + struct config_string *lconf = (struct config_string *) conf; /* min_val */ values[9] = NULL; @@ -6213,15 +6214,15 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow) /* enumvals */ values[11] = NULL; - /* boot_val */ - if (lconf->boot_val == NULL) - values[12] = NULL; + /* boot_val */ + if (lconf->boot_val == NULL) + values[12] = NULL; else values[12] = pstrdup(lconf->boot_val); - /* reset_val */ - if (lconf->reset_val == NULL) - values[13] = NULL; + /* reset_val */ + if (lconf->reset_val == NULL) + values[13] = NULL; else values[13] = pstrdup(lconf->reset_val); } @@ -6229,7 +6230,7 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow) case PGC_ENUM: { - struct config_enum *lconf = (struct config_enum *) conf; + struct config_enum *lconf = (struct config_enum *) conf; /* min_val */ values[9] = NULL; @@ -6238,17 +6239,21 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow) values[10] = NULL; /* enumvals */ - /* NOTE! enumvals with double quotes in them are not supported! */ + + /* + * NOTE! enumvals with double quotes in them are not + * supported! + */ values[11] = config_enum_get_options((struct config_enum *) conf, "{\"", "\"}", "\",\""); - /* boot_val */ + /* boot_val */ values[12] = pstrdup(config_enum_lookup_by_value(lconf, - lconf->boot_val)); + lconf->boot_val)); - /* reset_val */ + /* reset_val */ values[13] = pstrdup(config_enum_lookup_by_value(lconf, - lconf->reset_val)); + lconf->reset_val)); } break; @@ -6267,18 +6272,18 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow) /* enumvals */ values[11] = NULL; - /* boot_val */ - values[12] = NULL; + /* boot_val */ + values[12] = NULL; - /* reset_val */ - values[13] = NULL; + /* reset_val */ + values[13] = NULL; } break; } - /* - * If the setting came from a config file, set the source location. - * For security reasons, we don't show source file/line number for + /* + * If the setting came from a config file, set the source location. For + * security reasons, we don't show source file/line number for * non-superusers. */ if (conf->source == PGC_S_FILE && superuser()) @@ -6379,10 +6384,10 @@ show_all_settings(PG_FUNCTION_ARGS) TEXTOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 12, "enumvals", TEXTARRAYOID, -1, 0); - TupleDescInitEntry(tupdesc, (AttrNumber) 13, "boot_val", - TEXTOID, -1, 0); - TupleDescInitEntry(tupdesc, (AttrNumber) 14, "reset_val", - TEXTOID, -1, 0); + TupleDescInitEntry(tupdesc, (AttrNumber) 13, "boot_val", + TEXTOID, -1, 0); + TupleDescInitEntry(tupdesc, (AttrNumber) 14, "reset_val", + TEXTOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 15, "sourcefile", TEXTOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 16, "sourceline", @@ -6476,10 +6481,10 @@ _ShowOption(struct config_generic * record, bool use_units) { /* * Use int64 arithmetic to avoid overflows in units - * conversion. If INT64_IS_BUSTED we might overflow + * conversion. If INT64_IS_BUSTED we might overflow * anyway and print bogus answers, but there are few - * enough such machines that it doesn't seem worth - * trying harder. + * enough such machines that it doesn't seem worth trying + * harder. */ int64 result = *conf->variable; const char *unit; @@ -6592,7 +6597,7 @@ _ShowOption(struct config_generic * record, bool use_units) { struct config_enum *conf = (struct config_enum *) record; - if(conf->show_hook) + if (conf->show_hook) val = (*conf->show_hook) (); else val = config_enum_lookup_by_value(conf, *conf->variable); @@ -6681,7 +6686,7 @@ is_newvalue_equal(struct config_generic * record, const char *newvalue) * variable source, integer */ static void -write_one_nondefault_variable(FILE *fp, struct config_generic *gconf) +write_one_nondefault_variable(FILE *fp, struct config_generic * gconf) { if (gconf->source == PGC_S_DEFAULT) return; @@ -6692,49 +6697,49 @@ write_one_nondefault_variable(FILE *fp, struct config_generic *gconf) switch (gconf->vartype) { case PGC_BOOL: - { - struct config_bool *conf = (struct config_bool *) gconf; + { + struct config_bool *conf = (struct config_bool *) gconf; - if (*conf->variable) - fprintf(fp, "true"); - else - fprintf(fp, "false"); - } - break; + if (*conf->variable) + fprintf(fp, "true"); + else + fprintf(fp, "false"); + } + break; case PGC_INT: - { - struct config_int *conf = (struct config_int *) gconf; + { + struct config_int *conf = (struct config_int *) gconf; - fprintf(fp, "%d", *conf->variable); - } - break; + fprintf(fp, "%d", *conf->variable); + } + break; case PGC_REAL: - { - struct config_real *conf = (struct config_real *) gconf; + { + struct config_real *conf = (struct config_real *) gconf; - /* Could lose precision here? */ - fprintf(fp, "%f", *conf->variable); - } - break; + /* Could lose precision here? */ + fprintf(fp, "%f", *conf->variable); + } + break; case PGC_STRING: - { - struct config_string *conf = (struct config_string *) gconf; + { + struct config_string *conf = (struct config_string *) gconf; - fprintf(fp, "%s", *conf->variable); - } - break; + fprintf(fp, "%s", *conf->variable); + } + break; case PGC_ENUM: - { - struct config_enum *conf = (struct config_enum *) gconf; - - fprintf(fp, "%s", - config_enum_lookup_by_value(conf, *conf->variable)); - } - break; + { + struct config_enum *conf = (struct config_enum *) gconf; + + fprintf(fp, "%s", + config_enum_lookup_by_value(conf, *conf->variable)); + } + break; } fputc(0, fp); @@ -7157,7 +7162,7 @@ assign_log_destination(const char *value, bool doit, GucSource source) list_free(elemlist); ereport(GUC_complaint_elevel(source), (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid list syntax for parameter \"log_destination\""))); + errmsg("invalid list syntax for parameter \"log_destination\""))); return NULL; } @@ -7573,11 +7578,11 @@ assign_effective_io_concurrency(int newval, bool doit, GucSource source) * * drives | I/O requests * -------+---------------- - * 1 | 1 - * 2 | 2/1 + 2/2 = 3 - * 3 | 3/1 + 3/2 + 3/3 = 5 1/2 - * 4 | 4/1 + 4/2 + 4/3 + 4/4 = 8 1/3 - * n | n * H(n) + * 1 | 1 + * 2 | 2/1 + 2/2 = 3 + * 3 | 3/1 + 3/2 + 3/3 = 5 1/2 + * 4 | 4/1 + 4/2 + 4/3 + 4/4 = 8 1/3 + * n | n * H(n) * * This is called the "coupon collector problem" and H(n) is called the * harmonic series. This could be approximated by n * ln(n), but for @@ -7610,7 +7615,7 @@ assign_effective_io_concurrency(int newval, bool doit, GucSource source) return false; #else return true; -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ } static const char * @@ -7624,9 +7629,9 @@ assign_pgstat_temp_directory(const char *newval, bool doit, GucSource source) canonicalize_path(canon_val); - tname = guc_malloc(ERROR, strlen(canon_val) + 12); /* /pgstat.tmp */ + tname = guc_malloc(ERROR, strlen(canon_val) + 12); /* /pgstat.tmp */ sprintf(tname, "%s/pgstat.tmp", canon_val); - fname = guc_malloc(ERROR, strlen(canon_val) + 13); /* /pgstat.stat */ + fname = guc_malloc(ERROR, strlen(canon_val) + 13); /* /pgstat.stat */ sprintf(fname, "%s/pgstat.stat", canon_val); if (pgstat_stat_tmpname) diff --git a/src/backend/utils/misc/help_config.c b/src/backend/utils/misc/help_config.c index d0311f31b6..d3311669a0 100644 --- a/src/backend/utils/misc/help_config.c +++ b/src/backend/utils/misc/help_config.c @@ -10,7 +10,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/misc/help_config.c,v 1.22 2009/01/01 17:23:53 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/misc/help_config.c,v 1.23 2009/06/11 14:49:06 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -124,7 +124,7 @@ printMixedStruct(mixedStruct *structToPrint) case PGC_ENUM: printf("ENUM\t%s\t\t\t", config_enum_lookup_by_value(&structToPrint->_enum, - structToPrint->_enum.boot_val)); + structToPrint->_enum.boot_val)); break; default: diff --git a/src/backend/utils/mmgr/aset.c b/src/backend/utils/mmgr/aset.c index 5faf2ff760..f11e15d57c 100644 --- a/src/backend/utils/mmgr/aset.c +++ b/src/backend/utils/mmgr/aset.c @@ -11,7 +11,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/mmgr/aset.c,v 1.78 2009/01/01 17:23:53 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/mmgr/aset.c,v 1.79 2009/06/11 14:49:06 momjian Exp $ * * NOTE: * This is a new (Feb. 05, 1999) implementation of the allocation set @@ -305,8 +305,7 @@ randomize_mem(char *ptr, size_t size) } save_ctr = ctr; } - -#endif /* RANDOMIZE_ALLOCATED_MEMORY */ +#endif /* RANDOMIZE_ALLOCATED_MEMORY */ /* diff --git a/src/backend/utils/resowner/resowner.c b/src/backend/utils/resowner/resowner.c index cd96f80d44..4ef47ca560 100644 --- a/src/backend/utils/resowner/resowner.c +++ b/src/backend/utils/resowner/resowner.c @@ -14,7 +14,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/resowner/resowner.c,v 1.31 2009/01/01 17:23:53 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/resowner/resowner.c,v 1.32 2009/06/11 14:49:06 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -312,8 +312,8 @@ ResourceOwnerReleaseInternal(ResourceOwner owner, while (owner->nsnapshots > 0) { if (isCommit) - PrintSnapshotLeakWarning(owner->snapshots[owner->nsnapshots -1]); - UnregisterSnapshot(owner->snapshots[owner->nsnapshots -1]); + PrintSnapshotLeakWarning(owner->snapshots[owner->nsnapshots - 1]); + UnregisterSnapshot(owner->snapshots[owner->nsnapshots - 1]); } /* Clean up index scans too */ @@ -1005,7 +1005,7 @@ void ResourceOwnerForgetSnapshot(ResourceOwner owner, Snapshot snapshot) { Snapshot *snapshots = owner->snapshots; - int ns1 = owner->nsnapshots -1; + int ns1 = owner->nsnapshots - 1; int i; for (i = ns1; i >= 0; i--) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 92c55219d3..6d07296d59 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -91,7 +91,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/sort/tuplesort.c,v 1.90 2009/03/11 23:19:25 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/sort/tuplesort.c,v 1.91 2009/06/11 14:49:06 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -451,9 +451,9 @@ static void readtup_heap(Tuplesortstate *state, SortTuple *stup, int tapenum, unsigned int len); static void reversedirection_heap(Tuplesortstate *state); static int comparetup_index_btree(const SortTuple *a, const SortTuple *b, - Tuplesortstate *state); + Tuplesortstate *state); static int comparetup_index_hash(const SortTuple *a, const SortTuple *b, - Tuplesortstate *state); + Tuplesortstate *state); static void copytup_index(Tuplesortstate *state, SortTuple *stup, void *tup); static void writetup_index(Tuplesortstate *state, int tapenum, SortTuple *stup); @@ -578,7 +578,7 @@ tuplesort_begin_heap(TupleDesc tupDesc, state->nKeys = nkeys; TRACE_POSTGRESQL_SORT_START(HEAP_SORT, - false, /* no unique check */ + false, /* no unique check */ nkeys, workMem, randomAccess); @@ -681,7 +681,7 @@ tuplesort_begin_index_hash(Relation indexRel, #ifdef TRACE_SORT if (trace_sort) elog(LOG, - "begin index sort: hash_mask = 0x%x, workMem = %d, randomAccess = %c", + "begin index sort: hash_mask = 0x%x, workMem = %d, randomAccess = %c", hash_mask, workMem, randomAccess ? 't' : 'f'); #endif @@ -727,7 +727,7 @@ tuplesort_begin_datum(Oid datumType, state->nKeys = 1; /* always a one-column sort */ TRACE_POSTGRESQL_SORT_START(DATUM_SORT, - false, /* no unique check */ + false, /* no unique check */ 1, workMem, randomAccess); @@ -844,8 +844,8 @@ tuplesort_end(Tuplesortstate *state) #else /* - * If you disabled TRACE_SORT, you can still probe sort__done, but - * you ain't getting space-used stats. + * If you disabled TRACE_SORT, you can still probe sort__done, but you + * ain't getting space-used stats. */ TRACE_POSTGRESQL_SORT_DONE(state->tapeset != NULL, 0L); #endif @@ -2653,9 +2653,11 @@ static void writetup_heap(Tuplesortstate *state, int tapenum, SortTuple *stup) { MinimalTuple tuple = (MinimalTuple) stup->tuple; + /* the part of the MinimalTuple we'll write: */ char *tupbody = (char *) tuple + MINIMAL_TUPLE_DATA_OFFSET; unsigned int tupbodylen = tuple->t_len - MINIMAL_TUPLE_DATA_OFFSET; + /* total on-disk footprint: */ unsigned int tuplen = tupbodylen + sizeof(int); @@ -2842,8 +2844,8 @@ comparetup_index_hash(const SortTuple *a, const SortTuple *b, CHECK_FOR_INTERRUPTS(); /* - * Fetch hash keys and mask off bits we don't want to sort by. - * We know that the first column of the index tuple is the hash key. + * Fetch hash keys and mask off bits we don't want to sort by. We know + * that the first column of the index tuple is the hash key. */ Assert(!a->isnull1); hash1 = DatumGetUInt32(a->datum1) & state->hash_mask; diff --git a/src/backend/utils/sort/tuplestore.c b/src/backend/utils/sort/tuplestore.c index 10afc4851b..5b900b7a5e 100644 --- a/src/backend/utils/sort/tuplestore.c +++ b/src/backend/utils/sort/tuplestore.c @@ -29,7 +29,7 @@ * When the caller requests backward-scan capability, we write the temp file * in a format that allows either forward or backward scan. Otherwise, only * forward scan is allowed. A request for backward scan must be made before - * putting any tuples into the tuplestore. Rewind is normally allowed but + * putting any tuples into the tuplestore. Rewind is normally allowed but * can be turned off via tuplestore_set_eflags; turning off rewind for all * read pointers enables truncation of the tuplestore at the oldest read point * for minimal memory usage. (The caller must explicitly call tuplestore_trim @@ -47,7 +47,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/sort/tuplestore.c,v 1.47 2009/03/27 18:30:21 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/sort/tuplestore.c,v 1.48 2009/06/11 14:49:06 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -81,7 +81,7 @@ typedef enum * * Special case: if eof_reached is true, then the pointer's read position is * implicitly equal to the write position, and current/file/offset aren't - * maintained. This way we need not update all the read pointers each time + * maintained. This way we need not update all the read pointers each time * we write. */ typedef struct @@ -161,7 +161,7 @@ struct Tuplestorestate int readptrsize; /* allocated length of readptrs array */ int writepos_file; /* file# (valid if READFILE state) */ - off_t writepos_offset; /* offset (valid if READFILE state) */ + off_t writepos_offset; /* offset (valid if READFILE state) */ }; #define COPYTUP(state,tup) ((*(state)->copytup) (state, tup)) @@ -363,7 +363,7 @@ tuplestore_alloc_read_pointer(Tuplestorestate *state, int eflags) /* Make room for another read pointer if needed */ if (state->readptrcount >= state->readptrsize) { - int newcnt = state->readptrsize * 2; + int newcnt = state->readptrsize * 2; state->readptrs = (TSReadPointer *) repalloc(state->readptrs, newcnt * sizeof(TSReadPointer)); @@ -460,9 +460,10 @@ tuplestore_select_read_pointer(Tuplestorestate *state, int ptr) /* no work */ break; case TSS_READFILE: + /* - * First, save the current read position in the pointer about - * to become inactive. + * First, save the current read position in the pointer about to + * become inactive. */ if (!oldptr->eof_reached) BufFileTell(state->myfile, @@ -635,10 +636,11 @@ tuplestore_puttuple_common(Tuplestorestate *state, void *tuple) */ PrepareTempTablespaces(); state->myfile = BufFileCreateTemp(state->interXact); + /* - * Freeze the decision about whether trailing length words - * will be used. We can't change this choice once data is on - * tape, even though callers might drop the requirement. + * Freeze the decision about whether trailing length words will be + * used. We can't change this choice once data is on tape, even + * though callers might drop the requirement. */ state->backward = (state->eflags & EXEC_FLAG_BACKWARD) != 0; state->status = TSS_WRITEFILE; @@ -647,9 +649,9 @@ tuplestore_puttuple_common(Tuplestorestate *state, void *tuple) case TSS_WRITEFILE: /* - * Update read pointers as needed; see API spec above. - * Note: BufFileTell is quite cheap, so not worth trying - * to avoid multiple calls. + * Update read pointers as needed; see API spec above. Note: + * BufFileTell is quite cheap, so not worth trying to avoid + * multiple calls. */ readptr = state->readptrs; for (i = 0; i < state->readptrcount; readptr++, i++) @@ -754,7 +756,7 @@ tuplestore_gettuple(Tuplestorestate *state, bool forward, Assert(!state->truncated); return NULL; } - readptr->current--; /* last returned tuple */ + readptr->current--; /* last returned tuple */ } if (readptr->current <= 0) { @@ -996,7 +998,7 @@ tuplestore_rescan(Tuplestorestate *state) } /* - * tuplestore_copy_read_pointer - copy a read pointer's state to another + * tuplestore_copy_read_pointer - copy a read pointer's state to another */ void tuplestore_copy_read_pointer(Tuplestorestate *state, @@ -1015,8 +1017,8 @@ tuplestore_copy_read_pointer(Tuplestorestate *state, if (dptr->eflags != sptr->eflags) { /* Possible change of overall eflags, so copy and then recompute */ - int eflags; - int i; + int eflags; + int i; *dptr = *sptr; eflags = state->readptrs[0].eflags; @@ -1034,6 +1036,7 @@ tuplestore_copy_read_pointer(Tuplestorestate *state, /* no work */ break; case TSS_READFILE: + /* * This case is a bit tricky since the active read pointer's * position corresponds to the seek point, not what is in its @@ -1093,7 +1096,8 @@ tuplestore_trim(Tuplestorestate *state) int i; /* - * Truncation is disallowed if any read pointer requires rewind capability. + * Truncation is disallowed if any read pointer requires rewind + * capability. */ if (state->eflags & EXEC_FLAG_REWIND) return; @@ -1115,14 +1119,13 @@ tuplestore_trim(Tuplestorestate *state) /* * Note: you might think we could remove all the tuples before the oldest - * "current", since that one is the next to be returned. However, - * since tuplestore_gettuple returns a direct pointer to our - * internal copy of the tuple, it's likely that the caller has - * still got the tuple just before "current" referenced in a slot. - * So we keep one extra tuple before the oldest "current". (Strictly - * speaking, we could require such callers to use the "copy" flag to - * tuplestore_gettupleslot, but for efficiency we allow this one case - * to not use "copy".) + * "current", since that one is the next to be returned. However, since + * tuplestore_gettuple returns a direct pointer to our internal copy of + * the tuple, it's likely that the caller has still got the tuple just + * before "current" referenced in a slot. So we keep one extra tuple + * before the oldest "current". (Strictly speaking, we could require such + * callers to use the "copy" flag to tuplestore_gettupleslot, but for + * efficiency we allow this one case to not use "copy".) */ nremove = oldest - 1; if (nremove <= 0) @@ -1222,9 +1225,11 @@ static void writetup_heap(Tuplestorestate *state, void *tup) { MinimalTuple tuple = (MinimalTuple) tup; + /* the part of the MinimalTuple we'll write: */ char *tupbody = (char *) tuple + MINIMAL_TUPLE_DATA_OFFSET; unsigned int tupbodylen = tuple->t_len - MINIMAL_TUPLE_DATA_OFFSET; + /* total on-disk footprint: */ unsigned int tuplen = tupbodylen + sizeof(int); @@ -1255,7 +1260,7 @@ readtup_heap(Tuplestorestate *state, unsigned int len) /* read in the tuple proper */ tuple->t_len = tuplen; if (BufFileRead(state->myfile, (void *) tupbody, - tupbodylen) != (size_t) tupbodylen) + tupbodylen) != (size_t) tupbodylen) elog(ERROR, "unexpected end of data"); if (state->backward) /* need trailing length word? */ if (BufFileRead(state->myfile, (void *) &tuplen, diff --git a/src/backend/utils/time/snapmgr.c b/src/backend/utils/time/snapmgr.c index d5fa1355ee..73d597d7b3 100644 --- a/src/backend/utils/time/snapmgr.c +++ b/src/backend/utils/time/snapmgr.c @@ -8,9 +8,9 @@ * (tracked by separate refcounts on each snapshot), its memory can be freed. * * These arrangements let us reset MyProc->xmin when there are no snapshots - * referenced by this transaction. (One possible improvement would be to be + * referenced by this transaction. (One possible improvement would be to be * able to advance Xmin when the snapshot with the earliest Xmin is no longer - * referenced. That's a bit harder though, it requires more locking, and + * referenced. That's a bit harder though, it requires more locking, and * anyway it should be rather uncommon to keep snapshots referenced for too * long.) * @@ -19,7 +19,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/time/snapmgr.c,v 1.9 2009/01/01 17:23:53 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/time/snapmgr.c,v 1.10 2009/06/11 14:49:06 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -50,8 +50,8 @@ static SnapshotData CurrentSnapshotData = {HeapTupleSatisfiesMVCC}; static SnapshotData SecondarySnapshotData = {HeapTupleSatisfiesMVCC}; /* Pointers to valid snapshots */ -static Snapshot CurrentSnapshot = NULL; -static Snapshot SecondarySnapshot = NULL; +static Snapshot CurrentSnapshot = NULL; +static Snapshot SecondarySnapshot = NULL; /* * These are updated by GetSnapshotData. We initialize them this way @@ -59,7 +59,7 @@ static Snapshot SecondarySnapshot = NULL; * mode, we don't want it to say that BootstrapTransactionId is in progress. * * RecentGlobalXmin is initialized to InvalidTransactionId, to ensure that no - * one tries to use a stale value. Readers should ensure that it has been set + * one tries to use a stale value. Readers should ensure that it has been set * to something else before using it. */ TransactionId TransactionXmin = FirstNormalTransactionId; @@ -82,7 +82,7 @@ typedef struct ActiveSnapshotElt } ActiveSnapshotElt; /* Top of the stack of active snapshots */ -static ActiveSnapshotElt *ActiveSnapshot = NULL; +static ActiveSnapshotElt *ActiveSnapshot = NULL; /* * How many snapshots is resowner.c tracking for us? @@ -91,22 +91,22 @@ static ActiveSnapshotElt *ActiveSnapshot = NULL; * smarter about advancing our MyProc->xmin we will need to be more * sophisticated about this, perhaps keeping our own list of snapshots. */ -static int RegisteredSnapshots = 0; +static int RegisteredSnapshots = 0; /* first GetTransactionSnapshot call in a transaction? */ -bool FirstSnapshotSet = false; +bool FirstSnapshotSet = false; /* * Remembers whether this transaction registered a serializable snapshot at * start. We cannot trust FirstSnapshotSet in combination with * IsXactIsoLevelSerializable, because GUC may be reset before us. */ -static bool registered_serializable = false; +static bool registered_serializable = false; static Snapshot CopySnapshot(Snapshot snapshot); static void FreeSnapshot(Snapshot snapshot); -static void SnapshotResetXmin(void); +static void SnapshotResetXmin(void); /* @@ -130,14 +130,14 @@ GetTransactionSnapshot(void) FirstSnapshotSet = true; /* - * In serializable mode, the first snapshot must live until end of xact - * regardless of what the caller does with it, so we must register it - * internally here and unregister it at end of xact. + * In serializable mode, the first snapshot must live until end of + * xact regardless of what the caller does with it, so we must + * register it internally here and unregister it at end of xact. */ if (IsXactIsoLevelSerializable) { CurrentSnapshot = RegisterSnapshotOnOwner(CurrentSnapshot, - TopTransactionResourceOwner); + TopTransactionResourceOwner); registered_serializable = true; } @@ -171,7 +171,7 @@ GetLatestSnapshot(void) /* * SnapshotSetCommandId - * Propagate CommandCounterIncrement into the static snapshots, if set + * Propagate CommandCounterIncrement into the static snapshots, if set */ void SnapshotSetCommandId(CommandId curcid) @@ -253,7 +253,7 @@ FreeSnapshot(Snapshot snapshot) /* * PushActiveSnapshot - * Set the given snapshot as the current active snapshot + * Set the given snapshot as the current active snapshot * * If this is the first use of this snapshot, create a new long-lived copy with * active refcount=1. Otherwise, only increment the refcount. @@ -261,7 +261,7 @@ FreeSnapshot(Snapshot snapshot) void PushActiveSnapshot(Snapshot snap) { - ActiveSnapshotElt *newactive; + ActiveSnapshotElt *newactive; Assert(snap != InvalidSnapshot); @@ -278,7 +278,7 @@ PushActiveSnapshot(Snapshot snap) /* * PushUpdatedSnapshot - * As above, except we set the snapshot's CID to the current CID. + * As above, except we set the snapshot's CID to the current CID. */ void PushUpdatedSnapshot(Snapshot snapshot) @@ -304,7 +304,7 @@ PushUpdatedSnapshot(Snapshot snapshot) void PopActiveSnapshot(void) { - ActiveSnapshotElt *newstack; + ActiveSnapshotElt *newstack; newstack = ActiveSnapshot->as_next; @@ -324,7 +324,7 @@ PopActiveSnapshot(void) /* * GetActiveSnapshot - * Return the topmost snapshot in the Active stack. + * Return the topmost snapshot in the Active stack. */ Snapshot GetActiveSnapshot(void) @@ -336,7 +336,7 @@ GetActiveSnapshot(void) /* * ActiveSnapshotSet - * Return whether there is at least one snapshot in the Active stack + * Return whether there is at least one snapshot in the Active stack */ bool ActiveSnapshotSet(void) @@ -346,7 +346,7 @@ ActiveSnapshotSet(void) /* * RegisterSnapshot - * Register a snapshot as being in use by the current resource owner + * Register a snapshot as being in use by the current resource owner * * If InvalidSnapshot is passed, it is not registered. */ @@ -361,12 +361,12 @@ RegisterSnapshot(Snapshot snapshot) /* * RegisterSnapshotOnOwner - * As above, but use the specified resource owner + * As above, but use the specified resource owner */ Snapshot RegisterSnapshotOnOwner(Snapshot snapshot, ResourceOwner owner) { - Snapshot snap; + Snapshot snap; if (snapshot == InvalidSnapshot) return InvalidSnapshot; @@ -402,7 +402,7 @@ UnregisterSnapshot(Snapshot snapshot) /* * UnregisterSnapshotFromOwner - * As above, but use the specified resource owner + * As above, but use the specified resource owner */ void UnregisterSnapshotFromOwner(Snapshot snapshot, ResourceOwner owner) @@ -442,7 +442,7 @@ SnapshotResetXmin(void) void AtSubCommit_Snapshot(int level) { - ActiveSnapshotElt *active; + ActiveSnapshotElt *active; /* * Relabel the active snapshots set in this subtransaction as though they @@ -458,7 +458,7 @@ AtSubCommit_Snapshot(int level) /* * AtSubAbort_Snapshot - * Clean up snapshots after a subtransaction abort + * Clean up snapshots after a subtransaction abort */ void AtSubAbort_Snapshot(int level) @@ -466,7 +466,7 @@ AtSubAbort_Snapshot(int level) /* Forget the active snapshots set by this subtransaction */ while (ActiveSnapshot && ActiveSnapshot->as_level >= level) { - ActiveSnapshotElt *next; + ActiveSnapshotElt *next; next = ActiveSnapshot->as_next; @@ -500,8 +500,8 @@ void AtEarlyCommit_Snapshot(void) { /* - * On a serializable transaction we must unregister our private refcount to - * the serializable snapshot. + * On a serializable transaction we must unregister our private refcount + * to the serializable snapshot. */ if (registered_serializable) UnregisterSnapshotFromOwner(CurrentSnapshot, @@ -512,7 +512,7 @@ AtEarlyCommit_Snapshot(void) /* * AtEOXact_Snapshot - * Snapshot manager's cleanup function for end of transaction + * Snapshot manager's cleanup function for end of transaction */ void AtEOXact_Snapshot(bool isCommit) @@ -520,7 +520,7 @@ AtEOXact_Snapshot(bool isCommit) /* On commit, complain about leftover snapshots */ if (isCommit) { - ActiveSnapshotElt *active; + ActiveSnapshotElt *active; if (RegisteredSnapshots != 0) elog(WARNING, "%d registered snapshots seem to remain after cleanup", diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c index 3f5f7de163..6d8f86acc9 100644 --- a/src/backend/utils/time/tqual.c +++ b/src/backend/utils/time/tqual.c @@ -28,29 +28,29 @@ * * Summary of visibility functions: * - * HeapTupleSatisfiesMVCC() - * visible to supplied snapshot, excludes current command - * HeapTupleSatisfiesNow() - * visible to instant snapshot, excludes current command - * HeapTupleSatisfiesUpdate() - * like HeapTupleSatisfiesNow(), but with user-supplied command - * counter and more complex result - * HeapTupleSatisfiesSelf() - * visible to instant snapshot and current command - * HeapTupleSatisfiesDirty() - * like HeapTupleSatisfiesSelf(), but includes open transactions - * HeapTupleSatisfiesVacuum() - * visible to any running transaction, used by VACUUM - * HeapTupleSatisfiesToast() - * visible unless part of interrupted vacuum, used for TOAST - * HeapTupleSatisfiesAny() - * all tuples are visible + * HeapTupleSatisfiesMVCC() + * visible to supplied snapshot, excludes current command + * HeapTupleSatisfiesNow() + * visible to instant snapshot, excludes current command + * HeapTupleSatisfiesUpdate() + * like HeapTupleSatisfiesNow(), but with user-supplied command + * counter and more complex result + * HeapTupleSatisfiesSelf() + * visible to instant snapshot and current command + * HeapTupleSatisfiesDirty() + * like HeapTupleSatisfiesSelf(), but includes open transactions + * HeapTupleSatisfiesVacuum() + * visible to any running transaction, used by VACUUM + * HeapTupleSatisfiesToast() + * visible unless part of interrupted vacuum, used for TOAST + * HeapTupleSatisfiesAny() + * all tuples are visible * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/time/tqual.c,v 1.112 2009/03/09 13:08:05 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/time/tqual.c,v 1.113 2009/06/11 14:49:06 momjian Exp $ * *------------------------------------------------------------------------- */ diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 3bb079840a..3fc9b3880e 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -42,7 +42,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * Portions taken from FreeBSD. * - * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.171 2009/06/03 16:17:49 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.172 2009/06/11 14:49:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -189,7 +189,7 @@ static void setlocales(void); static void usage(const char *progname); #ifdef WIN32 -static int CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION * processInfo); +static int CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo); #endif @@ -669,7 +669,7 @@ get_id(void) if (!pw) { fprintf(stderr, - _("%s: could not obtain information about current user: %s\n"), + _("%s: could not obtain information about current user: %s\n"), progname, strerror(errno)); exit(1); } @@ -948,16 +948,16 @@ check_input(char *path) _("%s: file \"%s\" does not exist\n"), progname, path); fprintf(stderr, _("This might mean you have a corrupted installation or identified\n" - "the wrong directory with the invocation option -L.\n")); + "the wrong directory with the invocation option -L.\n")); } else { fprintf(stderr, - _("%s: could not access file \"%s\": %s\n"), progname, path, - strerror(errno)); + _("%s: could not access file \"%s\": %s\n"), progname, path, + strerror(errno)); fprintf(stderr, _("This might mean you have a corrupted installation or identified\n" - "the wrong directory with the invocation option -L.\n")); + "the wrong directory with the invocation option -L.\n")); } exit(1); } @@ -966,8 +966,8 @@ check_input(char *path) fprintf(stderr, _("%s: file \"%s\" is not a regular file\n"), progname, path); fprintf(stderr, - _("This might mean you have a corrupted installation or identified\n" - "the wrong directory with the invocation option -L.\n")); + _("This might mean you have a corrupted installation or identified\n" + "the wrong directory with the invocation option -L.\n")); exit(1); } } @@ -1356,9 +1356,9 @@ bootstrap_template1(char *short_version) bki_lines = replace_token(bki_lines, "ENCODING", encodingid); bki_lines = replace_token(bki_lines, "LC_COLLATE", lc_collate); - + bki_lines = replace_token(bki_lines, "LC_CTYPE", lc_ctype); - + /* * Pass correct LC_xxx environment to bootstrap. * @@ -2232,10 +2232,10 @@ check_locale_encoding(const char *locale, int user_enc) #ifdef WIN32 /* - * On win32, if the encoding chosen is UTF8, all locales are OK - * (assuming the actual locale name passed the checks above). This is - * because UTF8 is a pseudo-codepage, that we convert to UTF16 before - * doing any operations on, and UTF16 supports all locales. + * On win32, if the encoding chosen is UTF8, all locales are OK (assuming + * the actual locale name passed the checks above). This is because UTF8 + * is a pseudo-codepage, that we convert to UTF16 before doing any + * operations on, and UTF16 supports all locales. */ || user_enc == PG_UTF8 #endif @@ -2243,11 +2243,11 @@ check_locale_encoding(const char *locale, int user_enc) { fprintf(stderr, _("%s: encoding mismatch\n"), progname); fprintf(stderr, - _("The encoding you selected (%s) and the encoding that the\n" + _("The encoding you selected (%s) and the encoding that the\n" "selected locale uses (%s) do not match. This would lead to\n" "misbehavior in various character string processing functions.\n" "Rerun %s and either do not specify an encoding explicitly,\n" - "or choose a matching combination.\n"), + "or choose a matching combination.\n"), pg_encoding_to_char(user_enc), pg_encoding_to_char(locale_enc), progname); @@ -2313,7 +2313,7 @@ setlocales(void) } #ifdef WIN32 -typedef BOOL(WINAPI * __CreateRestrictedToken) (HANDLE, DWORD, DWORD, PSID_AND_ATTRIBUTES, DWORD, PLUID_AND_ATTRIBUTES, DWORD, PSID_AND_ATTRIBUTES, PHANDLE); +typedef BOOL (WINAPI * __CreateRestrictedToken) (HANDLE, DWORD, DWORD, PSID_AND_ATTRIBUTES, DWORD, PLUID_AND_ATTRIBUTES, DWORD, PSID_AND_ATTRIBUTES, PHANDLE); #define DISABLE_MAX_PRIVILEGE 0x1 @@ -2326,7 +2326,7 @@ typedef BOOL(WINAPI * __CreateRestrictedToken) (HANDLE, DWORD, DWORD, PSID_AND_ * NOT execute anything. */ static int -CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION * processInfo) +CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo) { BOOL b; STARTUPINFO si; @@ -2394,16 +2394,16 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION * processInfo) } if (!CreateProcessAsUser(restrictedToken, - NULL, - cmd, - NULL, - NULL, - TRUE, - CREATE_SUSPENDED, - NULL, - NULL, - &si, - processInfo)) + NULL, + cmd, + NULL, + NULL, + TRUE, + CREATE_SUSPENDED, + NULL, + NULL, + &si, + processInfo)) { fprintf(stderr, "CreateProcessAsUser failed: %lu\n", GetLastError()); @@ -2433,9 +2433,9 @@ usage(const char *progname) printf(_(" -E, --encoding=ENCODING set default encoding for new databases\n")); printf(_(" --locale=LOCALE set default locale for new databases\n")); printf(_(" --lc-collate=, --lc-ctype=, --lc-messages=LOCALE\n" - " --lc-monetary=, --lc-numeric=, --lc-time=LOCALE\n" - " set default locale in the respective category for\n" - " new databases (default taken from environment)\n")); + " --lc-monetary=, --lc-numeric=, --lc-time=LOCALE\n" + " set default locale in the respective category for\n" + " new databases (default taken from environment)\n")); printf(_(" --no-locale equivalent to --locale=C\n")); printf(_(" --pwfile=FILE read password for the new superuser from file\n")); printf(_(" -T, --text-search-config=CFG\n" @@ -2920,7 +2920,7 @@ main(int argc, char *argv[]) user_enc = atoi(encodingid); if (!check_locale_encoding(lc_ctype, user_enc) || !check_locale_encoding(lc_collate, user_enc)) - exit(1); /* check_locale_encoding printed the error */ + exit(1); /* check_locale_encoding printed the error */ if (strlen(default_text_search_config) == 0) { @@ -3087,8 +3087,8 @@ main(int argc, char *argv[]) _("%s: directory \"%s\" exists but is not empty\n"), progname, xlog_dir); fprintf(stderr, - _("If you want to store the transaction log there, either\n" - "remove or empty the directory \"%s\".\n"), + _("If you want to store the transaction log there, either\n" + "remove or empty the directory \"%s\".\n"), xlog_dir); exit_nicely(); diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c index e375057bfa..b24d20af2f 100644 --- a/src/bin/pg_controldata/pg_controldata.c +++ b/src/bin/pg_controldata/pg_controldata.c @@ -6,7 +6,7 @@ * copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001; * licence: BSD * - * $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.42 2008/12/11 07:34:08 petere Exp $ + * $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.43 2009/06/11 14:49:07 momjian Exp $ */ #include "postgres_fe.h" @@ -136,8 +136,8 @@ main(int argc, char *argv[]) /* * This slightly-chintzy coding will work as long as the control file - * timestamps are within the range of time_t; that should be the case - * in all foreseeable circumstances, so we don't bother importing the + * timestamps are within the range of time_t; that should be the case in + * all foreseeable circumstances, so we don't bother importing the * backend's timezone library into pg_controldata. * * Use variable for format to suppress overly-anal-retentive gcc warning diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index 24956d1e4f..40ede2c1a8 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -4,7 +4,7 @@ * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.110 2009/04/05 04:19:58 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.111 2009/06/11 14:49:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -117,7 +117,7 @@ static void pgwin32_SetServiceStatus(DWORD); static void WINAPI pgwin32_ServiceHandler(DWORD); static void WINAPI pgwin32_ServiceMain(DWORD, LPTSTR *); static void pgwin32_doRunAsService(void); -static int CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION * processInfo, bool as_service); +static int CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_service); static SERVICE_STATUS status; static SERVICE_STATUS_HANDLE hStatus = (SERVICE_STATUS_HANDLE) 0; @@ -412,10 +412,10 @@ test_postmaster_connection(bool do_checkpoint) /* * Look in post_opts for a -p switch. * - * This parsing code is not amazingly bright; it could for instance - * get fooled if ' -p' occurs within a quoted argument value. Given - * that few people pass complicated settings in post_opts, it's - * probably good enough. + * This parsing code is not amazingly bright; it could for instance get + * fooled if ' -p' occurs within a quoted argument value. Given that few + * people pass complicated settings in post_opts, it's probably good + * enough. */ for (p = post_opts; *p;) { @@ -447,8 +447,8 @@ test_postmaster_connection(bool do_checkpoint) /* * Search config file for a 'port' option. * - * This parsing code isn't amazingly bright either, but it should be - * okay for valid port settings. + * This parsing code isn't amazingly bright either, but it should be okay + * for valid port settings. */ if (!*portstr) { @@ -528,7 +528,7 @@ test_postmaster_connection(bool do_checkpoint) */ status.dwWaitHint += 6000; status.dwCheckPoint++; - SetServiceStatus(hStatus, (LPSERVICE_STATUS) & status); + SetServiceStatus(hStatus, (LPSERVICE_STATUS) &status); } else @@ -569,7 +569,7 @@ read_post_opts(void) { if (post_opts == NULL) { - post_opts = ""; /* default */ + post_opts = ""; /* default */ if (ctl_command == RESTART_COMMAND) { char **optlines; @@ -603,8 +603,9 @@ read_post_opts(void) */ if ((arg1 = strstr(optline, " \"")) != NULL) { - *arg1 = '\0'; /* terminate so we get only program name */ - post_opts = arg1 + 1; /* point past whitespace */ + *arg1 = '\0'; /* terminate so we get only program + * name */ + post_opts = arg1 + 1; /* point past whitespace */ } if (postgres_path == NULL) postgres_path = optline; @@ -717,7 +718,7 @@ do_stop(void) { int cnt; pgpid_t pid; - struct stat statbuf; + struct stat statbuf; pid = get_pgpid(); @@ -792,7 +793,7 @@ do_restart(void) { int cnt; pgpid_t pid; - struct stat statbuf; + struct stat statbuf; pid = get_pgpid(); @@ -1142,7 +1143,7 @@ static void pgwin32_SetServiceStatus(DWORD currentState) { status.dwCurrentState = currentState; - SetServiceStatus(hStatus, (LPSERVICE_STATUS) & status); + SetServiceStatus(hStatus, (LPSERVICE_STATUS) &status); } static void WINAPI @@ -1178,7 +1179,7 @@ pgwin32_ServiceHandler(DWORD request) } static void WINAPI -pgwin32_ServiceMain(DWORD argc, LPTSTR * argv) +pgwin32_ServiceMain(DWORD argc, LPTSTR *argv) { PROCESS_INFORMATION pi; DWORD ret; @@ -1286,12 +1287,12 @@ pgwin32_doRunAsService(void) * also load the couple of functions that *do* exist in minwg headers but not * on NT4. That way, we don't break on NT4. */ -typedef BOOL(WINAPI * __CreateRestrictedToken) (HANDLE, DWORD, DWORD, PSID_AND_ATTRIBUTES, DWORD, PLUID_AND_ATTRIBUTES, DWORD, PSID_AND_ATTRIBUTES, PHANDLE); -typedef BOOL(WINAPI * __IsProcessInJob) (HANDLE, HANDLE, PBOOL); -typedef HANDLE(WINAPI * __CreateJobObject) (LPSECURITY_ATTRIBUTES, LPCTSTR); -typedef BOOL(WINAPI * __SetInformationJobObject) (HANDLE, JOBOBJECTINFOCLASS, LPVOID, DWORD); -typedef BOOL(WINAPI * __AssignProcessToJobObject) (HANDLE, HANDLE); -typedef BOOL(WINAPI * __QueryInformationJobObject) (HANDLE, JOBOBJECTINFOCLASS, LPVOID, DWORD, LPDWORD); +typedef BOOL (WINAPI * __CreateRestrictedToken) (HANDLE, DWORD, DWORD, PSID_AND_ATTRIBUTES, DWORD, PLUID_AND_ATTRIBUTES, DWORD, PSID_AND_ATTRIBUTES, PHANDLE); +typedef BOOL (WINAPI * __IsProcessInJob) (HANDLE, HANDLE, PBOOL); +typedef HANDLE (WINAPI * __CreateJobObject) (LPSECURITY_ATTRIBUTES, LPCTSTR); +typedef BOOL (WINAPI * __SetInformationJobObject) (HANDLE, JOBOBJECTINFOCLASS, LPVOID, DWORD); +typedef BOOL (WINAPI * __AssignProcessToJobObject) (HANDLE, HANDLE); +typedef BOOL (WINAPI * __QueryInformationJobObject) (HANDLE, JOBOBJECTINFOCLASS, LPVOID, DWORD, LPDWORD); /* Windows API define missing from MingW headers */ #define DISABLE_MAX_PRIVILEGE 0x1 @@ -1309,7 +1310,7 @@ typedef BOOL(WINAPI * __QueryInformationJobObject) (HANDLE, JOBOBJECTINFOCLASS, * automatically destroyed when pg_ctl exits. */ static int -CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION * processInfo, bool as_service) +CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_service) { int r; BOOL b; @@ -1464,11 +1465,13 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION * processInfo, bool as_se osv.dwOSVersionInfoSize = sizeof(osv); if (!GetVersionEx(&osv) || osv.dwMajorVersion < 6 || - (osv.dwMajorVersion == 6 && osv.dwMinorVersion == 0)) + (osv.dwMajorVersion == 6 && osv.dwMinorVersion == 0)) { /* - * On Windows 7 (and presumably later), JOB_OBJECT_UILIMIT_HANDLES prevents us from - * starting as a service. So we only enable it on Vista and earlier (version <= 6.0) + * On Windows 7 (and presumably later), + * JOB_OBJECT_UILIMIT_HANDLES prevents us from + * starting as a service. So we only enable it on + * Vista and earlier (version <= 6.0) */ uiRestrictions.UIRestrictionsClass |= JOB_OBJECT_UILIMIT_HANDLES; } @@ -1486,9 +1489,9 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION * processInfo, bool as_se } #ifndef __CYGWIN__ - AddUserToDacl(processInfo->hProcess); + AddUserToDacl(processInfo->hProcess); #endif - + CloseHandle(restrictedToken); ResumeThread(processInfo->hThread); @@ -1520,7 +1523,7 @@ do_help(void) printf(_(" %s start [-w] [-t SECS] [-D DATADIR] [-s] [-l FILENAME] [-o \"OPTIONS\"]\n"), progname); printf(_(" %s stop [-W] [-t SECS] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]\n"), progname); printf(_(" %s restart [-w] [-t SECS] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]\n" - " [-o \"OPTIONS\"]\n"), progname); + " [-o \"OPTIONS\"]\n"), progname); printf(_(" %s reload [-D DATADIR] [-s]\n"), progname); printf(_(" %s status [-D DATADIR]\n"), progname); printf(_(" %s kill SIGNALNAME PID\n"), progname); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index cc4872381e..789638fec4 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/common.c,v 1.106 2009/01/01 17:23:54 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/common.c,v 1.107 2009/06/11 14:49:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -91,7 +91,7 @@ getSchemaData(int *numTablesPtr) TSTemplateInfo *tmplinfo; TSDictInfo *dictinfo; TSConfigInfo *cfginfo; - FdwInfo *fdwinfo; + FdwInfo *fdwinfo; ForeignServerInfo *srvinfo; int numNamespaces; int numAggregates; diff --git a/src/bin/pg_dump/dumputils.c b/src/bin/pg_dump/dumputils.c index 1f9d6832c8..6b82823bc7 100644 --- a/src/bin/pg_dump/dumputils.c +++ b/src/bin/pg_dump/dumputils.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/bin/pg_dump/dumputils.c,v 1.45 2009/03/11 03:33:29 adunstan Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/dumputils.c,v 1.46 2009/06/11 14:49:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -29,7 +29,7 @@ static bool parseAclItem(const char *item, const char *type, PQExpBuffer privs, PQExpBuffer privswgo); static char *copyAclUserName(PQExpBuffer output, char *input); static void AddAcl(PQExpBuffer aclbuf, const char *keyword, - const char *subname); + const char *subname); #ifdef WIN32 static bool parallel_init_done = false; @@ -40,7 +40,7 @@ void init_parallel_dump_utils(void) { #ifdef WIN32 - if (! parallel_init_done) + if (!parallel_init_done) { tls_index = TlsAlloc(); parallel_init_done = true; @@ -49,17 +49,17 @@ init_parallel_dump_utils(void) } /* - * Quotes input string if it's not a legitimate SQL identifier as-is. + * Quotes input string if it's not a legitimate SQL identifier as-is. * - * Note that the returned string must be used before calling fmtId again, - * since we re-use the same return buffer each time. Non-reentrant but - * reduces memory leakage. (On Windows the memory leakage will be one buffer - * per thread, which is at least better than one per call). + * Note that the returned string must be used before calling fmtId again, + * since we re-use the same return buffer each time. Non-reentrant but + * reduces memory leakage. (On Windows the memory leakage will be one buffer + * per thread, which is at least better than one per call). */ const char * fmtId(const char *rawid) { - /* + /* * The Tls code goes awry if we use a static var, so we provide for both * static and auto, and omit any use of the static var when using Tls. */ @@ -71,7 +71,7 @@ fmtId(const char *rawid) #ifdef WIN32 if (parallel_init_done) - id_return = (PQExpBuffer) TlsGetValue(tls_index); /* 0 when not set */ + id_return = (PQExpBuffer) TlsGetValue(tls_index); /* 0 when not set */ else id_return = s_id_return; #else @@ -87,15 +87,15 @@ fmtId(const char *rawid) { /* new buffer */ id_return = createPQExpBuffer(); -#ifdef WIN32 +#ifdef WIN32 if (parallel_init_done) - TlsSetValue(tls_index,id_return); + TlsSetValue(tls_index, id_return); else s_id_return = id_return; #else s_id_return = id_return; #endif - + } /* @@ -555,7 +555,7 @@ buildACLCommands(const char *name, const char *subname, fmtId(grantee->data)); if (privswgo->len > 0) appendPQExpBuffer(firstsql, - "GRANT %s ON %s %s TO %s WITH GRANT OPTION;\n", + "GRANT %s ON %s %s TO %s WITH GRANT OPTION;\n", privswgo->data, type, name, fmtId(grantee->data)); } diff --git a/src/bin/pg_dump/keywords.c b/src/bin/pg_dump/keywords.c index 552b34f021..9e5ff25d50 100644 --- a/src/bin/pg_dump/keywords.c +++ b/src/bin/pg_dump/keywords.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/keywords.c,v 1.2 2009/03/08 16:53:30 alvherre Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/keywords.c,v 1.3 2009/06/11 14:49:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -18,7 +18,7 @@ #include "parser/keywords.h" /* - * We don't need the token number, so leave it out to avoid requiring other + * We don't need the token number, so leave it out to avoid requiring other * backend headers. */ #define PG_KEYWORD(a,b,c) {a,0,c}, diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h index 839a9fec60..3ca39d7ba0 100644 --- a/src/bin/pg_dump/pg_backup.h +++ b/src/bin/pg_dump/pg_backup.h @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup.h,v 1.51 2009/03/20 09:21:08 petere Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup.h,v 1.52 2009/06/11 14:49:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -98,7 +98,7 @@ typedef struct _restoreOptions { int create; /* Issue commands to create the database */ int noOwner; /* Don't try to match original object owner */ - int noTablespace; /* Don't issue tablespace-related commands */ + int noTablespace; /* Don't issue tablespace-related commands */ int disable_triggers; /* disable triggers during data-only * restore */ int use_setsessauth;/* Use SET SESSION AUTHORIZATION commands diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index c2d294da1d..16e9bbd74b 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.171 2009/06/04 19:16:48 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.172 2009/06/11 14:49:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -62,7 +62,7 @@ typedef struct _restore_args { ArchiveHandle *AH; - TocEntry *te; + TocEntry *te; } RestoreArgs; typedef struct _parallel_slot @@ -111,24 +111,24 @@ static OutputContext SetOutput(ArchiveHandle *AH, char *filename, int compressio static void ResetOutput(ArchiveHandle *AH, OutputContext savedContext); static int restore_toc_entry(ArchiveHandle *AH, TocEntry *te, - RestoreOptions *ropt, bool is_parallel); + RestoreOptions *ropt, bool is_parallel); static void restore_toc_entries_parallel(ArchiveHandle *AH); static thandle spawn_restore(RestoreArgs *args); static thandle reap_child(ParallelSlot *slots, int n_slots, int *work_status); static bool work_in_progress(ParallelSlot *slots, int n_slots); -static int get_next_slot(ParallelSlot *slots, int n_slots); +static int get_next_slot(ParallelSlot *slots, int n_slots); static TocEntry *get_next_work_item(ArchiveHandle *AH, - TocEntry **first_unprocessed, - ParallelSlot *slots, int n_slots); + TocEntry **first_unprocessed, + ParallelSlot *slots, int n_slots); static parallel_restore_result parallel_restore(RestoreArgs *args); static void mark_work_done(ArchiveHandle *AH, thandle worker, int status, - ParallelSlot *slots, int n_slots); + ParallelSlot *slots, int n_slots); static void fix_dependencies(ArchiveHandle *AH); static bool has_lock_conflicts(TocEntry *te1, TocEntry *te2); static void repoint_table_dependencies(ArchiveHandle *AH, - DumpId tableId, DumpId tableDataId); + DumpId tableId, DumpId tableDataId); static void identify_locking_dependencies(TocEntry *te, - TocEntry **tocsByDumpId); + TocEntry **tocsByDumpId); static void reduce_dependencies(ArchiveHandle *AH, TocEntry *te); static void mark_create_done(ArchiveHandle *AH, TocEntry *te); static void inhibit_data_for_failed_table(ArchiveHandle *AH, TocEntry *te); @@ -211,8 +211,8 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt) die_horribly(AH, modulename, "-C and -c are incompatible options\n"); /* - * -1 is not compatible with -C, because we can't create a database - * inside a transaction block. + * -1 is not compatible with -C, because we can't create a database inside + * a transaction block. */ if (ropt->create && ropt->single_txn) die_horribly(AH, modulename, "-C and -1 are incompatible options\n"); @@ -221,7 +221,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt) * Make sure we won't need (de)compression we haven't got */ #ifndef HAVE_LIBZ - if (AH->compression != 0 && AH->PrintTocDataPtr != NULL) + if (AH->compression != 0 && AH->PrintTocDataPtr !=NULL) { for (te = AH->toc->next; te != AH->toc; te = te->next) { @@ -420,7 +420,7 @@ static int restore_toc_entry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool is_parallel) { - int retval = 0; + int retval = 0; teReqs reqs; bool defnDumped; @@ -440,7 +440,7 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, defnDumped = false; - if ((reqs & REQ_SCHEMA) != 0) /* We want the schema */ + if ((reqs & REQ_SCHEMA) != 0) /* We want the schema */ { ahlog(AH, 1, "creating %s %s\n", te->desc, te->tag); @@ -452,12 +452,12 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, if (AH->lastErrorTE == te) { /* - * We failed to create the table. - * If --no-data-for-failed-tables was given, - * mark the corresponding TABLE DATA to be ignored. + * We failed to create the table. If + * --no-data-for-failed-tables was given, mark the + * corresponding TABLE DATA to be ignored. * - * In the parallel case this must be done in the parent, - * so we just set the return value. + * In the parallel case this must be done in the parent, so we + * just set the return value. */ if (ropt->noDataForFailedTables) { @@ -470,11 +470,11 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, else { /* - * We created the table successfully. Mark the - * corresponding TABLE DATA for possible truncation. + * We created the table successfully. Mark the corresponding + * TABLE DATA for possible truncation. * - * In the parallel case this must be done in the parent, - * so we just set the return value. + * In the parallel case this must be done in the parent, so we + * just set the return value. */ if (is_parallel) retval = WORKER_CREATE_DONE; @@ -498,16 +498,16 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, if ((reqs & REQ_DATA) != 0) { /* - * hadDumper will be set if there is genuine data component for - * this node. Otherwise, we need to check the defn field for - * statements that need to be executed in data-only restores. + * hadDumper will be set if there is genuine data component for this + * node. Otherwise, we need to check the defn field for statements + * that need to be executed in data-only restores. */ if (te->hadDumper) { /* * If we can output the data, then restore it. */ - if (AH->PrintTocDataPtr != NULL && (reqs & REQ_DATA) != 0) + if (AH->PrintTocDataPtr !=NULL && (reqs & REQ_DATA) != 0) { _printTocEntry(AH, te, ropt, true, false); @@ -532,12 +532,12 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, te->tag); /* - * In parallel restore, if we created the table earlier - * in the run then we wrap the COPY in a transaction and - * precede it with a TRUNCATE. If archiving is not on - * this prevents WAL-logging the COPY. This obtains a - * speedup similar to that from using single_txn mode - * in non-parallel restores. + * In parallel restore, if we created the table earlier in + * the run then we wrap the COPY in a transaction and + * precede it with a TRUNCATE. If archiving is not on + * this prevents WAL-logging the COPY. This obtains a + * speedup similar to that from using single_txn mode in + * non-parallel restores. */ if (is_parallel && te->created) { @@ -559,14 +559,13 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, } /* - * If we have a copy statement, use it. As of V1.3, - * these are separate to allow easy import from - * withing a database connection. Pre 1.3 archives can - * not use DB connections and are sent to output only. + * If we have a copy statement, use it. As of V1.3, these + * are separate to allow easy import from withing a + * database connection. Pre 1.3 archives can not use DB + * connections and are sent to output only. * - * For V1.3+, the table data MUST have a copy - * statement so that we can go into appropriate mode - * with libpq. + * For V1.3+, the table data MUST have a copy statement so + * that we can go into appropriate mode with libpq. */ if (te->copyStmt && strlen(te->copyStmt) > 0) { @@ -807,7 +806,7 @@ PrintTOCSummary(Archive *AHX, RestoreOptions *ropt) te->tag, te->owner); if (ropt->verbose && te->nDeps > 0) { - int i; + int i; ahprintf(AH, ";\tdepends on:"); for (i = 0; i < te->nDeps; i++) @@ -1235,7 +1234,7 @@ dump_lo_buf(ArchiveHandle *AH) res = lo_write(AH->connection, AH->loFd, AH->lo_buf, AH->lo_buf_used); ahlog(AH, 5, ngettext("wrote %lu byte of large object data (result = %lu)\n", - "wrote %lu bytes of large object data (result = %lu)\n", + "wrote %lu bytes of large object data (result = %lu)\n", AH->lo_buf_used), (unsigned long) AH->lo_buf_used, (unsigned long) res); if (res != AH->lo_buf_used) @@ -2315,7 +2314,7 @@ _tocEntryRequired(TocEntry *te, RestoreOptions *ropt, bool include_acls) static void _doSetFixedOutputState(ArchiveHandle *AH) { - /* Disable statement_timeout in archive for pg_restore/psql */ + /* Disable statement_timeout in archive for pg_restore/psql */ ahprintf(AH, "SET statement_timeout = 0;\n"); /* Select the correct character set encoding */ @@ -3071,7 +3070,7 @@ restore_toc_entries_parallel(ArchiveHandle *AH) thandle ret_child; TocEntry *te; - ahlog(AH,2,"entering restore_toc_entries_parallel\n"); + ahlog(AH, 2, "entering restore_toc_entries_parallel\n"); /* we haven't got round to making this work for all archive formats */ if (AH->ClonePtr == NULL || AH->ReopenPtr == NULL) @@ -3083,10 +3082,10 @@ restore_toc_entries_parallel(ArchiveHandle *AH) fix_dependencies(AH); /* - * Do all the early stuff in a single connection in the parent. - * There's no great point in running it in parallel, in fact it will - * actually run faster in a single connection because we avoid all the - * connection and setup overhead. + * Do all the early stuff in a single connection in the parent. There's no + * great point in running it in parallel, in fact it will actually run + * faster in a single connection because we avoid all the connection and + * setup overhead. */ while ((next_work_item = get_next_work_item(AH, &first_unprocessed, NULL, 0)) != NULL) @@ -3106,7 +3105,7 @@ restore_toc_entries_parallel(ArchiveHandle *AH) } /* - * Now close parent connection in prep for parallel steps. We do this + * Now close parent connection in prep for parallel steps. We do this * mainly to ensure that we don't exceed the specified number of parallel * connections. */ @@ -3132,7 +3131,7 @@ restore_toc_entries_parallel(ArchiveHandle *AH) * left to be done. */ - ahlog(AH,1,"entering main parallel loop\n"); + ahlog(AH, 1, "entering main parallel loop\n"); while ((next_work_item = get_next_work_item(AH, &first_unprocessed, slots, n_slots)) != NULL || @@ -3140,7 +3139,7 @@ restore_toc_entries_parallel(ArchiveHandle *AH) { if (next_work_item != NULL) { - teReqs reqs; + teReqs reqs; /* If not to be dumped, don't waste time launching a worker */ reqs = _tocEntryRequired(next_work_item, AH->ropt, false); @@ -3159,7 +3158,7 @@ restore_toc_entries_parallel(ArchiveHandle *AH) if ((next_slot = get_next_slot(slots, n_slots)) != NO_SLOT) { /* There is work still to do and a worker slot available */ - thandle child; + thandle child; RestoreArgs *args; ahlog(AH, 1, "launching item %d %s %s\n", @@ -3203,7 +3202,7 @@ restore_toc_entries_parallel(ArchiveHandle *AH) } } - ahlog(AH,1,"finished main parallel loop\n"); + ahlog(AH, 1, "finished main parallel loop\n"); /* * Now reconnect the single parent connection. @@ -3215,9 +3214,9 @@ restore_toc_entries_parallel(ArchiveHandle *AH) _doSetFixedOutputState(AH); /* - * Make sure there is no non-ACL work left due to, say, - * circular dependencies, or some other pathological condition. - * If so, do it in the single parent connection. + * Make sure there is no non-ACL work left due to, say, circular + * dependencies, or some other pathological condition. If so, do it in the + * single parent connection. */ for (te = AH->toc->next; te != AH->toc; te = te->next) { @@ -3238,7 +3237,7 @@ restore_toc_entries_parallel(ArchiveHandle *AH) static thandle spawn_restore(RestoreArgs *args) { - thandle child; + thandle child; /* Ensure stdio state is quiesced before forking */ fflush(NULL); @@ -3272,7 +3271,7 @@ spawn_restore(RestoreArgs *args) } /* - * collect status from a completed worker child + * collect status from a completed worker child */ static thandle reap_child(ParallelSlot *slots, int n_slots, int *work_status) @@ -3282,16 +3281,18 @@ reap_child(ParallelSlot *slots, int n_slots, int *work_status) return wait(work_status); #else static HANDLE *handles = NULL; - int hindex, snum, tnum; - thandle ret_child; - DWORD res; + int hindex, + snum, + tnum; + thandle ret_child; + DWORD res; /* first time around only, make space for handles to listen on */ if (handles == NULL) - handles = (HANDLE *) calloc(sizeof(HANDLE),n_slots); + handles = (HANDLE *) calloc(sizeof(HANDLE), n_slots); /* set up list of handles to listen to */ - for (snum=0, tnum=0; snum < n_slots; snum++) + for (snum = 0, tnum = 0; snum < n_slots; snum++) if (slots[snum].child_id != 0) handles[tnum++] = slots[snum].child_id; @@ -3302,7 +3303,7 @@ reap_child(ParallelSlot *slots, int n_slots, int *work_status) ret_child = handles[hindex - WAIT_OBJECT_0]; /* get the result */ - GetExitCodeThread(ret_child,&res); + GetExitCodeThread(ret_child, &res); *work_status = res; /* dispose of handle to stop leaks */ @@ -3318,7 +3319,7 @@ reap_child(ParallelSlot *slots, int n_slots, int *work_status) static bool work_in_progress(ParallelSlot *slots, int n_slots) { - int i; + int i; for (i = 0; i < n_slots; i++) { @@ -3334,7 +3335,7 @@ work_in_progress(ParallelSlot *slots, int n_slots) static int get_next_slot(ParallelSlot *slots, int n_slots) { - int i; + int i; for (i = 0; i < n_slots; i++) { @@ -3352,7 +3353,8 @@ get_next_slot(ParallelSlot *slots, int n_slots) static bool has_lock_conflicts(TocEntry *te1, TocEntry *te2) { - int j,k; + int j, + k; for (j = 0; j < te1->nLockDeps; j++) { @@ -3387,19 +3389,20 @@ static TocEntry * get_next_work_item(ArchiveHandle *AH, TocEntry **first_unprocessed, ParallelSlot *slots, int n_slots) { - bool pref_non_data = false; /* or get from AH->ropt */ - TocEntry *data_te = NULL; - TocEntry *te; - int i,k; + bool pref_non_data = false; /* or get from AH->ropt */ + TocEntry *data_te = NULL; + TocEntry *te; + int i, + k; /* * Bogus heuristics for pref_non_data */ if (pref_non_data) { - int count = 0; + int count = 0; - for (k=0; k < n_slots; k++) + for (k = 0; k < n_slots; k++) if (slots[k].args->te != NULL && slots[k].args->te->section == SECTION_DATA) count++; @@ -3422,7 +3425,7 @@ get_next_work_item(ArchiveHandle *AH, TocEntry **first_unprocessed, */ for (; te != AH->toc; te = te->next) { - bool conflicts = false; + bool conflicts = false; /* Ignore if already done or still waiting on dependencies */ if (te->restored || te->depCount > 0) @@ -3430,12 +3433,12 @@ get_next_work_item(ArchiveHandle *AH, TocEntry **first_unprocessed, /* * Check to see if the item would need exclusive lock on something - * that a currently running item also needs lock on, or vice versa. - * If so, we don't want to schedule them together. + * that a currently running item also needs lock on, or vice versa. If + * so, we don't want to schedule them together. */ for (i = 0; i < n_slots && !conflicts; i++) { - TocEntry *running_te; + TocEntry *running_te; if (slots[i].args == NULL) continue; @@ -3466,7 +3469,7 @@ get_next_work_item(ArchiveHandle *AH, TocEntry **first_unprocessed, if (data_te != NULL) return data_te; - ahlog(AH,2,"no item ready\n"); + ahlog(AH, 2, "no item ready\n"); return NULL; } @@ -3481,21 +3484,20 @@ static parallel_restore_result parallel_restore(RestoreArgs *args) { ArchiveHandle *AH = args->AH; - TocEntry *te = args->te; + TocEntry *te = args->te; RestoreOptions *ropt = AH->ropt; - int retval; + int retval; /* - * Close and reopen the input file so we have a private file pointer - * that doesn't stomp on anyone else's file pointer, if we're actually - * going to need to read from the file. Otherwise, just close it - * except on Windows, where it will possibly be needed by other threads. + * Close and reopen the input file so we have a private file pointer that + * doesn't stomp on anyone else's file pointer, if we're actually going to + * need to read from the file. Otherwise, just close it except on Windows, + * where it will possibly be needed by other threads. * - * Note: on Windows, since we are using threads not processes, the - * reopen call *doesn't* close the original file pointer but just open - * a new one. + * Note: on Windows, since we are using threads not processes, the reopen + * call *doesn't* close the original file pointer but just open a new one. */ - if (te->section == SECTION_DATA ) + if (te->section == SECTION_DATA) (AH->ReopenPtr) (AH); #ifndef WIN32 else @@ -3519,7 +3521,7 @@ parallel_restore(RestoreArgs *args) AH->connection = NULL; /* If we reopened the file, we are done with it, so close it now */ - if (te->section == SECTION_DATA ) + if (te->section == SECTION_DATA) (AH->ClosePtr) (AH); if (retval == 0 && AH->public.n_errors) @@ -3543,8 +3545,8 @@ static void mark_work_done(ArchiveHandle *AH, thandle worker, int status, ParallelSlot *slots, int n_slots) { - TocEntry *te = NULL; - int i; + TocEntry *te = NULL; + int i; for (i = 0; i < n_slots; i++) { @@ -3597,13 +3599,12 @@ fix_dependencies(ArchiveHandle *AH) { TocEntry **tocsByDumpId; TocEntry *te; - int i; + int i; /* * For some of the steps here, it is convenient to have an array that - * indexes the TOC entries by dump ID, rather than searching the TOC - * list repeatedly. Entries for dump IDs not present in the TOC will - * be NULL. + * indexes the TOC entries by dump ID, rather than searching the TOC list + * repeatedly. Entries for dump IDs not present in the TOC will be NULL. * * Also, initialize the depCount fields. */ @@ -3622,18 +3623,17 @@ fix_dependencies(ArchiveHandle *AH) * dependencies. * * Note: currently, a TABLE DATA should always have exactly one - * dependency, on its TABLE item. So we don't bother to search, - * but look just at the first dependency. We do trouble to make sure - * that it's a TABLE, if possible. However, if the dependency isn't - * in the archive then just assume it was a TABLE; this is to cover - * cases where the table was suppressed but we have the data and some - * dependent post-data items. + * dependency, on its TABLE item. So we don't bother to search, but look + * just at the first dependency. We do trouble to make sure that it's a + * TABLE, if possible. However, if the dependency isn't in the archive + * then just assume it was a TABLE; this is to cover cases where the table + * was suppressed but we have the data and some dependent post-data items. */ for (te = AH->toc->next; te != AH->toc; te = te->next) { if (strcmp(te->desc, "TABLE DATA") == 0 && te->nDeps > 0) { - DumpId tableId = te->dependencies[0]; + DumpId tableId = te->dependencies[0]; if (tocsByDumpId[tableId - 1] == NULL || strcmp(tocsByDumpId[tableId - 1]->desc, "TABLE") == 0) @@ -3644,9 +3644,9 @@ fix_dependencies(ArchiveHandle *AH) } /* - * Pre-8.4 versions of pg_dump neglected to set up a dependency from - * BLOB COMMENTS to BLOBS. Cope. (We assume there's only one BLOBS - * and only one BLOB COMMENTS in such files.) + * Pre-8.4 versions of pg_dump neglected to set up a dependency from BLOB + * COMMENTS to BLOBS. Cope. (We assume there's only one BLOBS and only + * one BLOB COMMENTS in such files.) */ if (AH->version < K_VERS_1_11) { @@ -3674,7 +3674,7 @@ fix_dependencies(ArchiveHandle *AH) /* * It is possible that the dependencies list items that are not in the - * archive at all. Subtract such items from the depCounts. + * archive at all. Subtract such items from the depCounts. */ for (te = AH->toc->next; te != AH->toc; te = te->next) { @@ -3707,7 +3707,7 @@ repoint_table_dependencies(ArchiveHandle *AH, DumpId tableId, DumpId tableDataId) { TocEntry *te; - int i; + int i; for (te = AH->toc->next; te != AH->toc; te = te->next) { @@ -3753,16 +3753,16 @@ identify_locking_dependencies(TocEntry *te, TocEntry **tocsByDumpId) /* * We assume the item requires exclusive lock on each TABLE DATA item - * listed among its dependencies. (This was originally a dependency - * on the TABLE, but fix_dependencies repointed it to the data item. - * Note that all the entry types we are interested in here are POST_DATA, - * so they will all have been changed this way.) + * listed among its dependencies. (This was originally a dependency on + * the TABLE, but fix_dependencies repointed it to the data item. Note + * that all the entry types we are interested in here are POST_DATA, so + * they will all have been changed this way.) */ lockids = (DumpId *) malloc(te->nDeps * sizeof(DumpId)); nlockids = 0; for (i = 0; i < te->nDeps; i++) { - DumpId depid = te->dependencies[i]; + DumpId depid = te->dependencies[i]; if (tocsByDumpId[depid - 1] && strcmp(tocsByDumpId[depid - 1]->desc, "TABLE DATA") == 0) @@ -3786,10 +3786,10 @@ identify_locking_dependencies(TocEntry *te, TocEntry **tocsByDumpId) static void reduce_dependencies(ArchiveHandle *AH, TocEntry *te) { - DumpId target = te->dumpId; - int i; + DumpId target = te->dumpId; + int i; - ahlog(AH,2,"reducing dependencies for %d\n",target); + ahlog(AH, 2, "reducing dependencies for %d\n", target); /* * We must examine all entries, not only the ones after the target item, @@ -3870,7 +3870,7 @@ CloneArchive(ArchiveHandle *AH) ArchiveHandle *clone; /* Make a "flat" copy */ - clone = (ArchiveHandle *) malloc(sizeof(ArchiveHandle)); + clone = (ArchiveHandle *) malloc(sizeof(ArchiveHandle)); if (clone == NULL) die_horribly(AH, modulename, "out of memory\n"); memcpy(clone, AH, sizeof(ArchiveHandle)); diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h index 11c6a83dcb..2cde2dbda3 100644 --- a/src/bin/pg_dump/pg_backup_archiver.h +++ b/src/bin/pg_dump/pg_backup_archiver.h @@ -17,7 +17,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.78 2009/02/26 16:02:38 petere Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.79 2009/06/11 14:49:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -85,7 +85,8 @@ typedef z_stream *z_streamp; #define K_VERS_1_9 (( (1 * 256 + 9) * 256 + 0) * 256 + 0) /* add default_with_oids * tracking */ #define K_VERS_1_10 (( (1 * 256 + 10) * 256 + 0) * 256 + 0) /* add tablespace */ -#define K_VERS_1_11 (( (1 * 256 + 11) * 256 + 0) * 256 + 0) /* add toc section indicator */ +#define K_VERS_1_11 (( (1 * 256 + 11) * 256 + 0) * 256 + 0) /* add toc section + * indicator */ #define K_VERS_MAX (( (1 * 256 + 11) * 256 + 255) * 256 + 0) @@ -231,15 +232,15 @@ typedef struct _archiveHandle StartBlobPtr StartBlobPtr; EndBlobPtr EndBlobPtr; - ClonePtr ClonePtr; /* Clone format-specific fields */ - DeClonePtr DeClonePtr; /* Clean up cloned fields */ + ClonePtr ClonePtr; /* Clone format-specific fields */ + DeClonePtr DeClonePtr; /* Clean up cloned fields */ CustomOutPtr CustomOutPtr; /* Alternative script output routine */ /* Stuff for direct DB connection */ char *archdbname; /* DB name *read* from archive */ enum trivalue promptPassword; - char *savedPassword; /* password for ropt->username, if known */ + char *savedPassword; /* password for ropt->username, if known */ PGconn *connection; int connectToDB; /* Flag to indicate if direct DB connection is * required */ @@ -292,7 +293,7 @@ typedef struct _tocEntry struct _tocEntry *next; CatalogId catalogId; DumpId dumpId; - teSection section; + teSection section; bool hadDumper; /* Archiver was passed a dumper routine (used * in restore) */ char *tag; /* index tag */ diff --git a/src/bin/pg_dump/pg_backup_custom.c b/src/bin/pg_dump/pg_backup_custom.c index ebe2d6ce18..5d6cf4de95 100644 --- a/src/bin/pg_dump/pg_backup_custom.c +++ b/src/bin/pg_dump/pg_backup_custom.c @@ -19,7 +19,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.41 2009/02/02 20:07:37 adunstan Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.42 2009/06/11 14:49:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -133,8 +133,8 @@ InitArchiveFmt_Custom(ArchiveHandle *AH) AH->StartBlobPtr = _StartBlob; AH->EndBlobPtr = _EndBlob; AH->EndBlobsPtr = _EndBlobs; - AH->ClonePtr = _Clone; - AH->DeClonePtr = _DeClone; + AH->ClonePtr = _Clone; + AH->DeClonePtr = _DeClone; /* * Set up some special context used in compressing data. @@ -842,28 +842,28 @@ _CloseArchive(ArchiveHandle *AH) * is because on Windows, this is used within a multithreading context, * and we don't want a thread closing the parent file handle.) */ -static void +static void _ReopenArchive(ArchiveHandle *AH) { lclContext *ctx = (lclContext *) AH->formatData; pgoff_t tpos; if (AH->mode == archModeWrite) - die_horribly(AH,modulename,"can only reopen input archives\n"); + die_horribly(AH, modulename, "can only reopen input archives\n"); if (AH->fSpec == NULL || strcmp(AH->fSpec, "") == 0) - die_horribly(AH,modulename,"cannot reopen stdin\n"); + die_horribly(AH, modulename, "cannot reopen stdin\n"); if (!ctx->hasSeek) - die_horribly(AH,modulename,"cannot reopen non-seekable file\n"); + die_horribly(AH, modulename, "cannot reopen non-seekable file\n"); errno = 0; tpos = ftello(AH->FH); if (errno) - die_horribly(AH, modulename, "could not determine seek position in archive file: %s\n", + die_horribly(AH, modulename, "could not determine seek position in archive file: %s\n", strerror(errno)); #ifndef WIN32 if (fclose(AH->FH) != 0) - die_horribly(AH, modulename, "could not close archive file: %s\n", + die_horribly(AH, modulename, "could not close archive file: %s\n", strerror(errno)); #endif @@ -873,7 +873,7 @@ _ReopenArchive(ArchiveHandle *AH) AH->fSpec, strerror(errno)); if (fseeko(AH->FH, tpos, SEEK_SET) != 0) - die_horribly(AH, modulename, "could not set seek position in archive file: %s\n", + die_horribly(AH, modulename, "could not set seek position in archive file: %s\n", strerror(errno)); } @@ -1085,8 +1085,8 @@ _Clone(ArchiveHandle *AH) die_horribly(AH, modulename, "out of memory\n"); /* - * Note: we do not make a local lo_buf because we expect at most one - * BLOBS entry per archive, so no parallelism is possible. Likewise, + * Note: we do not make a local lo_buf because we expect at most one BLOBS + * entry per archive, so no parallelism is possible. Likewise, * TOC-entry-local state isn't an issue because any one TOC entry is * touched by just one worker child. */ @@ -1096,7 +1096,7 @@ static void _DeClone(ArchiveHandle *AH) { lclContext *ctx = (lclContext *) AH->formatData; - + free(ctx->zlibOut); free(ctx->zlibIn); free(ctx->zp); diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c index 52e0d82b15..836b02cb93 100644 --- a/src/bin/pg_dump/pg_backup_db.c +++ b/src/bin/pg_dump/pg_backup_db.c @@ -5,7 +5,7 @@ * Implements the basic DB functions used by the archiver. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.83 2009/02/26 16:02:38 petere Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.84 2009/06/11 14:49:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -119,7 +119,7 @@ ReconnectToServer(ArchiveHandle *AH, const char *dbname, const char *username) * * Note: it's not really all that sensible to use a single-entry password * cache if the username keeps changing. In current usage, however, the - * username never does change, so one savedPassword is sufficient. We do + * username never does change, so one savedPassword is sufficient. We do * update the cache on the off chance that the password has changed since the * start of the run. */ @@ -290,7 +290,7 @@ ExecuteSqlCommand(ArchiveHandle *AH, const char *qry, const char *desc) char errStmt[DB_MAX_ERR_STMT]; #ifdef NOT_USED - fprintf(stderr, "Executing: '%s'\n\n", qry); + fprintf(stderr, "Executing: '%s'\n\n", qry); #endif res = PQexec(conn, qry); diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 218c6f214a..ad1086d169 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -12,7 +12,7 @@ * by PostgreSQL * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.538 2009/05/27 20:42:29 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.539 2009/06/11 14:49:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -158,8 +158,8 @@ static void dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo); static void dumpForeignDataWrapper(Archive *fout, FdwInfo *fdwinfo); static void dumpForeignServer(Archive *fout, ForeignServerInfo *srvinfo); static void dumpUserMappings(Archive *fout, const char *target, - const char *servername, const char *namespace, - const char *owner, CatalogId catalogId, DumpId dumpId); + const char *servername, const char *namespace, + const char *owner, CatalogId catalogId, DumpId dumpId); static void dumpACL(Archive *fout, CatalogId objCatId, DumpId objDumpId, const char *type, const char *name, const char *subname, @@ -172,9 +172,9 @@ static void getTableData(TableInfo *tblinfo, int numTables, bool oids); static void getTableDataFKConstraints(void); static char *format_function_arguments(FuncInfo *finfo, char *funcargs); static char *format_function_arguments_old(FuncInfo *finfo, int nallargs, - char **allargtypes, - char **argmodes, - char **argnames); + char **allargtypes, + char **argmodes, + char **argnames); static char *format_function_signature(FuncInfo *finfo, bool honor_quotes); static const char *convertRegProcReference(const char *proc); static const char *convertOperatorReference(const char *opr); @@ -230,7 +230,7 @@ main(int argc, char **argv) RestoreOptions *ropt; static int disable_triggers = 0; - static int outputNoTablespaces = 0; + static int outputNoTablespaces = 0; static int use_setsessauth = 0; struct option long_options[] = { @@ -539,8 +539,8 @@ main(int argc, char **argv) } /* - * We allow the server to be back to 7.0, and up to any minor release - * of our own major version. (See also version check in pg_dumpall.c.) + * We allow the server to be back to 7.0, and up to any minor release of + * our own major version. (See also version check in pg_dumpall.c.) */ g_fout->minRemoteVersion = 70000; g_fout->maxRemoteVersion = (my_version / 100) * 100 + 99; @@ -809,7 +809,7 @@ help(const char *progname) printf(_(" -N, --exclude-schema=SCHEMA do NOT dump the named schema(s)\n")); printf(_(" -o, --oids include OIDs in dump\n")); printf(_(" -O, --no-owner skip restoration of object ownership in\n" - " plain-text format\n")); + " plain-text format\n")); printf(_(" -s, --schema-only dump only the schema, no data\n")); printf(_(" -S, --superuser=NAME superuser user name to use in plain-text format\n")); printf(_(" -t, --table=TABLE dump the named table(s) only\n")); @@ -823,8 +823,8 @@ help(const char *progname) printf(_(" --no-tablespaces do not dump tablespace assignments\n")); printf(_(" --role=ROLENAME do SET ROLE before dump\n")); printf(_(" --use-set-session-authorization\n" - " use SET SESSION AUTHORIZATION commands instead of\n" - " ALTER OWNER commands to set ownership\n")); + " use SET SESSION AUTHORIZATION commands instead of\n" + " ALTER OWNER commands to set ownership\n")); printf(_("\nConnection options:\n")); printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); @@ -1010,7 +1010,7 @@ selectDumpableTable(TableInfo *tbinfo) * Mark a type as to be dumped or not * * If it's a table's rowtype or an autogenerated array type, we also apply a - * special type code to facilitate sorting into the desired order. (We don't + * special type code to facilitate sorting into the desired order. (We don't * want to consider those to be ordinary types because that would bring tables * up into the datatype part of the dump order.) Those tests should be made * first to ensure the objType change is applied regardless of namespace etc. @@ -1465,7 +1465,7 @@ getTableDataFKConstraints(void) if (dobjs[i]->objType == DO_FK_CONSTRAINT) { ConstraintInfo *cinfo = (ConstraintInfo *) dobjs[i]; - TableInfo *ftable; + TableInfo *ftable; /* Not interesting unless both tables are to be dumped */ if (cinfo->contable == NULL || @@ -1475,9 +1475,10 @@ getTableDataFKConstraints(void) if (ftable == NULL || ftable->dataObj == NULL) continue; + /* - * Okay, make referencing table's TABLE_DATA object depend on - * the referenced table's TABLE_DATA object. + * Okay, make referencing table's TABLE_DATA object depend on the + * referenced table's TABLE_DATA object. */ addObjectDependency(&cinfo->contable->dataObj->dobj, ftable->dataObj->dobj.dumpId); @@ -1490,7 +1491,7 @@ getTableDataFKConstraints(void) /* * guessConstraintInheritance: * In pre-8.4 databases, we can't tell for certain which constraints - * are inherited. We assume a CHECK constraint is inherited if its name + * are inherited. We assume a CHECK constraint is inherited if its name * matches the name of any constraint in the parent. Originally this code * tried to compare the expression texts, but that can fail for various * reasons --- for example, if the parent and child tables are in different @@ -1620,7 +1621,7 @@ dumpDatabase(Archive *AH) appendPQExpBuffer(dbQry, "SELECT tableoid, oid, " "(%s datdba) AS dba, " "pg_encoding_to_char(encoding) AS encoding, " - "NULL AS datcollate, NULL AS datctype, datfrozenxid, " + "NULL AS datcollate, NULL AS datctype, datfrozenxid, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = dattablespace) AS tablespace, " "shobj_description(oid, 'pg_database') AS description " @@ -1634,7 +1635,7 @@ dumpDatabase(Archive *AH) appendPQExpBuffer(dbQry, "SELECT tableoid, oid, " "(%s datdba) AS dba, " "pg_encoding_to_char(encoding) AS encoding, " - "NULL AS datcollate, NULL AS datctype, datfrozenxid, " + "NULL AS datcollate, NULL AS datctype, datfrozenxid, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = dattablespace) AS tablespace " "FROM pg_database " "WHERE datname = ", @@ -1733,13 +1734,13 @@ dumpDatabase(Archive *AH) { appendPQExpBuffer(creaQry, "\n-- For binary upgrade, set datfrozenxid.\n"); appendPQExpBuffer(creaQry, "UPDATE pg_database\n" - "SET datfrozenxid = '%u'\n" - "WHERE datname = ", - frozenxid); + "SET datfrozenxid = '%u'\n" + "WHERE datname = ", + frozenxid); appendStringLiteralAH(creaQry, datname, AH); appendPQExpBuffer(creaQry, ";\n"); } - + appendPQExpBuffer(delQry, "DROP DATABASE %s;\n", fmtId(datname)); @@ -1754,7 +1755,7 @@ dumpDatabase(Archive *AH) dba, /* Owner */ false, /* with oids */ "DATABASE", /* Desc */ - SECTION_PRE_DATA, /* Section */ + SECTION_PRE_DATA, /* Section */ creaQry->data, /* Create */ delQry->data, /* Del */ NULL, /* Copy */ @@ -1775,7 +1776,11 @@ dumpDatabase(Archive *AH) if (comment && strlen(comment)) { resetPQExpBuffer(dbQry); - /* Generates warning when loaded into a differently-named database.*/ + + /* + * Generates warning when loaded into a differently-named + * database. + */ appendPQExpBuffer(dbQry, "COMMENT ON DATABASE %s IS ", fmtId(datname)); appendStringLiteralAH(dbQry, comment, AH); appendPQExpBuffer(dbQry, ";\n"); @@ -1995,26 +2000,26 @@ dumpBlobComments(Archive *AH, void *arg) /* Cursor to get all BLOB comments */ if (AH->remoteVersion >= 70300) blobQry = "DECLARE blobcmt CURSOR FOR SELECT loid, " - "obj_description(loid, 'pg_largeobject') " - "FROM (SELECT DISTINCT loid FROM " - "pg_description d JOIN pg_largeobject l ON (objoid = loid) " - "WHERE classoid = 'pg_largeobject'::regclass) ss"; + "obj_description(loid, 'pg_largeobject') " + "FROM (SELECT DISTINCT loid FROM " + "pg_description d JOIN pg_largeobject l ON (objoid = loid) " + "WHERE classoid = 'pg_largeobject'::regclass) ss"; else if (AH->remoteVersion >= 70200) blobQry = "DECLARE blobcmt CURSOR FOR SELECT loid, " - "obj_description(loid, 'pg_largeobject') " - "FROM (SELECT DISTINCT loid FROM pg_largeobject) ss"; + "obj_description(loid, 'pg_largeobject') " + "FROM (SELECT DISTINCT loid FROM pg_largeobject) ss"; else if (AH->remoteVersion >= 70100) blobQry = "DECLARE blobcmt CURSOR FOR SELECT loid, " - "obj_description(loid) " - "FROM (SELECT DISTINCT loid FROM pg_largeobject) ss"; + "obj_description(loid) " + "FROM (SELECT DISTINCT loid FROM pg_largeobject) ss"; else blobQry = "DECLARE blobcmt CURSOR FOR SELECT oid, " - " ( " - " SELECT description " - " FROM pg_description pd " - " WHERE pd.objoid=pc.oid " - " ) " - "FROM pg_class pc WHERE relkind = 'l'"; + " ( " + " SELECT description " + " FROM pg_description pd " + " WHERE pd.objoid=pc.oid " + " ) " + "FROM pg_class pc WHERE relkind = 'l'"; res = PQexec(g_conn, blobQry); check_sql_result(res, g_conn, blobQry, PGRES_COMMAND_OK); @@ -3178,7 +3183,7 @@ getTables(int *numTables) "d.refobjid AS owning_tab, " "d.refobjsubid AS owning_col, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = c.reltablespace) AS reltablespace, " - "array_to_string(c.reloptions, ', ') AS reloptions, " + "array_to_string(c.reloptions, ', ') AS reloptions, " "array_to_string(array(SELECT 'toast.' || x FROM unnest(tc.reloptions) x), ', ') AS toast_reloptions " "FROM pg_class c " "LEFT JOIN pg_depend d ON " @@ -3186,7 +3191,7 @@ getTables(int *numTables) "d.classid = c.tableoid AND d.objid = c.oid AND " "d.objsubid = 0 AND " "d.refclassid = c.tableoid AND d.deptype = 'a') " - "LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) " + "LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) " "WHERE c.relkind in ('%c', '%c', '%c', '%c') " "ORDER BY c.oid", username_subquery, @@ -3210,7 +3215,7 @@ getTables(int *numTables) "d.refobjid AS owning_tab, " "d.refobjsubid AS owning_col, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = c.reltablespace) AS reltablespace, " - "array_to_string(c.reloptions, ', ') AS reloptions, " + "array_to_string(c.reloptions, ', ') AS reloptions, " "NULL AS toast_reloptions " "FROM pg_class c " "LEFT JOIN pg_depend d ON " @@ -3405,9 +3410,9 @@ getTables(int *numTables) /* * Arrange to fail instead of waiting forever for a table lock. * - * NB: this coding assumes that the only queries issued within - * the following loop are LOCK TABLEs; else the timeout may be - * undesirably applied to other things too. + * NB: this coding assumes that the only queries issued within the + * following loop are LOCK TABLEs; else the timeout may be undesirably + * applied to other things too. */ resetPQExpBuffer(query); appendPQExpBuffer(query, "SET statement_timeout = "); @@ -4528,7 +4533,7 @@ getCasts(int *numCasts) { appendPQExpBuffer(query, "SELECT tableoid, oid, " "castsource, casttarget, castfunc, castcontext, " - "CASE WHEN castfunc = 0 THEN 'b' ELSE 'f' END AS castmethod " + "CASE WHEN castfunc = 0 THEN 'b' ELSE 'f' END AS castmethod " "FROM pg_cast ORDER BY 3,4"); } else @@ -4686,9 +4691,9 @@ getTableAttrs(TableInfo *tblinfo, int numTables) { /* need left join here to not fail on dropped columns ... */ appendPQExpBuffer(q, "SELECT a.attnum, a.attname, a.atttypmod, " - "a.attstattarget, a.attstorage, t.typstorage, " - "a.attnotnull, a.atthasdef, a.attisdropped, " - "a.attlen, a.attalign, a.attislocal, " + "a.attstattarget, a.attstorage, t.typstorage, " + "a.attnotnull, a.atthasdef, a.attisdropped, " + "a.attlen, a.attalign, a.attislocal, " "pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname " "FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t " "ON a.atttypid = t.oid " @@ -4705,7 +4710,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) * explicitly set or was just a default. */ appendPQExpBuffer(q, "SELECT a.attnum, a.attname, " - "a.atttypmod, -1 AS attstattarget, a.attstorage, " + "a.atttypmod, -1 AS attstattarget, a.attstorage, " "t.typstorage, a.attnotnull, a.atthasdef, " "false AS attisdropped, 0 AS attlen, " "' ' AS attalign, false AS attislocal, " @@ -4725,7 +4730,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) "attstorage AS typstorage, " "attnotnull, atthasdef, false AS attisdropped, " "0 AS attlen, ' ' AS attalign, " - "false AS attislocal, " + "false AS attislocal, " "(SELECT typname FROM pg_type WHERE oid = atttypid) AS atttypname " "FROM pg_attribute a " "WHERE attrelid = '%u'::oid " @@ -4803,9 +4808,8 @@ getTableAttrs(TableInfo *tblinfo, int numTables) /* - * ALTER TABLE DROP COLUMN clears pg_attribute.atttypid, so we - * set the column data type to 'TEXT; we will later drop the - * column. + * ALTER TABLE DROP COLUMN clears pg_attribute.atttypid, so we set the + * column data type to 'TEXT; we will later drop the column. */ if (binary_upgrade) { @@ -4815,7 +4819,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) tbinfo->atttypnames[j] = strdup("TEXT"); } } - + /* * Get info about column defaults */ @@ -4935,7 +4939,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) if (g_fout->remoteVersion >= 80400) { appendPQExpBuffer(q, "SELECT tableoid, oid, conname, " - "pg_catalog.pg_get_constraintdef(oid) AS consrc, " + "pg_catalog.pg_get_constraintdef(oid) AS consrc, " "conislocal " "FROM pg_catalog.pg_constraint " "WHERE conrelid = '%u'::pg_catalog.oid " @@ -4946,7 +4950,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) else if (g_fout->remoteVersion >= 70400) { appendPQExpBuffer(q, "SELECT tableoid, oid, conname, " - "pg_catalog.pg_get_constraintdef(oid) AS consrc, " + "pg_catalog.pg_get_constraintdef(oid) AS consrc, " "true AS conislocal " "FROM pg_catalog.pg_constraint " "WHERE conrelid = '%u'::pg_catalog.oid " @@ -5048,8 +5052,8 @@ getTableAttrs(TableInfo *tblinfo, int numTables) constrs[j].dobj.dumpId); /* - * If the constraint is inherited, this will be detected - * later (in pre-8.4 databases). We also detect later if the + * If the constraint is inherited, this will be detected later + * (in pre-8.4 databases). We also detect later if the * constraint must be split out from the table definition. */ } @@ -5395,7 +5399,7 @@ getForeignDataWrappers(int *numForeignDataWrappers) int ntups; int i; PQExpBuffer query = createPQExpBuffer(); - FdwInfo *fdwinfo; + FdwInfo *fdwinfo; int i_oid; int i_fdwname; int i_rolname; @@ -5414,10 +5418,10 @@ getForeignDataWrappers(int *numForeignDataWrappers) selectSourceSchema("pg_catalog"); appendPQExpBuffer(query, "SELECT oid, fdwname, " - "(%s fdwowner) AS rolname, fdwvalidator::pg_catalog.regproc, fdwacl," + "(%s fdwowner) AS rolname, fdwvalidator::pg_catalog.regproc, fdwacl," "array_to_string(ARRAY(" - " SELECT option_name || ' ' || quote_literal(option_value) " - " FROM pg_options_to_table(fdwoptions)), ', ') AS fdwoptions " + " SELECT option_name || ' ' || quote_literal(option_value) " + " FROM pg_options_to_table(fdwoptions)), ', ') AS fdwoptions " "FROM pg_foreign_data_wrapper", username_subquery); @@ -5498,8 +5502,8 @@ getForeignServers(int *numForeignServers) "(%s srvowner) AS rolname, " "srvfdw, srvtype, srvversion, srvacl," "array_to_string(ARRAY(" - " SELECT option_name || ' ' || quote_literal(option_value) " - " FROM pg_options_to_table(srvoptions)), ', ') AS srvoptions " + " SELECT option_name || ' ' || quote_literal(option_value) " + " FROM pg_options_to_table(srvoptions)), ', ') AS srvoptions " "FROM pg_foreign_server", username_subquery); @@ -5598,9 +5602,9 @@ dumpComment(Archive *fout, const char *target, appendPQExpBuffer(query, ";\n"); /* - * We mark comments as SECTION_NONE because they really belong - * in the same section as their parent, whether that is - * pre-data or post-data. + * We mark comments as SECTION_NONE because they really belong in the + * same section as their parent, whether that is pre-data or + * post-data. */ ArchiveEntry(fout, nilCatalogId, createDumpId(), target, namespace, NULL, owner, @@ -6343,7 +6347,7 @@ dumpBaseType(Archive *fout, TypeInfo *tinfo) if (ntups != 1) { write_msg(NULL, ngettext("query returned %d row instead of one: %s\n", - "query returned %d rows instead of one: %s\n", + "query returned %d rows instead of one: %s\n", ntups), ntups, query->data); exit_nicely(); @@ -6542,7 +6546,7 @@ dumpDomain(Archive *fout, TypeInfo *tinfo) if (ntups != 1) { write_msg(NULL, ngettext("query returned %d row instead of one: %s\n", - "query returned %d rows instead of one: %s\n", + "query returned %d rows instead of one: %s\n", ntups), ntups, query->data); exit_nicely(); @@ -6905,7 +6909,8 @@ dumpProcLang(Archive *fout, ProcLangInfo *plang) * This is used when we can rely on pg_get_function_arguments to format * the argument list. */ -static char *format_function_arguments(FuncInfo *finfo, char *funcargs) +static char * +format_function_arguments(FuncInfo *finfo, char *funcargs) { PQExpBufferData fn; @@ -7033,8 +7038,8 @@ dumpFunc(Archive *fout, FuncInfo *finfo) PQExpBuffer delqry; PQExpBuffer asPart; PGresult *res; - char *funcsig; /* identity signature */ - char *funcfullsig; /* full signature */ + char *funcsig; /* identity signature */ + char *funcfullsig; /* full signature */ char *funcsig_tag; int ntups; char *proretset; @@ -7084,9 +7089,9 @@ dumpFunc(Archive *fout, FuncInfo *finfo) */ appendPQExpBuffer(query, "SELECT proretset, prosrc, probin, " - "pg_catalog.pg_get_function_arguments(oid) AS funcargs, " - "pg_catalog.pg_get_function_identity_arguments(oid) AS funciargs, " - "pg_catalog.pg_get_function_result(oid) AS funcresult, " + "pg_catalog.pg_get_function_arguments(oid) AS funcargs, " + "pg_catalog.pg_get_function_identity_arguments(oid) AS funciargs, " + "pg_catalog.pg_get_function_result(oid) AS funcresult, " "proiswindow, provolatile, proisstrict, prosecdef, " "proconfig, procost, prorows, " "(SELECT lanname FROM pg_catalog.pg_language WHERE oid = prolang) AS lanname " @@ -7193,7 +7198,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) if (ntups != 1) { write_msg(NULL, ngettext("query returned %d row instead of one: %s\n", - "query returned %d rows instead of one: %s\n", + "query returned %d rows instead of one: %s\n", ntups), ntups, query->data); exit_nicely(); @@ -7552,7 +7557,7 @@ dumpCast(Archive *fout, CastInfo *cast) getFormattedTypeName(cast->castsource, zeroAsNone), getFormattedTypeName(cast->casttarget, zeroAsNone)); - switch(cast->castmethod) + switch (cast->castmethod) { case COERCION_METHOD_BINARY: appendPQExpBuffer(defqry, "WITHOUT FUNCTION"); @@ -7561,6 +7566,7 @@ dumpCast(Archive *fout, CastInfo *cast) appendPQExpBuffer(defqry, "WITH INOUT"); break; case COERCION_METHOD_FUNCTION: + /* * Always qualify the function name, in case it is not in * pg_catalog schema (format_function_signature won't qualify it). @@ -7730,7 +7736,7 @@ dumpOpr(Archive *fout, OprInfo *oprinfo) if (ntups != 1) { write_msg(NULL, ngettext("query returned %d row instead of one: %s\n", - "query returned %d rows instead of one: %s\n", + "query returned %d rows instead of one: %s\n", ntups), ntups, query->data); exit_nicely(); @@ -7980,7 +7986,7 @@ convertTSFunction(Oid funcOid) if (ntups != 1) { write_msg(NULL, ngettext("query returned %d row instead of one: %s\n", - "query returned %d rows instead of one: %s\n", + "query returned %d rows instead of one: %s\n", ntups), ntups, query); exit_nicely(); @@ -8086,7 +8092,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo) if (ntups != 1) { write_msg(NULL, ngettext("query returned %d row instead of one: %s\n", - "query returned %d rows instead of one: %s\n", + "query returned %d rows instead of one: %s\n", ntups), ntups, query->data); exit_nicely(); @@ -8160,9 +8166,9 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo) * * XXX RECHECK is gone as of 8.4, but we'll still print it if dumping * an older server's opclass in which it is used. This is to avoid - * hard-to-detect breakage if a newer pg_dump is used to dump from - * an older server and then reload into that old version. This can - * go away once 8.3 is so old as to not be of interest to anyone. + * hard-to-detect breakage if a newer pg_dump is used to dump from an + * older server and then reload into that old version. This can go + * away once 8.3 is so old as to not be of interest to anyone. */ appendPQExpBuffer(query, "SELECT amopstrategy, false AS amopreqcheck, " "amopopr::pg_catalog.regoperator " @@ -8373,31 +8379,31 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo) /* * XXX RECHECK is gone as of 8.4, but we'll still print it if dumping * an older server's opclass in which it is used. This is to avoid - * hard-to-detect breakage if a newer pg_dump is used to dump from - * an older server and then reload into that old version. This can - * go away once 8.3 is so old as to not be of interest to anyone. + * hard-to-detect breakage if a newer pg_dump is used to dump from an + * older server and then reload into that old version. This can go + * away once 8.3 is so old as to not be of interest to anyone. */ appendPQExpBuffer(query, "SELECT amopstrategy, false AS amopreqcheck, " - "amopopr::pg_catalog.regoperator " - "FROM pg_catalog.pg_amop ao, pg_catalog.pg_depend " + "amopopr::pg_catalog.regoperator " + "FROM pg_catalog.pg_amop ao, pg_catalog.pg_depend " "WHERE refclassid = 'pg_catalog.pg_opfamily'::pg_catalog.regclass " - "AND refobjid = '%u'::pg_catalog.oid " + "AND refobjid = '%u'::pg_catalog.oid " "AND classid = 'pg_catalog.pg_amop'::pg_catalog.regclass " - "AND objid = ao.oid " - "ORDER BY amopstrategy", - opfinfo->dobj.catId.oid); + "AND objid = ao.oid " + "ORDER BY amopstrategy", + opfinfo->dobj.catId.oid); } else { appendPQExpBuffer(query, "SELECT amopstrategy, amopreqcheck, " - "amopopr::pg_catalog.regoperator " - "FROM pg_catalog.pg_amop ao, pg_catalog.pg_depend " + "amopopr::pg_catalog.regoperator " + "FROM pg_catalog.pg_amop ao, pg_catalog.pg_depend " "WHERE refclassid = 'pg_catalog.pg_opfamily'::pg_catalog.regclass " - "AND refobjid = '%u'::pg_catalog.oid " + "AND refobjid = '%u'::pg_catalog.oid " "AND classid = 'pg_catalog.pg_amop'::pg_catalog.regclass " - "AND objid = ao.oid " - "ORDER BY amopstrategy", - opfinfo->dobj.catId.oid); + "AND objid = ao.oid " + "ORDER BY amopstrategy", + opfinfo->dobj.catId.oid); } res_ops = PQexec(g_conn, query->data); @@ -8471,7 +8477,7 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo) if (ntups != 1) { write_msg(NULL, ngettext("query returned %d row instead of one: %s\n", - "query returned %d rows instead of one: %s\n", + "query returned %d rows instead of one: %s\n", ntups), ntups, query->data); exit_nicely(); @@ -8647,7 +8653,7 @@ dumpConversion(Archive *fout, ConvInfo *convinfo) if (ntups != 1) { write_msg(NULL, ngettext("query returned %d row instead of one: %s\n", - "query returned %d rows instead of one: %s\n", + "query returned %d rows instead of one: %s\n", ntups), ntups, query->data); exit_nicely(); @@ -8844,7 +8850,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) if (ntups != 1) { write_msg(NULL, ngettext("query returned %d row instead of one: %s\n", - "query returned %d rows instead of one: %s\n", + "query returned %d rows instead of one: %s\n", ntups), ntups, query->data); exit_nicely(); @@ -9071,7 +9077,7 @@ dumpTSDictionary(Archive *fout, TSDictInfo *dictinfo) if (ntups != 1) { write_msg(NULL, ngettext("query returned %d row instead of one: %s\n", - "query returned %d rows instead of one: %s\n", + "query returned %d rows instead of one: %s\n", ntups), ntups, query->data); exit_nicely(); @@ -9226,7 +9232,7 @@ dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo) if (ntups != 1) { write_msg(NULL, ngettext("query returned %d row instead of one: %s\n", - "query returned %d rows instead of one: %s\n", + "query returned %d rows instead of one: %s\n", ntups), ntups, query->data); exit_nicely(); @@ -9412,7 +9418,7 @@ dumpForeignServer(Archive *fout, ForeignServerInfo *srvinfo) if (ntups != 1) { write_msg(NULL, ngettext("query returned %d row instead of one: %s\n", - "query returned %d rows instead of one: %s\n", + "query returned %d rows instead of one: %s\n", ntups), ntups, query->data); exit_nicely(); @@ -9467,7 +9473,7 @@ dumpForeignServer(Archive *fout, ForeignServerInfo *srvinfo) dumpUserMappings(fout, q->data, srvinfo->dobj.name, NULL, srvinfo->rolname, - srvinfo->dobj.catId, srvinfo->dobj.dumpId); + srvinfo->dobj.catId, srvinfo->dobj.dumpId); destroyPQExpBuffer(q); destroyPQExpBuffer(delq); @@ -9482,9 +9488,9 @@ dumpForeignServer(Archive *fout, ForeignServerInfo *srvinfo) */ static void dumpUserMappings(Archive *fout, const char *target, - const char *servername, const char *namespace, - const char *owner, - CatalogId catalogId, DumpId dumpId) + const char *servername, const char *namespace, + const char *owner, + CatalogId catalogId, DumpId dumpId) { PQExpBuffer q; PQExpBuffer delq; @@ -9519,7 +9525,7 @@ dumpUserMappings(Archive *fout, const char *target, for (i = 0; i < ntups; i++) { char *umuser; - char *umoptions; + char *umoptions; umuser = PQgetvalue(res, i, i_umuser); umoptions = PQgetvalue(res, i, i_umoptions); @@ -9615,7 +9621,7 @@ dumpTable(Archive *fout, TableInfo *tbinfo) { if (tbinfo->dobj.dump) { - char *namecopy; + char *namecopy; if (tbinfo->relkind == RELKIND_SEQUENCE) dumpSequence(fout, tbinfo); @@ -9631,18 +9637,18 @@ dumpTable(Archive *fout, TableInfo *tbinfo) tbinfo->relacl); /* - * Handle column ACLs, if any. Note: we pull these with a separate + * Handle column ACLs, if any. Note: we pull these with a separate * query rather than trying to fetch them during getTableAttrs, so * that we won't miss ACLs on system columns. */ if (g_fout->remoteVersion >= 80400) { PQExpBuffer query = createPQExpBuffer(); - PGresult *res; - int i; + PGresult *res; + int i; appendPQExpBuffer(query, - "SELECT attname, attacl FROM pg_catalog.pg_attribute " + "SELECT attname, attacl FROM pg_catalog.pg_attribute " "WHERE attrelid = '%u' AND NOT attisdropped AND attacl IS NOT NULL " "ORDER BY attnum", tbinfo->dobj.catId.oid); @@ -9651,10 +9657,10 @@ dumpTable(Archive *fout, TableInfo *tbinfo) for (i = 0; i < PQntuples(res); i++) { - char *attname = PQgetvalue(res, i, 0); - char *attacl = PQgetvalue(res, i, 1); - char *attnamecopy; - char *acltag; + char *attname = PQgetvalue(res, i, 0); + char *attacl = PQgetvalue(res, i, 1); + char *attnamecopy; + char *acltag; attnamecopy = strdup(fmtId(attname)); acltag = malloc(strlen(tbinfo->dobj.name) + strlen(attname) + 2); @@ -9865,9 +9871,9 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) } if ((tbinfo->reloptions && strlen(tbinfo->reloptions) > 0) || - (tbinfo->toast_reloptions && strlen(tbinfo->toast_reloptions) > 0)) + (tbinfo->toast_reloptions && strlen(tbinfo->toast_reloptions) > 0)) { - bool addcomma = false; + bool addcomma = false; appendPQExpBuffer(q, "\nWITH ("); if (tbinfo->reloptions && strlen(tbinfo->reloptions) > 0) @@ -9886,8 +9892,8 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) appendPQExpBuffer(q, ";\n"); /* - * For binary-compatible heap files, we create dropped columns - * above and drop them here. + * For binary-compatible heap files, we create dropped columns above + * and drop them here. */ if (binary_upgrade) { @@ -9901,46 +9907,46 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) fmtId(tbinfo->attnames[j])); /* - * ALTER TABLE DROP COLUMN clears pg_attribute.atttypid, - * so we have to set pg_attribute.attlen and - * pg_attribute.attalign values because that is what - * is used to skip over dropped columns in the heap tuples. - * We have atttypmod, but it seems impossible to know the - * correct data type that will yield pg_attribute values - * that match the old installation. - * See comment in backend/catalog/heap.c::RemoveAttributeById() + * ALTER TABLE DROP COLUMN clears pg_attribute.atttypid, + * so we have to set pg_attribute.attlen and + * pg_attribute.attalign values because that is what is + * used to skip over dropped columns in the heap tuples. + * We have atttypmod, but it seems impossible to know the + * correct data type that will yield pg_attribute values + * that match the old installation. See comment in + * backend/catalog/heap.c::RemoveAttributeById() */ appendPQExpBuffer(q, "\n-- For binary upgrade, recreate dropped column's length and alignment.\n"); appendPQExpBuffer(q, "UPDATE pg_attribute\n" - "SET attlen = %d, " - "attalign = '%c'\n" - "WHERE attname = '%s'\n" - " AND attrelid = \n" - " (\n" - " SELECT oid\n" - " FROM pg_class\n" - " WHERE relnamespace = " - "(SELECT oid FROM pg_namespace " - "WHERE nspname = CURRENT_SCHEMA)\n" - " AND relname = ", - tbinfo->attlen[j], - tbinfo->attalign[j], - tbinfo->attnames[j]); + "SET attlen = %d, " + "attalign = '%c'\n" + "WHERE attname = '%s'\n" + " AND attrelid = \n" + " (\n" + " SELECT oid\n" + " FROM pg_class\n" + " WHERE relnamespace = " + "(SELECT oid FROM pg_namespace " + "WHERE nspname = CURRENT_SCHEMA)\n" + " AND relname = ", + tbinfo->attlen[j], + tbinfo->attalign[j], + tbinfo->attnames[j]); appendStringLiteralAH(q, tbinfo->dobj.name, fout); appendPQExpBuffer(q, "\n );\n"); } } appendPQExpBuffer(q, "\n-- For binary upgrade, set relfrozenxid.\n"); appendPQExpBuffer(q, "UPDATE pg_class\n" - "SET relfrozenxid = '%u'\n" - "WHERE relname = ", - tbinfo->frozenxid); + "SET relfrozenxid = '%u'\n" + "WHERE relname = ", + tbinfo->frozenxid); appendStringLiteralAH(q, tbinfo->dobj.name, fout); appendPQExpBuffer(q, "\n AND relnamespace = " - "(SELECT oid FROM pg_namespace " - "WHERE nspname = CURRENT_SCHEMA);\n"); + "(SELECT oid FROM pg_namespace " + "WHERE nspname = CURRENT_SCHEMA);\n"); } - + /* Loop dumping statistics and storage statements */ for (j = 0; j < tbinfo->numatts; j++) { @@ -10522,36 +10528,36 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) if (g_fout->remoteVersion >= 80400) { appendPQExpBuffer(query, - "SELECT sequence_name, " - "start_value, last_value, increment_by, " - "CASE WHEN increment_by > 0 AND max_value = %s THEN NULL " - " WHEN increment_by < 0 AND max_value = -1 THEN NULL " - " ELSE max_value " - "END AS max_value, " - "CASE WHEN increment_by > 0 AND min_value = 1 THEN NULL " - " WHEN increment_by < 0 AND min_value = %s THEN NULL " - " ELSE min_value " - "END AS min_value, " - "cache_value, is_cycled, is_called from %s", - bufx, bufm, - fmtId(tbinfo->dobj.name)); + "SELECT sequence_name, " + "start_value, last_value, increment_by, " + "CASE WHEN increment_by > 0 AND max_value = %s THEN NULL " + " WHEN increment_by < 0 AND max_value = -1 THEN NULL " + " ELSE max_value " + "END AS max_value, " + "CASE WHEN increment_by > 0 AND min_value = 1 THEN NULL " + " WHEN increment_by < 0 AND min_value = %s THEN NULL " + " ELSE min_value " + "END AS min_value, " + "cache_value, is_cycled, is_called from %s", + bufx, bufm, + fmtId(tbinfo->dobj.name)); } else { appendPQExpBuffer(query, - "SELECT sequence_name, " - "0 AS start_value, last_value, increment_by, " - "CASE WHEN increment_by > 0 AND max_value = %s THEN NULL " - " WHEN increment_by < 0 AND max_value = -1 THEN NULL " - " ELSE max_value " - "END AS max_value, " - "CASE WHEN increment_by > 0 AND min_value = 1 THEN NULL " - " WHEN increment_by < 0 AND min_value = %s THEN NULL " - " ELSE min_value " - "END AS min_value, " - "cache_value, is_cycled, is_called from %s", - bufx, bufm, - fmtId(tbinfo->dobj.name)); + "SELECT sequence_name, " + "0 AS start_value, last_value, increment_by, " + "CASE WHEN increment_by > 0 AND max_value = %s THEN NULL " + " WHEN increment_by < 0 AND max_value = -1 THEN NULL " + " ELSE max_value " + "END AS max_value, " + "CASE WHEN increment_by > 0 AND min_value = 1 THEN NULL " + " WHEN increment_by < 0 AND min_value = %s THEN NULL " + " ELSE min_value " + "END AS min_value, " + "cache_value, is_cycled, is_called from %s", + bufx, bufm, + fmtId(tbinfo->dobj.name)); } res = PQexec(g_conn, query->data); @@ -10622,7 +10628,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) /* * Versions before 8.4 did not remember the true start value. If * is_called is false then the sequence has never been incremented - * so we can use last_val. Otherwise punt and let it default. + * so we can use last_val. Otherwise punt and let it default. */ if (!called) appendPQExpBuffer(query, " START WITH %s\n", last); @@ -11268,7 +11274,7 @@ getFormattedTypeName(Oid oid, OidOptions opts) if (ntups != 1) { write_msg(NULL, ngettext("query returned %d row instead of one: %s\n", - "query returned %d rows instead of one: %s\n", + "query returned %d rows instead of one: %s\n", ntups), ntups, query->data); exit_nicely(); diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h index 6c5e48f273..3339bf7562 100644 --- a/src/bin/pg_dump/pg_dump.h +++ b/src/bin/pg_dump/pg_dump.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.h,v 1.153 2009/02/24 10:06:34 petere Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.h,v 1.154 2009/06/11 14:49:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -221,7 +221,7 @@ typedef struct _tableInfo char relkind; char *reltablespace; /* relation tablespace */ char *reloptions; /* options specified by WITH (...) */ - char *toast_reloptions; /* ditto, for the TOAST table */ + char *toast_reloptions; /* ditto, for the TOAST table */ bool hasindex; /* does it have any indexes? */ bool hasrules; /* does it have any rules? */ bool hastriggers; /* does it have any triggers? */ @@ -267,7 +267,7 @@ typedef struct _tableInfo */ int numParents; /* number of (immediate) parent tables */ struct _tableInfo **parents; /* TableInfos of immediate parents */ - struct _tableDataInfo *dataObj; /* TableDataInfo, if dumping its data */ + struct _tableDataInfo *dataObj; /* TableDataInfo, if dumping its data */ } TableInfo; typedef struct _attrDefInfo diff --git a/src/bin/pg_dump/pg_dump_sort.c b/src/bin/pg_dump/pg_dump_sort.c index 76484dde3e..a56f429a7a 100644 --- a/src/bin/pg_dump/pg_dump_sort.c +++ b/src/bin/pg_dump/pg_dump_sort.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump_sort.c,v 1.24 2009/01/18 20:44:45 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump_sort.c,v 1.25 2009/06/11 14:49:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -955,7 +955,7 @@ repairDependencyLoop(DumpableObject **loop, /* * If all the objects are TABLE_DATA items, what we must have is a * circular set of foreign key constraints (or a single self-referential - * table). Print an appropriate complaint and break the loop arbitrarily. + * table). Print an appropriate complaint and break the loop arbitrarily. */ for (i = 0; i < nLoop; i++) { @@ -971,7 +971,7 @@ repairDependencyLoop(DumpableObject **loop, write_msg(NULL, "Consider using a full dump instead of a --data-only dump to avoid this problem.\n"); if (nLoop > 1) removeObjectDependency(loop[0], loop[1]->dumpId); - else /* must be a self-dependency */ + else /* must be a self-dependency */ removeObjectDependency(loop[0], loop[0]->dumpId); return; } @@ -991,7 +991,7 @@ repairDependencyLoop(DumpableObject **loop, if (nLoop > 1) removeObjectDependency(loop[0], loop[1]->dumpId); - else /* must be a self-dependency */ + else /* must be a self-dependency */ removeObjectDependency(loop[0], loop[0]->dumpId); } diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c index f1eebc6074..454b95c106 100644 --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.125 2009/05/10 02:51:44 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.126 2009/06/11 14:49:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -51,7 +51,7 @@ static void doShellQuoting(PQExpBuffer buf, const char *str); static int runPgDump(const char *dbname); static PGconn *connectDatabase(const char *dbname, const char *pghost, const char *pgport, - const char *pguser, enum trivalue prompt_password, bool fail_on_error); + const char *pguser, enum trivalue prompt_password, bool fail_on_error); static PGresult *executeQuery(PGconn *conn, const char *query); static void executeCommand(PGconn *conn, const char *query); @@ -279,7 +279,7 @@ main(int argc, char *argv[]) disable_dollar_quoting = 1; else if (strcmp(optarg, "disable-triggers") == 0) disable_triggers = 1; - else if (strcmp(optarg, "no-tablespaces") == 0) + else if (strcmp(optarg, "no-tablespaces") == 0) no_tablespaces = 1; else if (strcmp(optarg, "use-set-session-authorization") == 0) use_setsessauth = 1; @@ -455,9 +455,9 @@ main(int argc, char *argv[]) if (!data_only) { /* - * If asked to --clean, do that first. We can avoid detailed + * If asked to --clean, do that first. We can avoid detailed * dependency analysis because databases never depend on each other, - * and tablespaces never depend on each other. Roles could have + * and tablespaces never depend on each other. Roles could have * grants to each other, but DROP ROLE will clean those up silently. */ if (output_clean) @@ -476,8 +476,8 @@ main(int argc, char *argv[]) } /* - * Now create objects as requested. Be careful that option logic - * here is the same as for drops above. + * Now create objects as requested. Be careful that option logic here + * is the same as for drops above. */ if (!tablespaces_only) { @@ -550,8 +550,8 @@ help(void) printf(_(" --no-tablespaces do not dump tablespace assignments\n")); printf(_(" --role=ROLENAME do SET ROLE before dump\n")); printf(_(" --use-set-session-authorization\n" - " use SET SESSION AUTHORIZATION commands instead of\n" - " ALTER OWNER commands to set ownership\n")); + " use SET SESSION AUTHORIZATION commands instead of\n" + " ALTER OWNER commands to set ownership\n")); printf(_("\nConnection options:\n")); printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); @@ -562,7 +562,7 @@ help(void) printf(_(" -W, --password force password prompt (should happen automatically)\n")); printf(_("\nIf -f/--file is not used, then the SQL script will be written to the standard\n" - "output.\n\n")); + "output.\n\n")); printf(_("Report bugs to <pgsql-bugs@postgresql.org>.\n")); } @@ -707,10 +707,10 @@ dumpRoles(PGconn *conn) /* * We dump CREATE ROLE followed by ALTER ROLE to ensure that the role - * will acquire the right properties even if it already exists (ie, - * it won't hurt for the CREATE to fail). This is particularly - * important for the role we are connected as, since even with --clean - * we will have failed to drop it. + * will acquire the right properties even if it already exists (ie, it + * won't hurt for the CREATE to fail). This is particularly important + * for the role we are connected as, since even with --clean we will + * have failed to drop it. */ appendPQExpBuffer(buf, "CREATE ROLE %s;\n", fmtId(rolename)); appendPQExpBuffer(buf, "ALTER ROLE %s WITH", fmtId(rolename)); @@ -1090,11 +1090,11 @@ dumpCreateDB(PGconn *conn) * commands for just those databases with values different from defaults. * * We consider template0's encoding and locale (or, pre-7.1, template1's) - * to define the installation default. Pre-8.4 installations do not - * have per-database locale settings; for them, every database must - * necessarily be using the installation default, so there's no need to - * do anything (which is good, since in very old versions there is no - * good way to find out what the installation locale is anyway...) + * to define the installation default. Pre-8.4 installations do not have + * per-database locale settings; for them, every database must necessarily + * be using the installation default, so there's no need to do anything + * (which is good, since in very old versions there is no good way to find + * out what the installation locale is anyway...) */ if (server_version >= 80400) res = executeQuery(conn, @@ -1144,7 +1144,7 @@ dumpCreateDB(PGconn *conn) "SELECT datname, " "coalesce(rolname, (select rolname from pg_authid where oid=(select datdba from pg_database where datname='template0'))), " "pg_encoding_to_char(d.encoding), " - "null::text AS datcollate, null::text AS datctype, datfrozenxid, " + "null::text AS datcollate, null::text AS datctype, datfrozenxid, " "datistemplate, datacl, datconnlimit, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = d.dattablespace) AS dattablespace " "FROM pg_database d LEFT JOIN pg_authid u ON (datdba = u.oid) " @@ -1154,7 +1154,7 @@ dumpCreateDB(PGconn *conn) "SELECT datname, " "coalesce(usename, (select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), " "pg_encoding_to_char(d.encoding), " - "null::text AS datcollate, null::text AS datctype, datfrozenxid, " + "null::text AS datcollate, null::text AS datctype, datfrozenxid, " "datistemplate, datacl, -1 as datconnlimit, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = d.dattablespace) AS dattablespace " "FROM pg_database d LEFT JOIN pg_shadow u ON (datdba = usesysid) " @@ -1164,7 +1164,7 @@ dumpCreateDB(PGconn *conn) "SELECT datname, " "coalesce(usename, (select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), " "pg_encoding_to_char(d.encoding), " - "null::text AS datcollate, null::text AS datctype, datfrozenxid, " + "null::text AS datcollate, null::text AS datctype, datfrozenxid, " "datistemplate, datacl, -1 as datconnlimit, " "'pg_default' AS dattablespace " "FROM pg_database d LEFT JOIN pg_shadow u ON (datdba = usesysid) " @@ -1206,7 +1206,7 @@ dumpCreateDB(PGconn *conn) char *dbencoding = PQgetvalue(res, i, 2); char *dbcollate = PQgetvalue(res, i, 3); char *dbctype = PQgetvalue(res, i, 4); - uint32 dbfrozenxid = atooid(PQgetvalue(res, i, 5)); + uint32 dbfrozenxid = atooid(PQgetvalue(res, i, 5)); char *dbistemplate = PQgetvalue(res, i, 6); char *dbacl = PQgetvalue(res, i, 7); char *dbconnlimit = PQgetvalue(res, i, 8); @@ -1527,7 +1527,7 @@ runPgDump(const char *dbname) */ static PGconn * connectDatabase(const char *dbname, const char *pghost, const char *pgport, - const char *pguser, enum trivalue prompt_password, bool fail_on_error) + const char *pguser, enum trivalue prompt_password, bool fail_on_error) { PGconn *conn; bool new_pass; @@ -1605,8 +1605,8 @@ connectDatabase(const char *dbname, const char *pghost, const char *pgport, } /* - * We allow the server to be back to 7.0, and up to any minor release - * of our own major version. (See also version check in pg_dump.c.) + * We allow the server to be back to 7.0, and up to any minor release of + * our own major version. (See also version check in pg_dump.c.) */ if (my_version != server_version && (server_version < 70000 || @@ -1727,8 +1727,7 @@ doShellQuoting(PQExpBuffer buf, const char *str) appendPQExpBufferChar(buf, *p); } appendPQExpBufferChar(buf, '\''); - -#else /* WIN32 */ +#else /* WIN32 */ appendPQExpBufferChar(buf, '"'); for (p = str; *p; p++) @@ -1739,5 +1738,5 @@ doShellQuoting(PQExpBuffer buf, const char *str) appendPQExpBufferChar(buf, *p); } appendPQExpBufferChar(buf, '"'); -#endif /* WIN32 */ +#endif /* WIN32 */ } diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c index f7723dc72c..a07ecbd20b 100644 --- a/src/bin/pg_dump/pg_restore.c +++ b/src/bin/pg_dump/pg_restore.c @@ -34,7 +34,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.99 2009/04/14 00:06:35 alvherre Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.100 2009/06/11 14:49:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -74,7 +74,7 @@ main(int argc, char **argv) char *inputFileSpec; static int disable_triggers = 0; static int no_data_for_failed_tables = 0; - static int outputNoTablespaces = 0; + static int outputNoTablespaces = 0; static int use_setsessauth = 0; struct option cmdopts[] = { @@ -278,9 +278,10 @@ main(int argc, char **argv) break; case 0: - /* - * This covers the long options without a short equivalent, - * including those equivalent to -X xxx. + + /* + * This covers the long options without a short equivalent, + * including those equivalent to -X xxx. */ break; @@ -415,7 +416,7 @@ usage(const char *progname) printf(_(" -I, --index=NAME restore named index\n")); printf(_(" -j, --jobs=NUM use this many parallel jobs to restore\n")); printf(_(" -L, --use-list=FILENAME use table of contents from this file for\n" - " selecting/ordering output\n")); + " selecting/ordering output\n")); printf(_(" -n, --schema=NAME restore only objects in this schema\n")); printf(_(" -O, --no-owner skip restoration of object ownership\n")); printf(_(" -P, --function=NAME(args)\n" @@ -432,8 +433,8 @@ usage(const char *progname) printf(_(" --no-tablespaces do not dump tablespace assignments\n")); printf(_(" --role=ROLENAME do SET ROLE before restore\n")); printf(_(" --use-set-session-authorization\n" - " use SET SESSION AUTHORIZATION commands instead of\n" - " ALTER OWNER commands to set ownership\n")); + " use SET SESSION AUTHORIZATION commands instead of\n" + " ALTER OWNER commands to set ownership\n")); printf(_(" -1, --single-transaction\n" " restore as a single transaction\n")); diff --git a/src/bin/pg_resetxlog/pg_resetxlog.c b/src/bin/pg_resetxlog/pg_resetxlog.c index 57a264a2ac..076327f9b8 100644 --- a/src/bin/pg_resetxlog/pg_resetxlog.c +++ b/src/bin/pg_resetxlog/pg_resetxlog.c @@ -23,7 +23,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.73 2009/05/03 23:13:37 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.74 2009/06/11 14:49:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -31,7 +31,7 @@ /* * We have to use postgres.h not postgres_fe.h here, because there's so much * backend-only stuff in the XLOG include files we need. But we need a - * frontend-ish environment otherwise. Hence this ugly hack. + * frontend-ish environment otherwise. Hence this ugly hack. */ #define FRONTEND 1 @@ -823,7 +823,7 @@ KillExistingArchiveStatus(void) struct dirent *xlde; char path[MAXPGPATH]; -#define ARCHSTATDIR XLOGDIR "/archive_status" +#define ARCHSTATDIR XLOGDIR "/archive_status" xldir = opendir(ARCHSTATDIR); if (xldir == NULL) @@ -838,7 +838,7 @@ KillExistingArchiveStatus(void) { if (strspn(xlde->d_name, "0123456789ABCDEF") == 24 && (strcmp(xlde->d_name + 24, ".ready") == 0 || - strcmp(xlde->d_name + 24, ".done") == 0)) + strcmp(xlde->d_name + 24, ".done") == 0)) { snprintf(path, MAXPGPATH, "%s/%s", ARCHSTATDIR, xlde->d_name); if (unlink(path) < 0) diff --git a/src/bin/pgevent/pgevent.c b/src/bin/pgevent/pgevent.c index 6ad93e55fd..d1852187a6 100644 --- a/src/bin/pgevent/pgevent.c +++ b/src/bin/pgevent/pgevent.c @@ -6,7 +6,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pgevent/pgevent.c,v 1.5 2005/10/15 02:49:40 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/pgevent/pgevent.c,v 1.6 2009/06/11 14:49:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -72,7 +72,7 @@ DllRegisterServer(void) "TypesSupported", 0, REG_DWORD, - (LPBYTE) & data, + (LPBYTE) &data, sizeof(DWORD))) { MessageBox(NULL, "Could not set the supported types.", "PostgreSQL error", MB_OK | MB_ICONSTOP); diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index f27c0bc60b..7c815b8f97 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.205 2009/04/21 15:49:06 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.206 2009/06/11 14:49:07 momjian Exp $ */ #include "postgres_fe.h" #include "command.h" @@ -57,7 +57,7 @@ static backslashResult exec_command(const char *cmd, PsqlScanState scan_state, PQExpBuffer query_buf); static bool do_edit(const char *filename_arg, PQExpBuffer query_buf, - bool *edited); + bool *edited); static bool do_connect(char *dbname, char *user, char *host, char *port); static bool do_shell(const char *command); static bool lookup_function_oid(PGconn *conn, const char *desc, Oid *foid); @@ -327,7 +327,8 @@ exec_command(const char *cmd, else if (cmd[0] == 'd') { char *pattern; - bool show_verbose, show_system; + bool show_verbose, + show_system; /* We don't do SQLID reduction on the pattern yet */ pattern = psql_scan_slash_option(scan_state, @@ -375,7 +376,7 @@ exec_command(const char *cmd, case 'n': case 't': case 'w': - success = describeFunctions(&cmd[2], pattern, show_verbose, show_system); + success = describeFunctions(&cmd[2], pattern, show_verbose, show_system); break; default: status = PSQL_CMD_UNKNOWN; @@ -432,7 +433,7 @@ exec_command(const char *cmd, } break; case 'e': /* SQL/MED subsystem */ - switch(cmd[2]) + switch (cmd[2]) { case 's': success = listForeignServers(pattern, show_verbose); @@ -530,7 +531,7 @@ exec_command(const char *cmd, if (status != PSQL_CMD_ERROR) { - bool edited = false; + bool edited = false; if (!do_edit(0, query_buf, &edited)) status = PSQL_CMD_ERROR; @@ -989,7 +990,8 @@ exec_command(const char *cmd, else if (strcmp(cmd, "timing") == 0) { char *opt = psql_scan_slash_option(scan_state, - OT_NORMAL, NULL, false); + OT_NORMAL, NULL, false); + if (opt) pset.timing = ParseVariableBool(opt); else @@ -1292,7 +1294,7 @@ do_connect(char *dbname, char *user, char *host, char *port) PQsetNoticeProcessor(n_conn, NoticeProcessor, NULL); pset.db = n_conn; SyncVariables(); - connection_warnings(); /* Must be after SyncVariables */ + connection_warnings(); /* Must be after SyncVariables */ /* Tell the user about the new connection */ if (!pset.quiet) @@ -1341,17 +1343,17 @@ connection_warnings(void) server_version = server_ver_str; } - printf(_("%s (%s, server %s)\n"), - pset.progname, PG_VERSION, server_version); + printf(_("%s (%s, server %s)\n"), + pset.progname, PG_VERSION, server_version); } else printf("%s (%s)\n", pset.progname, PG_VERSION); if (pset.sversion / 100 != client_ver / 100) printf(_("WARNING: %s version %d.%d, server version %d.%d.\n" - " Some psql features might not work.\n"), - pset.progname, client_ver / 10000, (client_ver / 100) % 100, - pset.sversion / 10000, (pset.sversion / 100) % 100); + " Some psql features might not work.\n"), + pset.progname, client_ver / 10000, (client_ver / 100) % 100, + pset.sversion / 10000, (pset.sversion / 100) % 100); #ifdef WIN32 checkWin32Codepage(); @@ -1381,10 +1383,11 @@ printSSLInfo(void) printf(_("SSL connection (cipher: %s, bits: %i)\n"), SSL_get_cipher(ssl), sslbits); #else + /* - * If psql is compiled without SSL but is using a libpq with SSL, - * we cannot figure out the specifics about the connection. But - * we know it's SSL secured. + * If psql is compiled without SSL but is using a libpq with SSL, we + * cannot figure out the specifics about the connection. But we know it's + * SSL secured. */ if (PQgetssl(pset.db)) printf(_("SSL connection (unknown cipher)\n")); @@ -1410,7 +1413,7 @@ checkWin32Codepage(void) { printf(_("WARNING: Console code page (%u) differs from Windows code page (%u)\n" " 8-bit characters might not work correctly. See psql reference\n" - " page \"Notes for Windows users\" for details.\n"), + " page \"Notes for Windows users\" for details.\n"), concp, wincp); } } @@ -2028,7 +2031,7 @@ lookup_function_oid(PGconn *conn, const char *desc, Oid *foid) { bool result = true; PQExpBuffer query; - PGresult *res; + PGresult *res; query = createPQExpBuffer(); printfPQExpBuffer(query, "SELECT "); @@ -2060,7 +2063,7 @@ get_create_function_cmd(PGconn *conn, Oid oid, PQExpBuffer buf) { bool result = true; PQExpBuffer query; - PGresult *res; + PGresult *res; query = createPQExpBuffer(); printfPQExpBuffer(query, "SELECT pg_catalog.pg_get_functiondef(%u)", oid); diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 975e7b0fc1..eb4ca76c51 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -8,7 +8,7 @@ * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.215 2009/06/10 21:51:56 petere Exp $ + * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.216 2009/06/11 14:49:08 momjian Exp $ */ #include "postgres_fe.h" @@ -28,7 +28,7 @@ static bool describeOneTableDetails(const char *schemaname, const char *oid, bool verbose); static void add_tablespace_footer(printTableContent *const cont, char relkind, - Oid tablespace, const bool newline); + Oid tablespace, const bool newline); static void add_role_attribute(PQExpBuffer buf, const char *const str); static bool listTSParsersVerbose(const char *pattern); static bool describeOneTSParser(const char *oid, const char *nspname, @@ -64,28 +64,28 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem) printfPQExpBuffer(&buf, "SELECT n.nspname as \"%s\",\n" " p.proname AS \"%s\",\n" - " pg_catalog.format_type(p.prorettype, NULL) AS \"%s\",\n", + " pg_catalog.format_type(p.prorettype, NULL) AS \"%s\",\n", gettext_noop("Schema"), gettext_noop("Name"), gettext_noop("Result data type")); if (pset.sversion >= 80200) - appendPQExpBuffer(&buf, - " CASE WHEN p.pronargs = 0\n" - " THEN CAST('*' AS pg_catalog.text)\n" - " ELSE\n" - " pg_catalog.array_to_string(ARRAY(\n" - " SELECT\n" - " pg_catalog.format_type(p.proargtypes[s.i], NULL)\n" - " FROM\n" - " pg_catalog.generate_series(0, pg_catalog.array_upper(p.proargtypes, 1)) AS s(i)\n" - " ), ', ')\n" - " END AS \"%s\",\n", - gettext_noop("Argument data types")); + appendPQExpBuffer(&buf, + " CASE WHEN p.pronargs = 0\n" + " THEN CAST('*' AS pg_catalog.text)\n" + " ELSE\n" + " pg_catalog.array_to_string(ARRAY(\n" + " SELECT\n" + " pg_catalog.format_type(p.proargtypes[s.i], NULL)\n" + " FROM\n" + " pg_catalog.generate_series(0, pg_catalog.array_upper(p.proargtypes, 1)) AS s(i)\n" + " ), ', ')\n" + " END AS \"%s\",\n", + gettext_noop("Argument data types")); else - appendPQExpBuffer(&buf, - " pg_catalog.format_type(p.proargtypes[0], NULL) AS \"%s\",\n", - gettext_noop("Argument data types")); + appendPQExpBuffer(&buf, + " pg_catalog.format_type(p.proargtypes[0], NULL) AS \"%s\",\n", + gettext_noop("Argument data types")); appendPQExpBuffer(&buf, " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n" @@ -94,9 +94,9 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem) "WHERE p.proisagg\n", gettext_noop("Description")); - if (!showSystem && !pattern) - appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + if (!showSystem && !pattern) + appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" + " AND n.nspname <> 'information_schema'\n"); processSQLNamePattern(pset.db, &buf, pattern, true, false, "n.nspname", "p.proname", NULL, @@ -154,7 +154,7 @@ describeTablespaces(const char *pattern, bool verbose) if (verbose && pset.sversion >= 80200) appendPQExpBuffer(&buf, - ",\n pg_catalog.shobj_description(oid, 'pg_tablespace') AS \"%s\"", + ",\n pg_catalog.shobj_description(oid, 'pg_tablespace') AS \"%s\"", gettext_noop("Description")); appendPQExpBuffer(&buf, @@ -235,10 +235,10 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool gettext_noop("Schema"), gettext_noop("Name")); - if (pset.sversion >= 80400) + if (pset.sversion >= 80400) appendPQExpBuffer(&buf, - " pg_catalog.pg_get_function_result(p.oid) as \"%s\",\n" - " pg_catalog.pg_get_function_arguments(p.oid) as \"%s\",\n" + " pg_catalog.pg_get_function_result(p.oid) as \"%s\",\n" + " pg_catalog.pg_get_function_arguments(p.oid) as \"%s\",\n" " CASE\n" " WHEN p.proisagg THEN '%s'\n" " WHEN p.proiswindow THEN '%s'\n" @@ -246,71 +246,71 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool " ELSE '%s'\n" "END as \"%s\"", gettext_noop("Result data type"), - gettext_noop("Argument data types"), - /* translator: "agg" is short for "aggregate" */ - gettext_noop("agg"), - gettext_noop("window"), - gettext_noop("trigger"), - gettext_noop("normal"), - gettext_noop("Type")); - else if (pset.sversion >= 80100) + gettext_noop("Argument data types"), + /* translator: "agg" is short for "aggregate" */ + gettext_noop("agg"), + gettext_noop("window"), + gettext_noop("trigger"), + gettext_noop("normal"), + gettext_noop("Type")); + else if (pset.sversion >= 80100) appendPQExpBuffer(&buf, - " CASE WHEN p.proretset THEN 'SETOF ' ELSE '' END ||\n" + " CASE WHEN p.proretset THEN 'SETOF ' ELSE '' END ||\n" " pg_catalog.format_type(p.prorettype, NULL) as \"%s\",\n" - " CASE WHEN proallargtypes IS NOT NULL THEN\n" - " pg_catalog.array_to_string(ARRAY(\n" - " SELECT\n" - " CASE\n" - " WHEN p.proargmodes[s.i] = 'i' THEN ''\n" + " CASE WHEN proallargtypes IS NOT NULL THEN\n" + " pg_catalog.array_to_string(ARRAY(\n" + " SELECT\n" + " CASE\n" + " WHEN p.proargmodes[s.i] = 'i' THEN ''\n" " WHEN p.proargmodes[s.i] = 'o' THEN 'OUT '\n" - " WHEN p.proargmodes[s.i] = 'b' THEN 'INOUT '\n" - " WHEN p.proargmodes[s.i] = 'v' THEN 'VARIADIC '\n" - " END ||\n" - " CASE\n" + " WHEN p.proargmodes[s.i] = 'b' THEN 'INOUT '\n" + " WHEN p.proargmodes[s.i] = 'v' THEN 'VARIADIC '\n" + " END ||\n" + " CASE\n" " WHEN COALESCE(p.proargnames[s.i], '') = '' THEN ''\n" - " ELSE p.proargnames[s.i] || ' ' \n" - " END ||\n" + " ELSE p.proargnames[s.i] || ' ' \n" + " END ||\n" " pg_catalog.format_type(p.proallargtypes[s.i], NULL)\n" - " FROM\n" - " pg_catalog.generate_series(1, pg_catalog.array_upper(p.proallargtypes, 1)) AS s(i)\n" - " ), ', ')\n" - " ELSE\n" - " pg_catalog.array_to_string(ARRAY(\n" - " SELECT\n" - " CASE\n" + " FROM\n" + " pg_catalog.generate_series(1, pg_catalog.array_upper(p.proallargtypes, 1)) AS s(i)\n" + " ), ', ')\n" + " ELSE\n" + " pg_catalog.array_to_string(ARRAY(\n" + " SELECT\n" + " CASE\n" " WHEN COALESCE(p.proargnames[s.i+1], '') = '' THEN ''\n" - " ELSE p.proargnames[s.i+1] || ' '\n" - " END ||\n" + " ELSE p.proargnames[s.i+1] || ' '\n" + " END ||\n" " pg_catalog.format_type(p.proargtypes[s.i], NULL)\n" - " FROM\n" - " pg_catalog.generate_series(0, pg_catalog.array_upper(p.proargtypes, 1)) AS s(i)\n" - " ), ', ')\n" - " END AS \"%s\",\n" - " CASE\n" - " WHEN p.proisagg THEN '%s'\n" - " WHEN p.prorettype = 'pg_catalog.trigger'::pg_catalog.regtype THEN '%s'\n" - " ELSE '%s'\n" - " END AS \"%s\"", + " FROM\n" + " pg_catalog.generate_series(0, pg_catalog.array_upper(p.proargtypes, 1)) AS s(i)\n" + " ), ', ')\n" + " END AS \"%s\",\n" + " CASE\n" + " WHEN p.proisagg THEN '%s'\n" + " WHEN p.prorettype = 'pg_catalog.trigger'::pg_catalog.regtype THEN '%s'\n" + " ELSE '%s'\n" + " END AS \"%s\"", gettext_noop("Result data type"), gettext_noop("Argument data types"), - /* translator: "agg" is short for "aggregate" */ + /* translator: "agg" is short for "aggregate" */ gettext_noop("agg"), gettext_noop("trigger"), gettext_noop("normal"), gettext_noop("Type")); else appendPQExpBuffer(&buf, - " CASE WHEN p.proretset THEN 'SETOF ' ELSE '' END ||\n" + " CASE WHEN p.proretset THEN 'SETOF ' ELSE '' END ||\n" " pg_catalog.format_type(p.prorettype, NULL) as \"%s\",\n" - " pg_catalog.oidvectortypes(p.proargtypes) as \"%s\",\n" - " CASE\n" - " WHEN p.proisagg THEN '%s'\n" - " WHEN p.prorettype = 'pg_catalog.trigger'::pg_catalog.regtype THEN '%s'\n" - " ELSE '%s'\n" - " END AS \"%s\"", + " pg_catalog.oidvectortypes(p.proargtypes) as \"%s\",\n" + " CASE\n" + " WHEN p.proisagg THEN '%s'\n" + " WHEN p.prorettype = 'pg_catalog.trigger'::pg_catalog.regtype THEN '%s'\n" + " ELSE '%s'\n" + " END AS \"%s\"", gettext_noop("Result data type"), gettext_noop("Argument data types"), - /* translator: "agg" is short for "aggregate" */ + /* translator: "agg" is short for "aggregate" */ gettext_noop("agg"), gettext_noop("trigger"), gettext_noop("normal"), @@ -323,7 +323,7 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool " WHEN p.provolatile = 's' THEN '%s'\n" " WHEN p.provolatile = 'v' THEN '%s'\n" "END as \"%s\"" - ",\n pg_catalog.pg_get_userbyid(p.proowner) as \"%s\",\n" + ",\n pg_catalog.pg_get_userbyid(p.proowner) as \"%s\",\n" " l.lanname as \"%s\",\n" " p.prosrc as \"%s\",\n" " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"", @@ -338,17 +338,17 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool appendPQExpBuffer(&buf, "\nFROM pg_catalog.pg_proc p" - "\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"); + "\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"); if (verbose) appendPQExpBuffer(&buf, - " LEFT JOIN pg_catalog.pg_language l ON l.oid = p.prolang\n"); + " LEFT JOIN pg_catalog.pg_language l ON l.oid = p.prolang\n"); have_where = false; /* filter by function type, if requested */ if (showNormal && showAggregate && showTrigger && showWindow) - /* Do nothing */; + /* Do nothing */ ; else if (showNormal) { if (!showAggregate) @@ -387,14 +387,14 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool } else { - bool needs_or = false; + bool needs_or = false; appendPQExpBuffer(&buf, "WHERE (\n "); have_where = true; /* Note: at least one of these must be true ... */ if (showAggregate) { - appendPQExpBuffer(&buf,"p.proisagg\n"); + appendPQExpBuffer(&buf, "p.proisagg\n"); needs_or = true; } if (showTrigger) @@ -402,7 +402,7 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool if (needs_or) appendPQExpBuffer(&buf, " OR "); appendPQExpBuffer(&buf, - "p.prorettype = 'pg_catalog.trigger'::pg_catalog.regtype\n"); + "p.prorettype = 'pg_catalog.trigger'::pg_catalog.regtype\n"); needs_or = true; } if (showWindow) @@ -419,9 +419,9 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool "n.nspname", "p.proname", NULL, "pg_catalog.pg_function_is_visible(p.oid)"); - if (!showSystem && !pattern) - appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + if (!showSystem && !pattern) + appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" + " AND n.nspname <> 'information_schema'\n"); appendPQExpBuffer(&buf, "ORDER BY 1, 2, 4;"); @@ -486,7 +486,7 @@ describeTypes(const char *pattern, bool verbose, bool showSystem) gettext_noop("Elements")); appendPQExpBuffer(&buf, - " pg_catalog.obj_description(t.oid, 'pg_type') as \"%s\"\n", + " pg_catalog.obj_description(t.oid, 'pg_type') as \"%s\"\n", gettext_noop("Description")); appendPQExpBuffer(&buf, "FROM pg_catalog.pg_type t\n" @@ -499,6 +499,7 @@ describeTypes(const char *pattern, bool verbose, bool showSystem) appendPQExpBuffer(&buf, "WHERE (t.typrelid = 0 "); appendPQExpBuffer(&buf, "OR (SELECT c.relkind = 'c' FROM pg_catalog.pg_class c " "WHERE c.oid = t.typrelid))\n"); + /* * do not include array types (before 8.3 we have to use the assumption * that their names start with underscore) @@ -508,9 +509,9 @@ describeTypes(const char *pattern, bool verbose, bool showSystem) else appendPQExpBuffer(&buf, " AND t.typname !~ '^_'\n"); - if (!showSystem && !pattern) - appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + if (!showSystem && !pattern) + appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" + " AND n.nspname <> 'information_schema'\n"); /* Match name pattern against either internal or external name */ processSQLNamePattern(pset.db, &buf, pattern, true, false, @@ -564,9 +565,9 @@ describeOperators(const char *pattern, bool showSystem) gettext_noop("Result type"), gettext_noop("Description")); - if (!showSystem && !pattern) - appendPQExpBuffer(&buf, "WHERE n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + if (!showSystem && !pattern) + appendPQExpBuffer(&buf, "WHERE n.nspname <> 'pg_catalog'\n" + " AND n.nspname <> 'information_schema'\n"); processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, true, "n.nspname", "o.oprname", NULL, @@ -606,8 +607,8 @@ listAllDbs(bool verbose) printfPQExpBuffer(&buf, "SELECT d.datname as \"%s\",\n" - " pg_catalog.pg_get_userbyid(d.datdba) as \"%s\",\n" - " pg_catalog.pg_encoding_to_char(d.encoding) as \"%s\",\n", + " pg_catalog.pg_get_userbyid(d.datdba) as \"%s\",\n" + " pg_catalog.pg_encoding_to_char(d.encoding) as \"%s\",\n", gettext_noop("Name"), gettext_noop("Owner"), gettext_noop("Encoding")); @@ -631,7 +632,7 @@ listAllDbs(bool verbose) ",\n t.spcname as \"%s\"", gettext_noop("Tablespace")); if (verbose && pset.sversion >= 80200) - appendPQExpBuffer(&buf, + appendPQExpBuffer(&buf, ",\n pg_catalog.shobj_description(d.oid, 'pg_database') as \"%s\"", gettext_noop("Description")); appendPQExpBuffer(&buf, @@ -680,7 +681,7 @@ permissionsList(const char *pattern) " ", gettext_noop("Schema"), gettext_noop("Name"), - gettext_noop("table"), gettext_noop("view"), gettext_noop("sequence"), + gettext_noop("table"), gettext_noop("view"), gettext_noop("sequence"), gettext_noop("Type")); printACLColumn(&buf, "c.relacl"); @@ -769,9 +770,9 @@ objectDescription(const char *pattern, bool showSystem) " WHERE p.proisagg\n", gettext_noop("aggregate")); - if (!showSystem && !pattern) - appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + if (!showSystem && !pattern) + appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" + " AND n.nspname <> 'information_schema'\n"); processSQLNamePattern(pset.db, &buf, pattern, true, false, "n.nspname", "p.proname", NULL, @@ -789,9 +790,9 @@ objectDescription(const char *pattern, bool showSystem) " WHERE NOT p.proisagg\n", gettext_noop("function")); - if (!showSystem && !pattern) - appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + if (!showSystem && !pattern) + appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" + " AND n.nspname <> 'information_schema'\n"); processSQLNamePattern(pset.db, &buf, pattern, true, false, "n.nspname", "p.proname", NULL, @@ -808,10 +809,10 @@ objectDescription(const char *pattern, bool showSystem) " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = o.oprnamespace\n", gettext_noop("operator")); - if (!showSystem && !pattern) - appendPQExpBuffer(&buf, "WHERE n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); - + if (!showSystem && !pattern) + appendPQExpBuffer(&buf, "WHERE n.nspname <> 'pg_catalog'\n" + " AND n.nspname <> 'information_schema'\n"); + processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, false, "n.nspname", "o.oprname", NULL, "pg_catalog.pg_operator_is_visible(o.oid)"); @@ -827,9 +828,9 @@ objectDescription(const char *pattern, bool showSystem) " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n", gettext_noop("data type")); - if (!showSystem && !pattern) - appendPQExpBuffer(&buf, "WHERE n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + if (!showSystem && !pattern) + appendPQExpBuffer(&buf, "WHERE n.nspname <> 'pg_catalog'\n" + " AND n.nspname <> 'information_schema'\n"); processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, false, "n.nspname", "pg_catalog.format_type(t.oid, NULL)", @@ -853,9 +854,9 @@ objectDescription(const char *pattern, bool showSystem) gettext_noop("index"), gettext_noop("sequence")); - if (!showSystem && !pattern) - appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + if (!showSystem && !pattern) + appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" + " AND n.nspname <> 'information_schema'\n"); processSQLNamePattern(pset.db, &buf, pattern, true, false, "n.nspname", "c.relname", NULL, @@ -874,9 +875,9 @@ objectDescription(const char *pattern, bool showSystem) " WHERE r.rulename != '_RETURN'\n", gettext_noop("rule")); - if (!showSystem && !pattern) - appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + if (!showSystem && !pattern) + appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" + " AND n.nspname <> 'information_schema'\n"); /* XXX not sure what to do about visibility rule here? */ processSQLNamePattern(pset.db, &buf, pattern, true, false, @@ -895,9 +896,9 @@ objectDescription(const char *pattern, bool showSystem) " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n", gettext_noop("trigger")); - if (!showSystem && !pattern) - appendPQExpBuffer(&buf, "WHERE n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + if (!showSystem && !pattern) + appendPQExpBuffer(&buf, "WHERE n.nspname <> 'pg_catalog'\n" + " AND n.nspname <> 'information_schema'\n"); /* XXX not sure what to do about visibility rule here? */ processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, false, @@ -951,9 +952,9 @@ describeTableDetails(const char *pattern, bool verbose, bool showSystem) "FROM pg_catalog.pg_class c\n" " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n"); - if (!showSystem && !pattern) - appendPQExpBuffer(&buf, "WHERE n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + if (!showSystem && !pattern) + appendPQExpBuffer(&buf, "WHERE n.nspname <> 'pg_catalog'\n" + " AND n.nspname <> 'information_schema'\n"); processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, false, "n.nspname", "c.relname", NULL, @@ -1018,7 +1019,7 @@ describeOneTableDetails(const char *schemaname, PGresult *res = NULL; printTableOpt myopt = pset.popt.topt; printTableContent cont; - bool printTableInitialized = false; + bool printTableInitialized = false; int i; char *view_def = NULL; char *headers[6]; @@ -1056,33 +1057,33 @@ describeOneTableDetails(const char *schemaname, if (pset.sversion >= 80400) { printfPQExpBuffer(&buf, - "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, " + "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, " "c.relhastriggers, c.relhasoids, " "%s, c.reltablespace\n" "FROM pg_catalog.pg_class c\n " - "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n" + "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n" "WHERE c.oid = '%s'\n", (verbose ? - "pg_catalog.array_to_string(c.reloptions || " - "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n" - : "''"), + "pg_catalog.array_to_string(c.reloptions || " + "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n" + : "''"), oid); } else if (pset.sversion >= 80200) { printfPQExpBuffer(&buf, - "SELECT relchecks, relkind, relhasindex, relhasrules, " + "SELECT relchecks, relkind, relhasindex, relhasrules, " "reltriggers <> 0, relhasoids, " "%s, reltablespace\n" "FROM pg_catalog.pg_class WHERE oid = '%s'", (verbose ? - "pg_catalog.array_to_string(reloptions, E', ')" : "''"), + "pg_catalog.array_to_string(reloptions, E', ')" : "''"), oid); } else if (pset.sversion >= 80000) { printfPQExpBuffer(&buf, - "SELECT relchecks, relkind, relhasindex, relhasrules, " + "SELECT relchecks, relkind, relhasindex, relhasrules, " "reltriggers <> 0, relhasoids, " "'', reltablespace\n" "FROM pg_catalog.pg_class WHERE oid = '%s'", @@ -1091,7 +1092,7 @@ describeOneTableDetails(const char *schemaname, else { printfPQExpBuffer(&buf, - "SELECT relchecks, relkind, relhasindex, relhasrules, " + "SELECT relchecks, relkind, relhasindex, relhasrules, " "reltriggers <> 0, relhasoids, " "'', ''\n" "FROM pg_catalog.pg_class WHERE oid = '%s'", @@ -1118,20 +1119,20 @@ describeOneTableDetails(const char *schemaname, tableinfo.hastriggers = strcmp(PQgetvalue(res, 0, 4), "t") == 0; tableinfo.hasoids = strcmp(PQgetvalue(res, 0, 5), "t") == 0; tableinfo.reloptions = pset.sversion >= 80200 ? - strdup(PQgetvalue(res, 0, 6)) : 0; + strdup(PQgetvalue(res, 0, 6)) : 0; tableinfo.tablespace = (pset.sversion >= 80000) ? - atooid(PQgetvalue(res, 0, 7)) : 0; + atooid(PQgetvalue(res, 0, 7)) : 0; PQclear(res); res = NULL; - + /* - * If it's a sequence, fetch its values and store into an - * array that will be used later. + * If it's a sequence, fetch its values and store into an array that will + * be used later. */ if (tableinfo.relkind == 'S') { PGresult *result; - + #define SEQ_NUM_COLS 10 printfPQExpBuffer(&buf, "SELECT sequence_name, last_value,\n" @@ -1142,16 +1143,16 @@ describeOneTableDetails(const char *schemaname, fmtId(schemaname)); /* must be separate because fmtId isn't reentrant */ appendPQExpBuffer(&buf, ".%s", fmtId(relationname)); - + result = PSQLexec(buf.data, false); if (!result) goto error_return; - - seq_values = pg_malloc_zero((SEQ_NUM_COLS+1) * sizeof(*seq_values)); - - for (i = 0; i < SEQ_NUM_COLS; i++) + + seq_values = pg_malloc_zero((SEQ_NUM_COLS + 1) * sizeof(*seq_values)); + + for (i = 0; i < SEQ_NUM_COLS; i++) seq_values[i] = pg_strdup(PQgetvalue(result, 0, i)); - + PQclear(result); } @@ -1230,13 +1231,13 @@ describeOneTableDetails(const char *schemaname, if (tableinfo.relkind == 'S') headers[cols++] = gettext_noop("Value"); - + if (verbose) { headers[cols++] = gettext_noop("Storage"); headers[cols++] = gettext_noop("Description"); } - + printTableInit(&cont, &myopt, title.data, cols, numrows); printTableInitialized = true; @@ -1249,7 +1250,7 @@ describeOneTableDetails(const char *schemaname, PGresult *result; printfPQExpBuffer(&buf, - "SELECT pg_catalog.pg_get_viewdef('%s'::pg_catalog.oid, true)", + "SELECT pg_catalog.pg_get_viewdef('%s'::pg_catalog.oid, true)", oid); result = PSQLexec(buf.data, false); if (!result) @@ -1299,13 +1300,13 @@ describeOneTableDetails(const char *schemaname, /* Storage and Description */ if (verbose) { - char *storage = PQgetvalue(res, i, 5); + char *storage = PQgetvalue(res, i, 5); /* these strings are literal in our syntax, so not translated. */ - printTableAddCell(&cont, (storage[0]=='p' ? "plain" : - (storage[0]=='m' ? "main" : - (storage[0]=='x' ? "extended" : - (storage[0]=='e' ? "external" : + printTableAddCell(&cont, (storage[0] == 'p' ? "plain" : + (storage[0] == 'm' ? "main" : + (storage[0] == 'x' ? "extended" : + (storage[0] == 'e' ? "external" : "???")))), false); printTableAddCell(&cont, PQgetvalue(res, i, 6), false); @@ -1319,7 +1320,7 @@ describeOneTableDetails(const char *schemaname, PGresult *result; printfPQExpBuffer(&buf, - "SELECT i.indisunique, i.indisprimary, i.indisclustered, "); + "SELECT i.indisunique, i.indisprimary, i.indisclustered, "); if (pset.sversion >= 80200) appendPQExpBuffer(&buf, "i.indisvalid, "); else @@ -1426,12 +1427,12 @@ describeOneTableDetails(const char *schemaname, { printfPQExpBuffer(&buf, "SELECT c2.relname, i.indisprimary, i.indisunique, i.indisclustered, "); - if (pset.sversion >= 80200) + if (pset.sversion >= 80200) appendPQExpBuffer(&buf, "i.indisvalid, "); - else + else appendPQExpBuffer(&buf, "true as indisvalid, "); appendPQExpBuffer(&buf, "pg_catalog.pg_get_indexdef(i.indexrelid, 0, true)"); - if (pset.sversion >= 80000) + if (pset.sversion >= 80000) appendPQExpBuffer(&buf, ", c2.reltablespace"); appendPQExpBuffer(&buf, "\nFROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i\n" @@ -1458,11 +1459,11 @@ describeOneTableDetails(const char *schemaname, /* Label as primary key or unique (but not both) */ appendPQExpBuffer(&buf, - strcmp(PQgetvalue(result, i, 1), "t") == 0 + strcmp(PQgetvalue(result, i, 1), "t") == 0 ? " PRIMARY KEY," : - (strcmp(PQgetvalue(result, i, 2), "t") == 0 - ? " UNIQUE," - : "")); + (strcmp(PQgetvalue(result, i, 2), "t") == 0 + ? " UNIQUE," + : "")); /* Everything after "USING" is echoed verbatim */ indexdef = PQgetvalue(result, i, 5); usingpos = strstr(indexdef, " USING "); @@ -1481,8 +1482,8 @@ describeOneTableDetails(const char *schemaname, /* Print tablespace of the index on the same line */ if (pset.sversion >= 80000) - add_tablespace_footer(&cont, 'i', - atooid(PQgetvalue(result, i, 6)), + add_tablespace_footer(&cont, 'i', + atooid(PQgetvalue(result, i, 6)), false); } } @@ -1496,7 +1497,7 @@ describeOneTableDetails(const char *schemaname, "SELECT r.conname, " "pg_catalog.pg_get_constraintdef(r.oid, true)\n" "FROM pg_catalog.pg_constraint r\n" - "WHERE r.conrelid = '%s' AND r.contype = 'c'\nORDER BY 1", + "WHERE r.conrelid = '%s' AND r.contype = 'c'\nORDER BY 1", oid); result = PSQLexec(buf.data, false); if (!result) @@ -1525,7 +1526,7 @@ describeOneTableDetails(const char *schemaname, { printfPQExpBuffer(&buf, "SELECT conname,\n" - " pg_catalog.pg_get_constraintdef(r.oid, true) as condef\n" + " pg_catalog.pg_get_constraintdef(r.oid, true) as condef\n" "FROM pg_catalog.pg_constraint r\n" "WHERE r.conrelid = '%s' AND r.contype = 'f' ORDER BY 1", oid); @@ -1555,10 +1556,10 @@ describeOneTableDetails(const char *schemaname, if (tableinfo.hastriggers) { printfPQExpBuffer(&buf, - "SELECT conname, conrelid::pg_catalog.regclass,\n" - " pg_catalog.pg_get_constraintdef(c.oid, true) as condef\n" + "SELECT conname, conrelid::pg_catalog.regclass,\n" + " pg_catalog.pg_get_constraintdef(c.oid, true) as condef\n" "FROM pg_catalog.pg_constraint c\n" - "WHERE c.confrelid = '%s' AND c.contype = 'f' ORDER BY 1", + "WHERE c.confrelid = '%s' AND c.contype = 'f' ORDER BY 1", oid); result = PSQLexec(buf.data, false); if (!result) @@ -1571,8 +1572,10 @@ describeOneTableDetails(const char *schemaname, printTableAddFooter(&cont, _("Referenced by:")); for (i = 0; i < tuples; i++) { - /* translator: the first %s is a FK name, the following are - * a table name and the FK definition */ + /* + * translator: the first %s is a FK name, the following + * are a table name and the FK definition + */ printfPQExpBuffer(&buf, _(" \"%s\" IN %s %s"), PQgetvalue(result, i, 0), PQgetvalue(result, i, 1), @@ -1712,9 +1715,9 @@ describeOneTableDetails(const char *schemaname, int category; /* - * split the output into 4 different categories. Enabled triggers, - * disabled triggers and the two special ALWAYS and REPLICA - * configurations. + * split the output into 4 different categories. Enabled + * triggers, disabled triggers and the two special ALWAYS and + * REPLICA configurations. */ for (category = 0; category < 4; category++) { @@ -1726,7 +1729,10 @@ describeOneTableDetails(const char *schemaname, const char *usingpos; const char *tgenabled; - /* Check if this trigger falls into the current category */ + /* + * Check if this trigger falls into the current + * category + */ tgenabled = PQgetvalue(result, i, 2); list_trigger = false; switch (category) @@ -1851,14 +1857,14 @@ error_return: termPQExpBuffer(&buf); termPQExpBuffer(&title); termPQExpBuffer(&tmpbuf); - + if (seq_values) { for (ptr = seq_values; *ptr; ptr++) free(*ptr); free(seq_values); } - + if (modifiers) { for (ptr = modifiers; *ptr; ptr++) @@ -1918,8 +1924,11 @@ add_tablespace_footer(printTableContent *const cont, char relkind, { /* Append the tablespace to the latest footer */ printfPQExpBuffer(&buf, "%s", cont->footer->data); - /* translator: before this string there's an index - * description like '"foo_pkey" PRIMARY KEY, btree (a)' */ + + /* + * translator: before this string there's an index + * description like '"foo_pkey" PRIMARY KEY, btree (a)' + */ appendPQExpBuffer(&buf, _(", tablespace \"%s\""), PQgetvalue(result, 0, 0)); printTableSetFooter(cont, buf.data); @@ -1955,13 +1964,13 @@ describeRoles(const char *pattern, bool verbose) if (pset.sversion >= 80100) { printfPQExpBuffer(&buf, - "SELECT r.rolname, r.rolsuper, r.rolinherit,\n" - " r.rolcreaterole, r.rolcreatedb, r.rolcanlogin,\n" - " r.rolconnlimit,\n" - " ARRAY(SELECT b.rolname\n" - " FROM pg_catalog.pg_auth_members m\n" - " JOIN pg_catalog.pg_roles b ON (m.roleid = b.oid)\n" - " WHERE m.member = r.oid) as memberof"); + "SELECT r.rolname, r.rolsuper, r.rolinherit,\n" + " r.rolcreaterole, r.rolcreatedb, r.rolcanlogin,\n" + " r.rolconnlimit,\n" + " ARRAY(SELECT b.rolname\n" + " FROM pg_catalog.pg_auth_members m\n" + " JOIN pg_catalog.pg_roles b ON (m.roleid = b.oid)\n" + " WHERE m.member = r.oid) as memberof"); if (verbose && pset.sversion >= 80200) { @@ -1973,21 +1982,21 @@ describeRoles(const char *pattern, bool verbose) processSQLNamePattern(pset.db, &buf, pattern, false, false, NULL, "r.rolname", NULL, NULL); - } - else - { - printfPQExpBuffer(&buf, - "SELECT u.usename AS rolname,\n" - " u.usesuper AS rolsuper,\n" - " true AS rolinherit, false AS rolcreaterole,\n" - " u.usecreatedb AS rolcreatedb, true AS rolcanlogin,\n" - " -1 AS rolconnlimit,\n" - " ARRAY(SELECT g.groname FROM pg_catalog.pg_group g WHERE u.usesysid = ANY(g.grolist)) as memberof" - "\nFROM pg_catalog.pg_user u\n"); + } + else + { + printfPQExpBuffer(&buf, + "SELECT u.usename AS rolname,\n" + " u.usesuper AS rolsuper,\n" + " true AS rolinherit, false AS rolcreaterole,\n" + " u.usecreatedb AS rolcreatedb, true AS rolcanlogin,\n" + " -1 AS rolconnlimit,\n" + " ARRAY(SELECT g.groname FROM pg_catalog.pg_group g WHERE u.usesysid = ANY(g.grolist)) as memberof" + "\nFROM pg_catalog.pg_user u\n"); processSQLNamePattern(pset.db, &buf, pattern, false, false, NULL, "u.usename", NULL, NULL); - } + } appendPQExpBuffer(&buf, "ORDER BY 1;"); @@ -2156,13 +2165,14 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys if (showSeq) appendPQExpBuffer(&buf, "'S',"); if (showSystem || pattern) - appendPQExpBuffer(&buf, "'s',"); /* was RELKIND_SPECIAL in <= 8.1 */ + appendPQExpBuffer(&buf, "'s',"); /* was RELKIND_SPECIAL in <= + * 8.1 */ appendPQExpBuffer(&buf, "''"); /* dummy */ appendPQExpBuffer(&buf, ")\n"); - if (!showSystem && !pattern) - appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + if (!showSystem && !pattern) + appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" + " AND n.nspname <> 'information_schema'\n"); /* * TOAST objects are suppressed unconditionally. Since we don't provide @@ -2240,9 +2250,9 @@ listDomains(const char *pattern, bool showSystem) gettext_noop("Modifier"), gettext_noop("Check")); - if (!showSystem && !pattern) - appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + if (!showSystem && !pattern) + appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" + " AND n.nspname <> 'information_schema'\n"); processSQLNamePattern(pset.db, &buf, pattern, true, false, "n.nspname", "t.typname", NULL, @@ -2296,9 +2306,9 @@ listConversions(const char *pattern, bool showSystem) gettext_noop("yes"), gettext_noop("no"), gettext_noop("Default?")); - if (!showSystem && !pattern) - appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + if (!showSystem && !pattern) + appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n" + " AND n.nspname <> 'information_schema'\n"); processSQLNamePattern(pset.db, &buf, pattern, true, false, "n.nspname", "c.conname", NULL, @@ -2336,6 +2346,7 @@ listCasts(const char *pattern) static const bool translate_columns[] = {false, false, false, true}; initPQExpBuffer(&buf); + /* * We need a left join to pg_proc for binary casts; the others are just * paranoia. Also note that we don't attempt to localize '(binary @@ -2345,7 +2356,7 @@ listCasts(const char *pattern) printfPQExpBuffer(&buf, "SELECT pg_catalog.format_type(castsource, NULL) AS \"%s\",\n" " pg_catalog.format_type(casttarget, NULL) AS \"%s\",\n" - " CASE WHEN castfunc = 0 THEN '(binary coercible)'\n" + " CASE WHEN castfunc = 0 THEN '(binary coercible)'\n" " ELSE p.proname\n" " END as \"%s\",\n" " CASE WHEN c.castcontext = 'e' THEN '%s'\n" @@ -2366,7 +2377,7 @@ listCasts(const char *pattern) gettext_noop("Source type"), gettext_noop("Target type"), gettext_noop("Function"), - gettext_noop("no"), gettext_noop("in assignment"), gettext_noop("yes"), + gettext_noop("no"), gettext_noop("in assignment"), gettext_noop("yes"), gettext_noop("Implicit?")); /* @@ -2427,12 +2438,12 @@ listSchemas(const char *pattern, bool verbose) appendPQExpBuffer(&buf, ",\n "); printACLColumn(&buf, "n.nspacl"); appendPQExpBuffer(&buf, - ",\n pg_catalog.obj_description(n.oid, 'pg_namespace') AS \"%s\"", + ",\n pg_catalog.obj_description(n.oid, 'pg_namespace') AS \"%s\"", gettext_noop("Description")); } appendPQExpBuffer(&buf, - "\nFROM pg_catalog.pg_namespace n\n" + "\nFROM pg_catalog.pg_namespace n\n" "WHERE (n.nspname !~ '^pg_temp_' OR\n" " n.nspname = (pg_catalog.current_schemas(true))[1])\n"); /* temp schema is first */ @@ -3126,8 +3137,8 @@ listForeignServers(const char *pattern, bool verbose) } appendPQExpBuffer(&buf, - "\nFROM pg_catalog.pg_foreign_server s\n" - " JOIN pg_catalog.pg_foreign_data_wrapper f ON f.oid=s.srvfdw\n"); + "\nFROM pg_catalog.pg_foreign_server s\n" + " JOIN pg_catalog.pg_foreign_data_wrapper f ON f.oid=s.srvfdw\n"); processSQLNamePattern(pset.db, &buf, pattern, false, false, NULL, "s.srvname", NULL, NULL); @@ -3206,7 +3217,7 @@ listUserMappings(const char *pattern, bool verbose) * printACLColumn * * Helper function for consistently formatting ACL (privilege) columns. - * The proper targetlist entry is appended to buf. Note lack of any + * The proper targetlist entry is appended to buf. Note lack of any * whitespace or comma decoration. */ static void diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c index 8ccf382b41..b04db7582e 100644 --- a/src/bin/psql/help.c +++ b/src/bin/psql/help.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.149 2009/04/22 14:58:48 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.150 2009/06/11 14:49:08 momjian Exp $ */ #include "postgres_fe.h" @@ -118,12 +118,12 @@ usage(void) printf(_("\nOutput format options:\n")); printf(_(" -A, --no-align unaligned table output mode\n")); printf(_(" -F, --field-separator=STRING\n" - " set field separator (default: \"%s\")\n"), + " set field separator (default: \"%s\")\n"), DEFAULT_FIELD_SEP); printf(_(" -H, --html HTML table output mode\n")); printf(_(" -P, --pset=VAR[=ARG] set printing option VAR to ARG (see \\pset command)\n")); printf(_(" -R, --record-separator=STRING\n" - " set record separator (default: newline)\n")); + " set record separator (default: newline)\n")); printf(_(" -t, --tuples-only print rows only\n")); printf(_(" -T, --table-attr=TEXT set HTML table tag attributes (e.g., width, border)\n")); printf(_(" -x, --expanded turn on expanded table output\n")); @@ -243,7 +243,7 @@ slashUsage(unsigned short int pager) fprintf(output, _("Connection\n")); fprintf(output, _(" \\c[onnect] [DBNAME|- USER|- HOST|- PORT|-]\n" - " connect to new database (currently \"%s\")\n"), + " connect to new database (currently \"%s\")\n"), PQdb(pset.db)); fprintf(output, _(" \\encoding [ENCODING] show or set client encoding\n")); fprintf(output, _(" \\password [USERNAME] securely change the password for a user\n")); @@ -320,7 +320,7 @@ helpSQL(const char *topic, unsigned short int pager) for (i = 0; i < nrows; i++) { fprintf(output, " "); - for (j = 0; j < ncolumns-1; j++) + for (j = 0; j < ncolumns - 1; j++) fprintf(output, "%-*s", QL_MAX_CMD_LEN + 1, VALUE_OR_NULL(QL_HELP[i + j * nrows].cmd)); diff --git a/src/bin/psql/mainloop.c b/src/bin/psql/mainloop.c index fdf81c54cc..c63219bd13 100644 --- a/src/bin/psql/mainloop.c +++ b/src/bin/psql/mainloop.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/mainloop.c,v 1.94 2009/01/01 17:23:55 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/mainloop.c,v 1.95 2009/06/11 14:49:08 momjian Exp $ */ #include "postgres_fe.h" #include "mainloop.h" @@ -26,9 +26,10 @@ int MainLoop(FILE *source) { PsqlScanState scan_state; /* lexer working state */ - volatile PQExpBuffer query_buf; /* buffer for query being accumulated */ + volatile PQExpBuffer query_buf; /* buffer for query being accumulated */ volatile PQExpBuffer previous_buf; /* if there isn't anything in the new - * buffer yet, use this one for \e, etc. */ + * buffer yet, use this one for \e, + * etc. */ PQExpBuffer history_buf; /* earlier lines of a multi-line command, not * yet saved to readline history */ char *line; /* current line of input */ @@ -183,7 +184,7 @@ MainLoop(FILE *source) printf(_("Type: \\copyright for distribution terms\n" " \\h for help with SQL commands\n" " \\? for help with psql commands\n" - " \\g or terminate with semicolon to execute query\n" + " \\g or terminate with semicolon to execute query\n" " \\q to quit\n")); fflush(stdout); diff --git a/src/bin/psql/mbprint.c b/src/bin/psql/mbprint.c index 395994f6ad..4c33688e09 100644 --- a/src/bin/psql/mbprint.c +++ b/src/bin/psql/mbprint.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/mbprint.c,v 1.34 2009/01/01 17:23:55 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/mbprint.c,v 1.35 2009/06/11 14:49:08 momjian Exp $ * * XXX this file does not really belong in psql/. Perhaps move to libpq? * It also seems that the mbvalidate function is redundant with existing @@ -277,7 +277,7 @@ pg_wcssize(unsigned char *pwcs, size_t len, int encoding, } if (linewidth > width) width = linewidth; - format_size += 1; /* For NUL char */ + format_size += 1; /* For NUL char */ /* Set results */ if (result_width) @@ -289,14 +289,14 @@ pg_wcssize(unsigned char *pwcs, size_t len, int encoding, } /* - * Format a string into one or more "struct lineptr" lines. - * lines[i].ptr == NULL indicates the end of the array. + * Format a string into one or more "struct lineptr" lines. + * lines[i].ptr == NULL indicates the end of the array. * * This MUST be kept in sync with pg_wcssize! */ void pg_wcsformat(unsigned char *pwcs, size_t len, int encoding, - struct lineptr *lines, int count) + struct lineptr * lines, int count) { int w, chlen = 0; @@ -378,12 +378,12 @@ pg_wcsformat(unsigned char *pwcs, size_t len, int encoding, len -= chlen; } lines->width = linewidth; - *ptr++ = '\0'; /* Terminate formatted string */ + *ptr++ = '\0'; /* Terminate formatted string */ if (count <= 0) - exit(1); /* Screwup */ + exit(1); /* Screwup */ - (lines+1)->ptr = NULL; /* terminate line array */ + (lines + 1)->ptr = NULL; /* terminate line array */ } unsigned char * diff --git a/src/bin/psql/mbprint.h b/src/bin/psql/mbprint.h index 94f358e431..5ab1cbf045 100644 --- a/src/bin/psql/mbprint.h +++ b/src/bin/psql/mbprint.h @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/bin/psql/mbprint.h,v 1.12 2008/05/09 05:25:04 tgl Exp $ */ +/* $PostgreSQL: pgsql/src/bin/psql/mbprint.h,v 1.13 2009/06/11 14:49:08 momjian Exp $ */ #ifndef MBPRINT_H #define MBPRINT_H @@ -14,6 +14,6 @@ extern unsigned char *mbvalidate(unsigned char *pwcs, int encoding); extern int pg_wcswidth(const unsigned char *pwcs, size_t len, int encoding); extern void pg_wcsformat(unsigned char *pwcs, size_t len, int encoding, struct lineptr * lines, int count); extern void pg_wcssize(unsigned char *pwcs, size_t len, int encoding, - int *width, int *height, int *format_size); + int *width, int *height, int *format_size); #endif /* MBPRINT_H */ diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c index 3a6f5372ac..397aae881a 100644 --- a/src/bin/psql/print.c +++ b/src/bin/psql/print.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.114 2009/06/04 19:17:39 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.115 2009/06/11 14:49:08 momjian Exp $ */ #include "postgres_fe.h" @@ -45,9 +45,9 @@ static char *grouping; static char *thousands_sep; /* Local functions */ -static int strlen_max_width(unsigned char *str, int *target_width, int encoding); +static int strlen_max_width(unsigned char *str, int *target_width, int encoding); static void IsPagerNeeded(const printTableContent *cont, const int extra_lines, - FILE **fout, bool *is_pager); + FILE **fout, bool *is_pager); static void * @@ -404,7 +404,8 @@ print_aligned_text(const printTableContent *cont, FILE *fout) int encoding = cont->opt->encoding; unsigned short opt_border = cont->opt->border; - unsigned int col_count = 0, cell_count = 0; + unsigned int col_count = 0, + cell_count = 0; unsigned int i, j; @@ -413,22 +414,22 @@ print_aligned_text(const printTableContent *cont, FILE *fout) *max_width, *width_wrap, *width_average; - unsigned int *max_nl_lines, /* value split by newlines */ - *curr_nl_line, - *max_bytes; + unsigned int *max_nl_lines, /* value split by newlines */ + *curr_nl_line, + *max_bytes; unsigned char **format_buf; unsigned int width_total; unsigned int total_header_width; unsigned int extra_row_output_lines = 0; unsigned int extra_output_lines = 0; - const char * const *ptr; + const char *const * ptr; struct lineptr **col_lineptrs; /* pointers to line pointer per column */ bool *header_done; /* Have all header lines been output? */ int *bytes_output; /* Bytes output for column value */ - int output_columns = 0; /* Width of interactive console */ + int output_columns = 0; /* Width of interactive console */ bool is_pager = false; if (cancel_pressed) @@ -519,8 +520,8 @@ print_aligned_text(const printTableContent *cont, FILE *fout) /* If we have rows, compute average */ if (col_count != 0 && cell_count != 0) { - int rows = cell_count / col_count; - + int rows = cell_count / col_count; + for (i = 0; i < col_count; i++) width_average[i] /= rows; } @@ -543,15 +544,15 @@ print_aligned_text(const printTableContent *cont, FILE *fout) /* * At this point: max_width[] contains the max width of each column, * max_nl_lines[] contains the max number of lines in each column, - * max_bytes[] contains the maximum storage space for formatting - * strings, width_total contains the giant width sum. Now we allocate - * some memory for line pointers. + * max_bytes[] contains the maximum storage space for formatting strings, + * width_total contains the giant width sum. Now we allocate some memory + * for line pointers. */ for (i = 0; i < col_count; i++) { /* Add entry for ptr == NULL array termination */ col_lineptrs[i] = pg_local_calloc(max_nl_lines[i] + 1, - sizeof(**col_lineptrs)); + sizeof(**col_lineptrs)); format_buf[i] = pg_local_malloc(max_bytes[i] + 1); @@ -588,7 +589,7 @@ print_aligned_text(const printTableContent *cont, FILE *fout) * Optional optimized word wrap. Shrink columns with a high max/avg * ratio. Slighly bias against wider columns. (Increases chance a * narrow column will fit in its cell.) If available columns is - * positive... and greater than the width of the unshrinkable column + * positive... and greater than the width of the unshrinkable column * headers */ if (output_columns > 0 && output_columns >= total_header_width) @@ -600,17 +601,17 @@ print_aligned_text(const printTableContent *cont, FILE *fout) int worst_col = -1; /* - * Find column that has the highest ratio of its maximum - * width compared to its average width. This tells us which - * column will produce the fewest wrapped values if shortened. - * width_wrap starts as equal to max_width. + * Find column that has the highest ratio of its maximum width + * compared to its average width. This tells us which column + * will produce the fewest wrapped values if shortened. + * width_wrap starts as equal to max_width. */ for (i = 0; i < col_count; i++) { if (width_average[i] && width_wrap[i] > width_header[i]) { /* Penalize wide columns by 1% of their width */ - double ratio; + double ratio; ratio = (double) width_wrap[i] / width_average[i] + max_width[i] * 0.01; @@ -640,7 +641,7 @@ print_aligned_text(const printTableContent *cont, FILE *fout) fout = PageOutput(INT_MAX, cont->opt->pager); /* force pager */ is_pager = true; } - + /* Check if newlines or our wrapping now need the pager */ if (!is_pager) { @@ -650,22 +651,21 @@ print_aligned_text(const printTableContent *cont, FILE *fout) int width, nl_lines, bytes_required; - + pg_wcssize((unsigned char *) *ptr, strlen(*ptr), encoding, &width, &nl_lines, &bytes_required); if (opt_numeric_locale && cont->align[i] == 'r') width += additional_numeric_locale_len(*ptr); - + /* - * A row can have both wrapping and newlines that cause - * it to display across multiple lines. We check - * for both cases below. + * A row can have both wrapping and newlines that cause it to + * display across multiple lines. We check for both cases below. */ if (width > 0 && width_wrap[i]) { unsigned int extra_lines; - extra_lines = (width-1) / width_wrap[i] + nl_lines; + extra_lines = (width - 1) / width_wrap[i] + nl_lines; if (extra_lines > extra_row_output_lines) extra_row_output_lines = extra_lines; } @@ -681,14 +681,15 @@ print_aligned_text(const printTableContent *cont, FILE *fout) } IsPagerNeeded(cont, extra_output_lines, &fout, &is_pager); } - + /* time to output */ if (cont->opt->start_table) { /* print title */ if (cont->title && !opt_tuples_only) { - int width, height; + int width, + height; pg_wcssize((unsigned char *) cont->title, strlen(cont->title), encoding, &width, &height, NULL); @@ -777,8 +778,8 @@ print_aligned_text(const printTableContent *cont, FILE *fout) break; /* - * Format each cell. Format again, if it's a numeric formatting locale - * (e.g. 123,456 vs. 123456) + * Format each cell. Format again, if it's a numeric formatting + * locale (e.g. 123,456 vs. 123456) */ for (j = 0; j < col_count; j++) { @@ -800,9 +801,9 @@ print_aligned_text(const printTableContent *cont, FILE *fout) memset(bytes_output, 0, col_count * sizeof(int)); /* - * Each time through this loop, one display line is output. - * It can either be a full value or a partial value if embedded - * newlines exist or if 'format=wrapping' mode is enabled. + * Each time through this loop, one display line is output. It can + * either be a full value or a partial value if embedded newlines + * exist or if 'format=wrapping' mode is enabled. */ do { @@ -819,9 +820,9 @@ print_aligned_text(const printTableContent *cont, FILE *fout) { /* We have a valid array element, so index it */ struct lineptr *this_line = &col_lineptrs[j][curr_nl_line[j]]; - int bytes_to_output; - int chars_to_output = width_wrap[j]; - bool finalspaces = (opt_border == 2 || j < col_count - 1); + int bytes_to_output; + int chars_to_output = width_wrap[j]; + bool finalspaces = (opt_border == 2 || j < col_count - 1); if (!this_line->ptr) { @@ -837,15 +838,15 @@ print_aligned_text(const printTableContent *cont, FILE *fout) &chars_to_output, encoding); /* - * If we exceeded width_wrap, it means the display width - * of a single character was wider than our target width. - * In that case, we have to pretend we are only printing - * the target display width and make the best of it. + * If we exceeded width_wrap, it means the display width + * of a single character was wider than our target width. + * In that case, we have to pretend we are only printing + * the target display width and make the best of it. */ if (chars_to_output > width_wrap[j]) chars_to_output = width_wrap[j]; - if (cont->aligns[j] == 'r') /* Right aligned cell */ + if (cont->aligns[j] == 'r') /* Right aligned cell */ { /* spaces first */ fprintf(fout, "%*s", width_wrap[j] - chars_to_output, ""); @@ -882,16 +883,16 @@ print_aligned_text(const printTableContent *cont, FILE *fout) if (opt_border == 0) fputc(' ', fout); /* Next value is beyond past newlines? */ - else if (col_lineptrs[j+1][curr_nl_line[j+1]].ptr == NULL) + else if (col_lineptrs[j + 1][curr_nl_line[j + 1]].ptr == NULL) fputs(" ", fout); /* In wrapping of value? */ - else if (bytes_output[j+1] != 0) + else if (bytes_output[j + 1] != 0) fputs(" ; ", fout); /* After first newline value */ - else if (curr_nl_line[j+1] != 0) + else if (curr_nl_line[j + 1] != 0) fputs(" : ", fout); else - /* Ordinary line */ + /* Ordinary line */ fputs(" | ", fout); } } @@ -2019,7 +2020,7 @@ printTableAddHeader(printTableContent *const content, const char *header, const bool translate, const char align) { #ifndef ENABLE_NLS - (void) translate; /* unused parameter */ + (void) translate; /* unused parameter */ #endif if (content->header >= content->headers + content->ncolumns) @@ -2056,7 +2057,7 @@ printTableAddCell(printTableContent *const content, const char *cell, const bool translate) { #ifndef ENABLE_NLS - (void) translate; /* unused parameter */ + (void) translate; /* unused parameter */ #endif if (content->cell >= content->cells + (content->ncolumns * content->nrows)) @@ -2084,7 +2085,7 @@ printTableAddCell(printTableContent *const content, const char *cell, * strdup'd, so there is no need to keep the original footer string around. * * Footers are never translated by the function. If you want the footer - * translated you must do so yourself, before calling printTableAddFooter. The + * translated you must do so yourself, before calling printTableAddFooter. The * reason this works differently to headers and cells is that footers tend to * be made of up individually translated components, rather than being * translated as a whole. @@ -2208,7 +2209,7 @@ void printTable(const printTableContent *cont, FILE *fout, FILE *flog) { bool is_pager = false; - + if (cancel_pressed) return; @@ -2218,7 +2219,7 @@ printTable(const printTableContent *cont, FILE *fout, FILE *flog) /* print_aligned_text() handles the pager itself */ if ((cont->opt->format != PRINT_ALIGNED && cont->opt->format != PRINT_WRAPPED) || - cont->opt->expanded) + cont->opt->expanded) IsPagerNeeded(cont, 0, &fout, &is_pager); /* print the stuff */ @@ -2321,8 +2322,8 @@ printQuery(const PGresult *result, const printQueryOpt *opt, FILE *fout, FILE *f { for (c = 0; c < cont.ncolumns; c++) { - char *cell; - bool translate; + char *cell; + bool translate; if (PQgetisnull(result, r, c)) cell = opt->nullPrint ? opt->nullPrint : ""; @@ -2337,7 +2338,7 @@ printQuery(const PGresult *result, const printQueryOpt *opt, FILE *fout, FILE *f /* set footers */ if (opt->footers) { - char **footer; + char **footer; for (footer = opt->footers; *footer; footer++) printTableAddFooter(&cont, *footer); @@ -2388,7 +2389,7 @@ setDecimalLocale(void) /* * Compute the byte distance to the end of the string or *target_width - * display character positions, whichever comes first. Update *target_width + * display character positions, whichever comes first. Update *target_width * to be the number of display character positions actually filled. */ static int @@ -2396,27 +2397,27 @@ strlen_max_width(unsigned char *str, int *target_width, int encoding) { unsigned char *start = str; unsigned char *end = str + strlen((char *) str); - int curr_width = 0; + int curr_width = 0; while (str < end) { - int char_width = PQdsplen((char *) str, encoding); + int char_width = PQdsplen((char *) str, encoding); /* - * If the display width of the new character causes - * the string to exceed its target width, skip it - * and return. However, if this is the first character - * of the string (curr_width == 0), we have to accept it. + * If the display width of the new character causes the string to + * exceed its target width, skip it and return. However, if this is + * the first character of the string (curr_width == 0), we have to + * accept it. */ if (*target_width < curr_width + char_width && curr_width != 0) break; curr_width += char_width; - + str += PQmblen((char *) str, encoding); } *target_width = curr_width; - + return str - start; } diff --git a/src/bin/psql/print.h b/src/bin/psql/print.h index 0c5c1b795a..13e53e0dad 100644 --- a/src/bin/psql/print.h +++ b/src/bin/psql/print.h @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/print.h,v 1.39 2009/01/01 17:23:55 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/print.h,v 1.40 2009/06/11 14:49:08 momjian Exp $ */ #ifndef PRINT_H #define PRINT_H @@ -56,7 +56,7 @@ typedef struct printTableOpt */ typedef struct printTableFooter { - char *data; + char *data; struct printTableFooter *next; } printTableFooter; @@ -67,19 +67,19 @@ typedef struct printTableFooter typedef struct printTableContent { const printTableOpt *opt; - const char *title; /* May be NULL */ - int ncolumns; /* Specified in Init() */ - int nrows; /* Specified in Init() */ + const char *title; /* May be NULL */ + int ncolumns; /* Specified in Init() */ + int nrows; /* Specified in Init() */ const char **headers; /* NULL-terminated array of header strings */ const char **header; /* Pointer to the last added header */ const char **cells; /* NULL-terminated array of cell content - strings */ + * strings */ const char **cell; /* Pointer to the last added cell */ - printTableFooter *footers; /* Pointer to the first footer */ + printTableFooter *footers; /* Pointer to the first footer */ printTableFooter *footer; /* Pointer to the last added footer */ - char *aligns; /* Array of alignment specifiers; 'l' or 'r', - one per column */ - char *align; /* Pointer to the last added alignment */ + char *aligns; /* Array of alignment specifiers; 'l' or 'r', + * one per column */ + char *align; /* Pointer to the last added alignment */ } printTableContent; typedef struct printQueryOpt @@ -90,8 +90,9 @@ typedef struct printQueryOpt char *title; /* override title */ char **footers; /* override footer (default is "(xx rows)") */ bool default_footer; /* print default footer if footers==NULL */ - bool translate_header; /* do gettext on column headers */ - const bool *translate_columns; /* translate_columns[i-1] => do gettext on col i */ + bool translate_header; /* do gettext on column headers */ + const bool *translate_columns; /* translate_columns[i-1] => do + * gettext on col i */ } printQueryOpt; @@ -101,22 +102,22 @@ extern void ClosePager(FILE *pagerpipe); extern void html_escaped_print(const char *in, FILE *fout); extern void printTableInit(printTableContent *const content, - const printTableOpt *opt, const char *title, - const int ncolumns, const int nrows); -extern void printTableAddHeader(printTableContent *const content, - const char *header, const bool translate, const char align); -extern void printTableAddCell(printTableContent *const content, - const char *cell, const bool translate); -extern void printTableAddFooter(printTableContent *const content, - const char *footer); -extern void printTableSetFooter(printTableContent *const content, - const char *footer); + const printTableOpt *opt, const char *title, + const int ncolumns, const int nrows); +extern void printTableAddHeader(printTableContent *const content, + const char *header, const bool translate, const char align); +extern void printTableAddCell(printTableContent *const content, + const char *cell, const bool translate); +extern void printTableAddFooter(printTableContent *const content, + const char *footer); +extern void printTableSetFooter(printTableContent *const content, + const char *footer); extern void printTableCleanup(printTableContent *const content); extern void printTable(const printTableContent *cont, FILE *fout, FILE *flog); extern void printQuery(const PGresult *result, const printQueryOpt *opt, - FILE *fout, FILE *flog); + FILE *fout, FILE *flog); -extern void setDecimalLocale(void); +extern void setDecimalLocale(void); #ifndef __CYGWIN__ #define DEFAULT_PAGER "more" diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 7cf33dc525..6af3f2f1ea 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.183 2009/04/08 04:05:16 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.184 2009/06/11 14:49:08 momjian Exp $ */ /*---------------------------------------------------------------------- @@ -125,7 +125,7 @@ static int completion_max_records; * Communication variables set by COMPLETE_WITH_FOO macros and then used by * the completion callback functions. Ugly but there is no better way. */ -static const char *completion_charp; /* to pass a string */ +static const char *completion_charp; /* to pass a string */ static const char *const * completion_charpp; /* to pass a list of strings */ static const char *completion_info_charp; /* to pass a second string */ static const char *completion_info_charp2; /* to pass a third string */ @@ -693,7 +693,7 @@ psql_completion(char *text, int start, int end) { static const char *const list_ALTER[] = {"AGGREGATE", "CONVERSION", "DATABASE", "DOMAIN", "FOREIGN DATA WRAPPER", "FUNCTION", - "GROUP", "INDEX", "LANGUAGE", "OPERATOR", "ROLE", "SCHEMA", "SERVER", "SEQUENCE", "TABLE", + "GROUP", "INDEX", "LANGUAGE", "OPERATOR", "ROLE", "SCHEMA", "SERVER", "SEQUENCE", "TABLE", "TABLESPACE", "TEXT SEARCH", "TRIGGER", "TYPE", "USER", "USER MAPPING FOR", "VIEW", NULL}; COMPLETE_WITH_LIST(list_ALTER); @@ -1673,8 +1673,8 @@ psql_completion(char *text, int start, int end) { static const char *const list_privileg[] = {"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", - "TRIGGER", "CREATE", "CONNECT", "TEMPORARY", "EXECUTE", "USAGE", - "ALL", NULL}; + "TRIGGER", "CREATE", "CONNECT", "TEMPORARY", "EXECUTE", "USAGE", + "ALL", NULL}; COMPLETE_WITH_LIST(list_privileg); } @@ -1755,8 +1755,8 @@ psql_completion(char *text, int start, int end) COMPLETE_WITH_ATTR(prev_wd, ""); /* - * Complete INSERT INTO <table> with "VALUES" or "SELECT" or - * "TABLE" or "DEFAULT VALUES" + * Complete INSERT INTO <table> with "VALUES" or "SELECT" or "TABLE" or + * "DEFAULT VALUES" */ else if (pg_strcasecmp(prev3_wd, "INSERT") == 0 && pg_strcasecmp(prev2_wd, "INTO") == 0) @@ -1766,7 +1766,11 @@ psql_completion(char *text, int start, int end) COMPLETE_WITH_LIST(list_INSERT); } - /* Complete INSERT INTO <table> (attribs) with "VALUES" or "SELECT" or "TABLE" */ + + /* + * Complete INSERT INTO <table> (attribs) with "VALUES" or "SELECT" or + * "TABLE" + */ else if (pg_strcasecmp(prev4_wd, "INSERT") == 0 && pg_strcasecmp(prev3_wd, "INTO") == 0 && prev_wd[strlen(prev_wd) - 1] == ')') diff --git a/src/bin/scripts/common.c b/src/bin/scripts/common.c index 9cf7f9c4fa..763594455c 100644 --- a/src/bin/scripts/common.c +++ b/src/bin/scripts/common.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/bin/scripts/common.c,v 1.36 2009/04/05 04:19:59 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/scripts/common.c,v 1.37 2009/06/11 14:49:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -226,7 +226,7 @@ executeMaintenanceCommand(PGconn *conn, const char *query, bool echo) } /* - * "Safe" wrapper around strdup(). Pulled from psql/common.c + * "Safe" wrapper around strdup(). Pulled from psql/common.c */ char * pg_strdup(const char *string) diff --git a/src/bin/scripts/reindexdb.c b/src/bin/scripts/reindexdb.c index 3bfa55249a..3651707981 100644 --- a/src/bin/scripts/reindexdb.c +++ b/src/bin/scripts/reindexdb.c @@ -4,7 +4,7 @@ * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/scripts/reindexdb.c,v 1.17 2009/02/26 16:02:39 petere Exp $ + * $PostgreSQL: pgsql/src/bin/scripts/reindexdb.c,v 1.18 2009/06/11 14:49:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -213,7 +213,7 @@ main(int argc, char *argv[]) static void reindex_one_database(const char *name, const char *dbname, const char *type, const char *host, const char *port, const char *username, - enum trivalue prompt_password, const char *progname, bool echo) + enum trivalue prompt_password, const char *progname, bool echo) { PQExpBufferData sql; diff --git a/src/include/access/clog.h b/src/include/access/clog.h index 8620de8f9f..1324df30eb 100644 --- a/src/include/access/clog.h +++ b/src/include/access/clog.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/clog.h,v 1.23 2009/01/01 17:23:55 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/clog.h,v 1.24 2009/06/11 14:49:08 momjian Exp $ */ #ifndef CLOG_H #define CLOG_H @@ -32,8 +32,8 @@ typedef int XidStatus; #define NUM_CLOG_BUFFERS 8 -extern void TransactionIdSetTreeStatus(TransactionId xid, int nsubxids, - TransactionId *subxids, XidStatus status, XLogRecPtr lsn); +extern void TransactionIdSetTreeStatus(TransactionId xid, int nsubxids, + TransactionId *subxids, XidStatus status, XLogRecPtr lsn); extern XidStatus TransactionIdGetStatus(TransactionId xid, XLogRecPtr *lsn); extern Size CLOGShmemSize(void); diff --git a/src/include/access/genam.h b/src/include/access/genam.h index 868980e326..bf3fe96e26 100644 --- a/src/include/access/genam.h +++ b/src/include/access/genam.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/genam.h,v 1.77 2009/06/06 22:13:52 tgl Exp $ + * $PostgreSQL: pgsql/src/include/access/genam.h,v 1.78 2009/06/11 14:49:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -110,8 +110,8 @@ extern IndexScanDesc index_beginscan(Relation heapRelation, Snapshot snapshot, int nkeys, ScanKey key); extern IndexScanDesc index_beginscan_bitmap(Relation indexRelation, - Snapshot snapshot, - int nkeys, ScanKey key); + Snapshot snapshot, + int nkeys, ScanKey key); extern void index_rescan(IndexScanDesc scan, ScanKey key); extern void index_endscan(IndexScanDesc scan); extern void index_markpos(IndexScanDesc scan); @@ -149,11 +149,11 @@ extern HeapTuple systable_getnext(SysScanDesc sysscan); extern bool systable_recheck_tuple(SysScanDesc sysscan, HeapTuple tup); extern void systable_endscan(SysScanDesc sysscan); extern SysScanDesc systable_beginscan_ordered(Relation heapRelation, - Relation indexRelation, - Snapshot snapshot, - int nkeys, ScanKey key); + Relation indexRelation, + Snapshot snapshot, + int nkeys, ScanKey key); extern HeapTuple systable_getnext_ordered(SysScanDesc sysscan, - ScanDirection direction); + ScanDirection direction); extern void systable_endscan_ordered(SysScanDesc sysscan); #endif /* GENAM_H */ diff --git a/src/include/access/gin.h b/src/include/access/gin.h index 366fc370b0..3f814eed73 100644 --- a/src/include/access/gin.h +++ b/src/include/access/gin.h @@ -4,7 +4,7 @@ * * Copyright (c) 2006-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/access/gin.h,v 1.33 2009/06/06 02:39:40 tgl Exp $ + * $PostgreSQL: pgsql/src/include/access/gin.h,v 1.34 2009/06/11 14:49:08 momjian Exp $ *-------------------------------------------------------------------------- */ #ifndef GIN_H @@ -29,7 +29,7 @@ /* * Max depth allowed in search tree during bulk inserts. This is to keep from * degenerating to O(N^2) behavior when the tree is unbalanced due to sorted - * or nearly-sorted input. (Perhaps it would be better to use a balanced-tree + * or nearly-sorted input. (Perhaps it would be better to use a balanced-tree * algorithm, but in common cases that would only add useless overhead.) */ #define GIN_MAX_TREE_DEPTH 100 @@ -59,7 +59,7 @@ typedef GinPageOpaqueData *GinPageOpaque; #define GIN_DELETED (1 << 2) #define GIN_META (1 << 3) #define GIN_LIST (1 << 4) -#define GIN_LIST_FULLROW (1 << 5) /* makes sense only on GIN_LIST page */ +#define GIN_LIST_FULLROW (1 << 5) /* makes sense only on GIN_LIST page */ /* Page numbers of fixed-location pages */ #define GIN_METAPAGE_BLKNO (0) @@ -72,20 +72,20 @@ typedef struct GinMetaPageData * pages. These store fast-inserted entries that haven't yet been moved * into the regular GIN structure. */ - BlockNumber head; - BlockNumber tail; + BlockNumber head; + BlockNumber tail; /* * Free space in bytes in the pending list's tail page. */ - uint32 tailFreeSize; + uint32 tailFreeSize; /* - * We store both number of pages and number of heap tuples - * that are in the pending list. + * We store both number of pages and number of heap tuples that are in the + * pending list. */ - BlockNumber nPendingPages; - int64 nPendingHeapTuples; + BlockNumber nPendingPages; + int64 nPendingHeapTuples; } GinMetaPageData; #define GinPageGetMeta(p) \ @@ -175,7 +175,7 @@ typedef struct #define GinDataPageGetRightBound(page) ((ItemPointer) PageGetContents(page)) #define GinDataPageGetData(page) \ (PageGetContents(page) + MAXALIGN(sizeof(ItemPointerData))) -#define GinSizeOfItem(page) \ +#define GinSizeOfItem(page) \ (GinPageIsLeaf(page) ? sizeof(ItemPointerData) : sizeof(PostingItem)) #define GinDataPageGetItem(page,i) \ (GinDataPageGetData(page) + ((i)-1) * GinSizeOfItem(page)) @@ -190,18 +190,18 @@ typedef struct * List pages */ #define GinListPageSize \ - ( BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(GinPageOpaqueData)) ) + ( BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(GinPageOpaqueData)) ) /* * Storage type for GIN's reloptions */ typedef struct GinOptions { - int32 vl_len_; /* varlena header (do not touch directly!) */ + int32 vl_len_; /* varlena header (do not touch directly!) */ bool useFastUpdate; /* use fast updates? */ } GinOptions; -#define GIN_DEFAULT_USE_FASTUPDATE true +#define GIN_DEFAULT_USE_FASTUPDATE true #define GinGetUseFastUpdate(relation) \ ((relation)->rd_options ? \ ((GinOptions *) (relation)->rd_options)->useFastUpdate : GIN_DEFAULT_USE_FASTUPDATE) @@ -217,14 +217,15 @@ typedef struct GinState FmgrInfo extractValueFn[INDEX_MAX_KEYS]; FmgrInfo extractQueryFn[INDEX_MAX_KEYS]; FmgrInfo consistentFn[INDEX_MAX_KEYS]; - FmgrInfo comparePartialFn[INDEX_MAX_KEYS]; /* optional method */ + FmgrInfo comparePartialFn[INDEX_MAX_KEYS]; /* optional method */ - bool canPartialMatch[INDEX_MAX_KEYS]; /* can opclass perform partial - * match (prefix search)? */ + bool canPartialMatch[INDEX_MAX_KEYS]; /* can opclass perform + * partial match (prefix + * search)? */ - TupleDesc tupdesc[INDEX_MAX_KEYS]; - TupleDesc origTupdesc; - bool oneCol; + TupleDesc tupdesc[INDEX_MAX_KEYS]; + TupleDesc origTupdesc; + bool oneCol; } GinState; /* XLog stuff */ @@ -309,13 +310,13 @@ typedef struct ginxlogDeletePage typedef struct ginxlogUpdateMeta { - RelFileNode node; + RelFileNode node; GinMetaPageData metadata; - BlockNumber prevTail; - BlockNumber newRightlink; - int32 ntuples; /* if ntuples > 0 then metadata.tail was updated - * with that many tuples; else new sub list was - * inserted */ + BlockNumber prevTail; + BlockNumber newRightlink; + int32 ntuples; /* if ntuples > 0 then metadata.tail was + * updated with that many tuples; else new sub + * list was inserted */ /* array of inserted tuples follows */ } ginxlogUpdateMeta; @@ -323,10 +324,10 @@ typedef struct ginxlogUpdateMeta typedef struct ginxlogInsertListPage { - RelFileNode node; - BlockNumber blkno; - BlockNumber rightlink; - int32 ntuples; + RelFileNode node; + BlockNumber blkno; + BlockNumber rightlink; + int32 ntuples; /* array of inserted tuples follows */ } ginxlogInsertListPage; @@ -335,10 +336,10 @@ typedef struct ginxlogInsertListPage #define GIN_NDELETE_AT_ONCE 16 typedef struct ginxlogDeleteListPages { - RelFileNode node; + RelFileNode node; GinMetaPageData metadata; - int32 ndeleted; - BlockNumber toDelete[GIN_NDELETE_AT_ONCE]; + int32 ndeleted; + BlockNumber toDelete[GIN_NDELETE_AT_ONCE]; } ginxlogDeleteListPages; @@ -350,8 +351,8 @@ extern void GinInitBuffer(Buffer b, uint32 f); extern void GinInitPage(Page page, uint32 f, Size pageSize); extern void GinInitMetabuffer(Buffer b); extern int compareEntries(GinState *ginstate, OffsetNumber attnum, Datum a, Datum b); -extern int compareAttEntries(GinState *ginstate, OffsetNumber attnum_a, Datum a, - OffsetNumber attnum_b, Datum b); +extern int compareAttEntries(GinState *ginstate, OffsetNumber attnum_a, Datum a, + OffsetNumber attnum_b, Datum b); extern Datum *extractEntriesS(GinState *ginstate, OffsetNumber attnum, Datum value, int32 *nentries, bool *needUnique); extern Datum *extractEntriesSU(GinState *ginstate, OffsetNumber attnum, Datum value, int32 *nentries); @@ -363,9 +364,9 @@ extern OffsetNumber gintuple_get_attrnum(GinState *ginstate, IndexTuple tuple); extern Datum ginbuild(PG_FUNCTION_ARGS); extern Datum gininsert(PG_FUNCTION_ARGS); extern void ginEntryInsert(Relation index, GinState *ginstate, - OffsetNumber attnum, Datum value, - ItemPointerData *items, uint32 nitem, - bool isBuild); + OffsetNumber attnum, Datum value, + ItemPointerData *items, uint32 nitem, + bool isBuild); /* ginxlog.c */ extern void gin_redo(XLogRecPtr lsn, XLogRecord *record); @@ -413,7 +414,7 @@ typedef struct GinBtreeData BlockNumber rightblkno; /* Entry options */ - OffsetNumber entryAttnum; + OffsetNumber entryAttnum; Datum entryValue; IndexTuple entry; bool isDelete; @@ -434,10 +435,10 @@ extern void findParents(GinBtree btree, GinBtreeStack *stack, BlockNumber rootBl /* ginentrypage.c */ extern IndexTuple GinFormTuple(GinState *ginstate, OffsetNumber attnum, Datum key, - ItemPointerData *ipd, uint32 nipd); + ItemPointerData *ipd, uint32 nipd); extern void GinShortenTuple(IndexTuple itup, uint32 nipd); extern void prepareEntryScan(GinBtree btree, Relation index, OffsetNumber attnum, - Datum value, GinState *ginstate); + Datum value, GinState *ginstate); extern void entryFillRoot(GinBtree btree, Buffer root, Buffer lbuf, Buffer rbuf); extern IndexTuple ginPageGetLinkItup(Buffer buf); @@ -481,8 +482,8 @@ typedef struct GinScanEntryData /* entry, got from extractQueryFn */ Datum entry; - OffsetNumber attnum; - Pointer extra_data; + OffsetNumber attnum; + Pointer extra_data; /* Current page in posting tree */ Buffer buffer; @@ -499,8 +500,8 @@ typedef struct GinScanEntryData /* used for Posting list and one page in Posting tree */ ItemPointerData *list; - uint32 nlist; - OffsetNumber offset; + uint32 nlist; + OffsetNumber offset; bool isFinished; bool reduceResult; @@ -517,12 +518,12 @@ typedef struct GinScanKeyData /* array of scans per entry */ GinScanEntry scanEntry; - Pointer *extra_data; + Pointer *extra_data; /* for calling consistentFn(GinScanKey->entryRes, strategy, query) */ StrategyNumber strategy; Datum query; - OffsetNumber attnum; + OffsetNumber attnum; ItemPointerData curItem; bool firstCall; @@ -568,12 +569,12 @@ extern Datum ginarrayconsistent(PG_FUNCTION_ARGS); /* ginbulk.c */ typedef struct EntryAccumulator { - OffsetNumber attnum; - Datum value; - uint32 length; - uint32 number; + OffsetNumber attnum; + Datum value; + uint32 length; + uint32 number; ItemPointerData *list; - bool shouldSort; + bool shouldSort; struct EntryAccumulator *left; struct EntryAccumulator *right; } EntryAccumulator; @@ -601,18 +602,18 @@ extern ItemPointerData *ginGetEntry(BuildAccumulator *accum, OffsetNumber *attnu typedef struct GinTupleCollector { - IndexTuple *tuples; - uint32 ntuples; - uint32 lentuples; - uint32 sumsize; + IndexTuple *tuples; + uint32 ntuples; + uint32 lentuples; + uint32 sumsize; } GinTupleCollector; extern void ginHeapTupleFastInsert(Relation index, GinState *ginstate, - GinTupleCollector *collector); + GinTupleCollector *collector); extern uint32 ginHeapTupleFastCollect(Relation index, GinState *ginstate, - GinTupleCollector *collector, - OffsetNumber attnum, Datum value, ItemPointer item); + GinTupleCollector *collector, + OffsetNumber attnum, Datum value, ItemPointer item); extern void ginInsertCleanup(Relation index, GinState *ginstate, - bool vac_delay, IndexBulkDeleteResult *stats); + bool vac_delay, IndexBulkDeleteResult *stats); -#endif /* GIN_H */ +#endif /* GIN_H */ diff --git a/src/include/access/gist_private.h b/src/include/access/gist_private.h index 3229c32d5a..2ce46542af 100644 --- a/src/include/access/gist_private.h +++ b/src/include/access/gist_private.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/gist_private.h,v 1.36 2009/01/01 17:23:55 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/gist_private.h,v 1.37 2009/06/11 14:49:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -60,9 +60,9 @@ typedef struct GISTSTATE typedef struct ItemResult { - ItemPointerData heapPtr; - OffsetNumber pageOffset; /* offset in index page */ - bool recheck; + ItemPointerData heapPtr; + OffsetNumber pageOffset; /* offset in index page */ + bool recheck; } ItemResult; /* @@ -73,15 +73,15 @@ typedef struct GISTScanOpaqueData { GISTSearchStack *stack; GISTSearchStack *markstk; - bool qual_ok; /* false if qual can never be satisfied */ + bool qual_ok; /* false if qual can never be satisfied */ GISTSTATE *giststate; MemoryContext tempCxt; Buffer curbuf; ItemPointerData curpos; - ItemResult pageData[BLCKSZ/sizeof(IndexTupleData)]; - OffsetNumber nPageData; - OffsetNumber curPageData; + ItemResult pageData[BLCKSZ / sizeof(IndexTupleData)]; + OffsetNumber nPageData; + OffsetNumber curPageData; } GISTScanOpaqueData; typedef GISTScanOpaqueData *GISTScanOpaque; @@ -283,7 +283,7 @@ extern bool gistnospace(Page page, IndexTuple *itvec, int len, OffsetNumber tode extern void gistcheckpage(Relation rel, Buffer buf); extern Buffer gistNewBuffer(Relation r); extern void gistfillbuffer(Page page, IndexTuple *itup, int len, - OffsetNumber off); + OffsetNumber off); extern IndexTuple *gistextractpage(Page page, int *len /* out */ ); extern IndexTuple *gistjoinvector( IndexTuple *itvec, int *len, diff --git a/src/include/access/hash.h b/src/include/access/hash.h index 0247ece338..a70ace032f 100644 --- a/src/include/access/hash.h +++ b/src/include/access/hash.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/hash.h,v 1.92 2009/01/01 17:23:55 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/hash.h,v 1.93 2009/06/11 14:49:08 momjian Exp $ * * NOTES * modeled after Margo Seltzer's hash implementation for unix. @@ -340,7 +340,7 @@ extern uint32 _hash_log2(uint32 num); extern void _hash_checkpage(Relation rel, Buffer buf, int flags); extern uint32 _hash_get_indextuple_hashkey(IndexTuple itup); extern IndexTuple _hash_form_tuple(Relation index, - Datum *values, bool *isnull); + Datum *values, bool *isnull); extern OffsetNumber _hash_binsearch(Page page, uint32 hash_value); extern OffsetNumber _hash_binsearch_last(Page page, uint32 hash_value); diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h index ec49192cac..459b780824 100644 --- a/src/include/access/heapam.h +++ b/src/include/access/heapam.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.142 2009/05/12 16:43:32 tgl Exp $ + * $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.143 2009/06/11 14:49:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -138,7 +138,7 @@ extern XLogRecPtr log_heap_freeze(Relation reln, Buffer buffer, TransactionId cutoff_xid, OffsetNumber *offsets, int offcnt); extern XLogRecPtr log_newpage(RelFileNode *rnode, ForkNumber forkNum, - BlockNumber blk, Page page); + BlockNumber blk, Page page); /* in heap/pruneheap.c */ extern void heap_page_prune_opt(Relation relation, Buffer buffer, diff --git a/src/include/access/hio.h b/src/include/access/hio.h index 798e12f4fd..54b76084ac 100644 --- a/src/include/access/hio.h +++ b/src/include/access/hio.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/hio.h,v 1.38 2009/01/01 17:23:56 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/hio.h,v 1.39 2009/06/11 14:49:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -29,8 +29,8 @@ */ typedef struct BulkInsertStateData { - BufferAccessStrategy strategy; /* our BULKWRITE strategy object */ - Buffer current_buf; /* current insertion target page */ + BufferAccessStrategy strategy; /* our BULKWRITE strategy object */ + Buffer current_buf; /* current insertion target page */ } BulkInsertStateData; diff --git a/src/include/access/htup.h b/src/include/access/htup.h index 5907436691..f7fa60cb70 100644 --- a/src/include/access/htup.h +++ b/src/include/access/htup.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/htup.h,v 1.106 2009/01/01 17:23:56 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/htup.h,v 1.107 2009/06/11 14:49:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -422,7 +422,7 @@ do { \ * the MINIMAL_TUPLE_OFFSET distance. t_len does not include that, however. * * MINIMAL_TUPLE_DATA_OFFSET is the offset to the first useful (non-pad) data - * other than the length word. tuplesort.c and tuplestore.c use this to avoid + * other than the length word. tuplesort.c and tuplestore.c use this to avoid * writing the padding to disk. */ #define MINIMAL_TUPLE_OFFSET \ @@ -601,7 +601,7 @@ typedef struct xl_heaptid typedef struct xl_heap_delete { xl_heaptid target; /* deleted tuple id */ - bool all_visible_cleared; /* PD_ALL_VISIBLE was cleared */ + bool all_visible_cleared; /* PD_ALL_VISIBLE was cleared */ } xl_heap_delete; #define SizeOfHeapDelete (offsetof(xl_heap_delete, all_visible_cleared) + sizeof(bool)) @@ -627,7 +627,7 @@ typedef struct xl_heap_header typedef struct xl_heap_insert { xl_heaptid target; /* inserted tuple id */ - bool all_visible_cleared; /* PD_ALL_VISIBLE was cleared */ + bool all_visible_cleared; /* PD_ALL_VISIBLE was cleared */ /* xl_heap_header & TUPLE DATA FOLLOWS AT END OF STRUCT */ } xl_heap_insert; @@ -638,8 +638,8 @@ typedef struct xl_heap_update { xl_heaptid target; /* deleted tuple id */ ItemPointerData newtid; /* new inserted tuple id */ - bool all_visible_cleared; /* PD_ALL_VISIBLE was cleared */ - bool new_all_visible_cleared; /* same for the page of newtid */ + bool all_visible_cleared; /* PD_ALL_VISIBLE was cleared */ + bool new_all_visible_cleared; /* same for the page of newtid */ /* NEW TUPLE xl_heap_header (PLUS xmax & xmin IF MOVE OP) */ /* and TUPLE DATA FOLLOWS AT END OF STRUCT */ } xl_heap_update; @@ -834,6 +834,7 @@ extern HeapTuple heap_modify_tuple(HeapTuple tuple, bool *doReplace); extern void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *values, bool *isnull); + /* these three are deprecated versions of the three above: */ extern HeapTuple heap_formtuple(TupleDesc tupleDescriptor, Datum *values, char *nulls); diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h index 071f8f4ab6..1d3e42d99b 100644 --- a/src/include/access/nbtree.h +++ b/src/include/access/nbtree.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.123 2009/01/01 17:23:56 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.124 2009/06/11 14:49:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -287,9 +287,9 @@ typedef struct xl_btree_split * than BlockNumber for alignment reasons: SizeOfBtreeSplit is only 16-bit * aligned.) * - * If level > 0, an IndexTuple representing the HIKEY of the left page - * follows. We don't need this on leaf pages, because it's the same - * as the leftmost key in the new right page. Also, it's suppressed if + * If level > 0, an IndexTuple representing the HIKEY of the left page + * follows. We don't need this on leaf pages, because it's the same as + * the leftmost key in the new right page. Also, it's suppressed if * XLogInsert chooses to store the left page's whole page image. * * In the _L variants, next are OffsetNumber newitemoff and the new item. diff --git a/src/include/access/reloptions.h b/src/include/access/reloptions.h index d078273217..fd4aaf049b 100644 --- a/src/include/access/reloptions.h +++ b/src/include/access/reloptions.h @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/reloptions.h,v 1.15 2009/05/24 22:22:44 tgl Exp $ + * $PostgreSQL: pgsql/src/include/access/reloptions.h,v 1.16 2009/06/11 14:49:09 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -33,12 +33,12 @@ typedef enum relopt_type /* kinds supported by reloptions */ typedef enum relopt_kind { - RELOPT_KIND_HEAP = (1 << 0), - RELOPT_KIND_TOAST = (1 << 1), - RELOPT_KIND_BTREE = (1 << 2), - RELOPT_KIND_HASH = (1 << 3), - RELOPT_KIND_GIN = (1 << 4), - RELOPT_KIND_GIST = (1 << 5), + RELOPT_KIND_HEAP = (1 << 0), + RELOPT_KIND_TOAST = (1 << 1), + RELOPT_KIND_BTREE = (1 << 2), + RELOPT_KIND_HASH = (1 << 3), + RELOPT_KIND_GIN = (1 << 4), + RELOPT_KIND_GIST = (1 << 5), /* if you add a new kind, make sure you update "last_default" too */ RELOPT_KIND_LAST_DEFAULT = RELOPT_KIND_GIST, /* some compilers treat enums as signed ints, so we can't use 1 << 31 */ @@ -51,11 +51,12 @@ typedef enum relopt_kind /* generic struct to hold shared data */ typedef struct relopt_gen { - const char *name; /* must be first (used as list termination marker) */ + const char *name; /* must be first (used as list termination + * marker) */ const char *desc; bits32 kinds; int namelen; - relopt_type type; + relopt_type type; } relopt_gen; /* holds a parsed value */ @@ -65,11 +66,11 @@ typedef struct relopt_value bool isset; union { - bool bool_val; - int int_val; - double real_val; - char *string_val; /* allocated separately */ - } values; + bool bool_val; + int int_val; + double real_val; + char *string_val; /* allocated separately */ + } values; } relopt_value; /* reloptions records for specific variable types */ @@ -103,15 +104,15 @@ typedef struct relopt_string relopt_gen gen; int default_len; bool default_isnull; - validate_string_relopt validate_cb; - char default_val[1]; /* variable length, zero-terminated */ + validate_string_relopt validate_cb; + char default_val[1]; /* variable length, zero-terminated */ } relopt_string; /* This is the table datatype for fillRelOptions */ typedef struct { const char *optname; /* option's name */ - relopt_type opttype; /* option's datatype */ + relopt_type opttype; /* option's datatype */ int offset; /* offset of field in result struct */ } relopt_parse_elt; @@ -134,24 +135,24 @@ typedef struct * parseRelOptions: * for (i = 0; options[i].gen->name; i++) * { - * if (HAVE_RELOPTION("fillfactor", options[i]) - * { - * HANDLE_INT_RELOPTION("fillfactor", rdopts->fillfactor, options[i], &isset); - * continue; - * } - * if (HAVE_RELOPTION("default_row_acl", options[i]) - * { - * ... - * } - * ... - * if (validate) - * ereport(ERROR, - * (errmsg("unknown option"))); - * } + * if (HAVE_RELOPTION("fillfactor", options[i]) + * { + * HANDLE_INT_RELOPTION("fillfactor", rdopts->fillfactor, options[i], &isset); + * continue; + * } + * if (HAVE_RELOPTION("default_row_acl", options[i]) + * { + * ... + * } + * ... + * if (validate) + * ereport(ERROR, + * (errmsg("unknown option"))); + * } * - * Note that this is more or less the same that fillRelOptions does, so only - * use this if you need to do something non-standard within some option's - * code block. + * Note that this is more or less the same that fillRelOptions does, so only + * use this if you need to do something non-standard within some option's + * code block. */ #define HAVE_RELOPTION(optname, option) \ (pg_strncasecmp(option.gen->name, optname, option.gen->namelen + 1) == 0) @@ -159,25 +160,25 @@ typedef struct #define HANDLE_INT_RELOPTION(optname, var, option, wasset) \ do { \ if (option.isset) \ - var = option.values.int_val; \ + var = option.values.int_val; \ else \ - var = ((relopt_int *) option.gen)->default_val; \ + var = ((relopt_int *) option.gen)->default_val; \ (wasset) != NULL ? *(wasset) = option.isset : (dummyret)NULL; \ } while (0) #define HANDLE_BOOL_RELOPTION(optname, var, option, wasset) \ do { \ if (option.isset) \ - var = option.values.bool_val; \ + var = option.values.bool_val; \ else \ var = ((relopt_bool *) option.gen)->default_val; \ (wasset) != NULL ? *(wasset) = option.isset : (dummyret) NULL; \ } while (0) -#define HANDLE_REAL_RELOPTION(optname, var, option, wasset) \ +#define HANDLE_REAL_RELOPTION(optname, var, option, wasset) \ do { \ if (option.isset) \ - var = option.values.real_val; \ + var = option.values.real_val; \ else \ var = ((relopt_real *) option.gen)->default_val; \ (wasset) != NULL ? *(wasset) = option.isset : (dummyret) NULL; \ @@ -190,11 +191,11 @@ typedef struct * "base" is a pointer to the reloptions structure, and "offset" is an integer * variable that must be initialized to sizeof(reloptions structure). This * struct must have been allocated with enough space to hold any string option - * present, including terminating \0 for every option. SET_VARSIZE() must be + * present, including terminating \0 for every option. SET_VARSIZE() must be * called on the struct with this offset as the second argument, after all the * string options have been processed. */ -#define HANDLE_STRING_RELOPTION(optname, var, option, base, offset, wasset) \ +#define HANDLE_STRING_RELOPTION(optname, var, option, base, offset, wasset) \ do { \ relopt_string *optstring = (relopt_string *) option.gen;\ char *string_val; \ @@ -254,14 +255,14 @@ extern relopt_value *parseRelOptions(Datum options, bool validate, extern void *allocateReloptStruct(Size base, relopt_value *options, int numoptions); extern void fillRelOptions(void *rdopts, Size basesize, - relopt_value *options, int numoptions, - bool validate, - const relopt_parse_elt *elems, int nelems); + relopt_value *options, int numoptions, + bool validate, + const relopt_parse_elt *elems, int nelems); extern bytea *default_reloptions(Datum reloptions, bool validate, relopt_kind kind); extern bytea *heap_reloptions(char relkind, Datum reloptions, bool validate); extern bytea *index_reloptions(RegProcedure amoptions, Datum reloptions, - bool validate); + bool validate); #endif /* RELOPTIONS_H */ diff --git a/src/include/access/visibilitymap.h b/src/include/access/visibilitymap.h index 9e40acbbe9..3f4b3abb3c 100644 --- a/src/include/access/visibilitymap.h +++ b/src/include/access/visibilitymap.h @@ -1,13 +1,13 @@ /*------------------------------------------------------------------------- * * visibilitymap.h - * visibility map interface + * visibility map interface * * * Portions Copyright (c) 2007-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/visibilitymap.h,v 1.3 2009/01/01 17:23:56 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/visibilitymap.h,v 1.4 2009/06/11 14:49:09 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -21,9 +21,9 @@ extern void visibilitymap_clear(Relation rel, BlockNumber heapBlk); extern void visibilitymap_pin(Relation rel, BlockNumber heapBlk, - Buffer *vmbuf); + Buffer *vmbuf); extern void visibilitymap_set(Relation rel, BlockNumber heapBlk, - XLogRecPtr recptr, Buffer *vmbuf); + XLogRecPtr recptr, Buffer *vmbuf); extern bool visibilitymap_test(Relation rel, BlockNumber heapBlk, Buffer *vmbuf); extern void visibilitymap_truncate(Relation rel, BlockNumber heapblk); diff --git a/src/include/access/xact.h b/src/include/access/xact.h index f11766618d..880b41b707 100644 --- a/src/include/access/xact.h +++ b/src/include/access/xact.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/xact.h,v 1.97 2009/01/01 17:23:56 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/xact.h,v 1.98 2009/06/11 14:49:09 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -91,7 +91,7 @@ typedef struct xl_xact_commit int nrels; /* number of RelFileNodes */ int nsubxacts; /* number of subtransaction XIDs */ /* Array of RelFileNode(s) to drop at commit */ - RelFileNode xnodes[1]; /* VARIABLE LENGTH ARRAY */ + RelFileNode xnodes[1]; /* VARIABLE LENGTH ARRAY */ /* ARRAY OF COMMITTED SUBTRANSACTION XIDs FOLLOWS */ } xl_xact_commit; @@ -103,7 +103,7 @@ typedef struct xl_xact_abort int nrels; /* number of RelFileNodes */ int nsubxacts; /* number of subtransaction XIDs */ /* Array of RelFileNode(s) to drop at abort */ - RelFileNode xnodes[1]; /* VARIABLE LENGTH ARRAY */ + RelFileNode xnodes[1]; /* VARIABLE LENGTH ARRAY */ /* ARRAY OF ABORTED SUBTRANSACTION XIDs FOLLOWS */ } xl_xact_abort; diff --git a/src/include/access/xlogutils.h b/src/include/access/xlogutils.h index ad15f43c5b..e78493db4e 100644 --- a/src/include/access/xlogutils.h +++ b/src/include/access/xlogutils.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/xlogutils.h,v 1.28 2009/01/01 17:23:56 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/xlogutils.h,v 1.29 2009/06/11 14:49:09 momjian Exp $ */ #ifndef XLOG_UTILS_H #define XLOG_UTILS_H @@ -23,11 +23,11 @@ extern void XLogCheckInvalidPages(void); extern void XLogDropRelation(RelFileNode rnode, ForkNumber forknum); extern void XLogDropDatabase(Oid dbid); extern void XLogTruncateRelation(RelFileNode rnode, ForkNumber forkNum, - BlockNumber nblocks); + BlockNumber nblocks); extern Buffer XLogReadBuffer(RelFileNode rnode, BlockNumber blkno, bool init); extern Buffer XLogReadBufferExtended(RelFileNode rnode, ForkNumber forknum, - BlockNumber blkno, ReadBufferMode mode); + BlockNumber blkno, ReadBufferMode mode); extern Relation CreateFakeRelcacheEntry(RelFileNode rnode); extern void FreeFakeRelcacheEntry(Relation fakerel); diff --git a/src/include/c.h b/src/include/c.h index 8443c51e78..36401259de 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -12,7 +12,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/c.h,v 1.235 2009/03/26 22:26:07 petere Exp $ + * $PostgreSQL: pgsql/src/include/c.h,v 1.236 2009/06/11 14:49:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -103,7 +103,7 @@ /* * Use this to mark string constants as needing translation at some later - * time, rather than immediately. This is useful for cases where you need + * time, rather than immediately. This is useful for cases where you need * access to the original string and translated string, and for cases where * immediate translation is not possible, like when initializing global * variables. @@ -737,9 +737,9 @@ typedef NameData *Name; #define CppAsString2(x) CppAsString(x) #ifdef SO_MAJOR_VERSION -# define PG_TEXTDOMAIN(domain) (domain CppAsString2(SO_MAJOR_VERSION) "-" PG_MAJORVERSION) +#define PG_TEXTDOMAIN(domain) (domain CppAsString2(SO_MAJOR_VERSION) "-" PG_MAJORVERSION) #else -# define PG_TEXTDOMAIN(domain) (domain "-" PG_MAJORVERSION) +#define PG_TEXTDOMAIN(domain) (domain "-" PG_MAJORVERSION) #endif @@ -842,7 +842,7 @@ extern int fdatasync(int fildes); #if defined(HAVE_WCSTOMBS) && defined(HAVE_TOWLOWER) #define USE_WIDE_UPPER_LOWER #endif - + /* EXEC_BACKEND defines */ #ifdef EXEC_BACKEND #define NON_EXEC_STATIC diff --git a/src/include/catalog/catalog.h b/src/include/catalog/catalog.h index 1552f02695..f049bec750 100644 --- a/src/include/catalog/catalog.h +++ b/src/include/catalog/catalog.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/catalog.h,v 1.43 2009/01/01 17:23:56 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/catalog.h,v 1.44 2009/06/11 14:49:09 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -39,8 +39,8 @@ extern bool IsReservedName(const char *name); extern bool IsSharedRelation(Oid relationId); extern Oid GetNewOid(Relation relation); -extern Oid GetNewOidWithIndex(Relation relation, Oid indexId, - AttrNumber oidcolumn); +extern Oid GetNewOidWithIndex(Relation relation, Oid indexId, + AttrNumber oidcolumn); extern Oid GetNewRelFileNode(Oid reltablespace, bool relisshared, Relation pg_class); diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index bf23d14623..dcd149d051 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -4,7 +4,7 @@ * "Catalog version number" for PostgreSQL. * * The catalog version number is used to flag incompatible changes in - * the PostgreSQL system catalogs. Whenever anyone changes the format of + * the PostgreSQL system catalogs. Whenever anyone changes the format of * a system catalog relation, or adds, deletes, or modifies standard * catalog entries in such a way that an updated backend wouldn't work * with an old database (or vice versa), the catalog version number @@ -37,7 +37,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.530 2009/04/09 17:39:48 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.531 2009/06/11 14:49:09 momjian Exp $ * *------------------------------------------------------------------------- */ diff --git a/src/include/catalog/dependency.h b/src/include/catalog/dependency.h index 99380da566..fe04aab964 100644 --- a/src/include/catalog/dependency.h +++ b/src/include/catalog/dependency.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/dependency.h,v 1.39 2009/01/22 20:16:08 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/dependency.h,v 1.40 2009/06/11 14:49:09 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -222,7 +222,7 @@ extern void recordSharedDependencyOn(ObjectAddress *depender, SharedDependencyType deptype); extern void deleteSharedDependencyRecordsFor(Oid classId, Oid objectId, - int32 objectSubId); + int32 objectSubId); extern void recordDependencyOnOwner(Oid classId, Oid objectId, Oid owner); @@ -235,7 +235,7 @@ extern void updateAclDependencies(Oid classId, Oid objectId, int32 objectSubId, int nnewmembers, Oid *newmembers); extern bool checkSharedDependencies(Oid classId, Oid objectId, - char **detail_msg, char **detail_log_msg); + char **detail_msg, char **detail_log_msg); extern void copyTemplateDependencies(Oid templateDbId, Oid newDbId); diff --git a/src/include/catalog/genbki.h b/src/include/catalog/genbki.h index 60fa74a9fe..1bdd1f9e57 100644 --- a/src/include/catalog/genbki.h +++ b/src/include/catalog/genbki.h @@ -12,11 +12,11 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/genbki.h,v 1.2 2009/01/01 17:23:56 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/genbki.h,v 1.3 2009/06/11 14:49:09 momjian Exp $ * *------------------------------------------------------------------------- */ -#ifndef GENBKI_H +#ifndef GENBKI_H #define GENBKI_H /* Introduces a catalog's structure definition */ diff --git a/src/include/catalog/heap.h b/src/include/catalog/heap.h index b105e00340..2d6eb3c34a 100644 --- a/src/include/catalog/heap.h +++ b/src/include/catalog/heap.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/heap.h,v 1.90 2009/01/01 17:23:56 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/heap.h,v 1.91 2009/06/11 14:49:09 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -67,8 +67,8 @@ extern void heap_truncate_check_FKs(List *relations, bool tempTables); extern List *heap_truncate_find_FKs(List *relationIds); extern void InsertPgAttributeTuple(Relation pg_attribute_rel, - Form_pg_attribute new_attribute, - CatalogIndexState indstate); + Form_pg_attribute new_attribute, + CatalogIndexState indstate); extern void InsertPgClassTuple(Relation pg_class_desc, Relation new_rel_desc, diff --git a/src/include/catalog/indexing.h b/src/include/catalog/indexing.h index bb5b9eabf6..ce117a8eec 100644 --- a/src/include/catalog/indexing.h +++ b/src/include/catalog/indexing.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/indexing.h,v 1.107 2009/02/09 20:57:59 alvherre Exp $ + * $PostgreSQL: pgsql/src/include/catalog/indexing.h,v 1.108 2009/06/11 14:49:09 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -256,7 +256,7 @@ DECLARE_UNIQUE_INDEX(pg_foreign_data_wrapper_name_index, 548, on pg_foreign_data #define ForeignDataWrapperNameIndexId 548 DECLARE_UNIQUE_INDEX(pg_foreign_server_oid_index, 113, on pg_foreign_server using btree(oid oid_ops)); -#define ForeignServerOidIndexId 113 +#define ForeignServerOidIndexId 113 DECLARE_UNIQUE_INDEX(pg_foreign_server_name_index, 549, on pg_foreign_server using btree(srvname name_ops)); #define ForeignServerNameIndexId 549 diff --git a/src/include/catalog/namespace.h b/src/include/catalog/namespace.h index 802da58857..ed9218c03a 100644 --- a/src/include/catalog/namespace.h +++ b/src/include/catalog/namespace.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/namespace.h,v 1.58 2009/01/01 17:23:56 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/namespace.h,v 1.59 2009/06/11 14:49:09 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -55,8 +55,8 @@ extern Oid TypenameGetTypid(const char *typname); extern bool TypeIsVisible(Oid typid); extern FuncCandidateList FuncnameGetCandidates(List *names, int nargs, - bool expand_variadic, - bool expand_defaults); + bool expand_variadic, + bool expand_defaults); extern bool FunctionIsVisible(Oid funcid); extern Oid OpernameGetOprid(List *names, Oid oprleft, Oid oprright); diff --git a/src/include/catalog/pg_amop.h b/src/include/catalog/pg_amop.h index 191d3fe06c..5600004565 100644 --- a/src/include/catalog/pg_amop.h +++ b/src/include/catalog/pg_amop.h @@ -29,7 +29,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_amop.h,v 1.89 2009/01/01 17:23:56 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_amop.h,v 1.90 2009/06/11 14:49:09 momjian Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -88,89 +88,89 @@ typedef FormData_pg_amop *Form_pg_amop; */ /* default operators int2 */ -DATA(insert ( 1976 21 21 1 95 403 )); -DATA(insert ( 1976 21 21 2 522 403 )); -DATA(insert ( 1976 21 21 3 94 403 )); -DATA(insert ( 1976 21 21 4 524 403 )); -DATA(insert ( 1976 21 21 5 520 403 )); +DATA(insert ( 1976 21 21 1 95 403 )); +DATA(insert ( 1976 21 21 2 522 403 )); +DATA(insert ( 1976 21 21 3 94 403 )); +DATA(insert ( 1976 21 21 4 524 403 )); +DATA(insert ( 1976 21 21 5 520 403 )); /* crosstype operators int24 */ -DATA(insert ( 1976 21 23 1 534 403 )); -DATA(insert ( 1976 21 23 2 540 403 )); -DATA(insert ( 1976 21 23 3 532 403 )); -DATA(insert ( 1976 21 23 4 542 403 )); -DATA(insert ( 1976 21 23 5 536 403 )); +DATA(insert ( 1976 21 23 1 534 403 )); +DATA(insert ( 1976 21 23 2 540 403 )); +DATA(insert ( 1976 21 23 3 532 403 )); +DATA(insert ( 1976 21 23 4 542 403 )); +DATA(insert ( 1976 21 23 5 536 403 )); /* crosstype operators int28 */ -DATA(insert ( 1976 21 20 1 1864 403 )); -DATA(insert ( 1976 21 20 2 1866 403 )); -DATA(insert ( 1976 21 20 3 1862 403 )); -DATA(insert ( 1976 21 20 4 1867 403 )); -DATA(insert ( 1976 21 20 5 1865 403 )); +DATA(insert ( 1976 21 20 1 1864 403 )); +DATA(insert ( 1976 21 20 2 1866 403 )); +DATA(insert ( 1976 21 20 3 1862 403 )); +DATA(insert ( 1976 21 20 4 1867 403 )); +DATA(insert ( 1976 21 20 5 1865 403 )); /* default operators int4 */ -DATA(insert ( 1976 23 23 1 97 403 )); -DATA(insert ( 1976 23 23 2 523 403 )); -DATA(insert ( 1976 23 23 3 96 403 )); -DATA(insert ( 1976 23 23 4 525 403 )); -DATA(insert ( 1976 23 23 5 521 403 )); +DATA(insert ( 1976 23 23 1 97 403 )); +DATA(insert ( 1976 23 23 2 523 403 )); +DATA(insert ( 1976 23 23 3 96 403 )); +DATA(insert ( 1976 23 23 4 525 403 )); +DATA(insert ( 1976 23 23 5 521 403 )); /* crosstype operators int42 */ -DATA(insert ( 1976 23 21 1 535 403 )); -DATA(insert ( 1976 23 21 2 541 403 )); -DATA(insert ( 1976 23 21 3 533 403 )); -DATA(insert ( 1976 23 21 4 543 403 )); -DATA(insert ( 1976 23 21 5 537 403 )); +DATA(insert ( 1976 23 21 1 535 403 )); +DATA(insert ( 1976 23 21 2 541 403 )); +DATA(insert ( 1976 23 21 3 533 403 )); +DATA(insert ( 1976 23 21 4 543 403 )); +DATA(insert ( 1976 23 21 5 537 403 )); /* crosstype operators int48 */ -DATA(insert ( 1976 23 20 1 37 403 )); -DATA(insert ( 1976 23 20 2 80 403 )); -DATA(insert ( 1976 23 20 3 15 403 )); -DATA(insert ( 1976 23 20 4 82 403 )); -DATA(insert ( 1976 23 20 5 76 403 )); +DATA(insert ( 1976 23 20 1 37 403 )); +DATA(insert ( 1976 23 20 2 80 403 )); +DATA(insert ( 1976 23 20 3 15 403 )); +DATA(insert ( 1976 23 20 4 82 403 )); +DATA(insert ( 1976 23 20 5 76 403 )); /* default operators int8 */ -DATA(insert ( 1976 20 20 1 412 403 )); -DATA(insert ( 1976 20 20 2 414 403 )); -DATA(insert ( 1976 20 20 3 410 403 )); -DATA(insert ( 1976 20 20 4 415 403 )); -DATA(insert ( 1976 20 20 5 413 403 )); +DATA(insert ( 1976 20 20 1 412 403 )); +DATA(insert ( 1976 20 20 2 414 403 )); +DATA(insert ( 1976 20 20 3 410 403 )); +DATA(insert ( 1976 20 20 4 415 403 )); +DATA(insert ( 1976 20 20 5 413 403 )); /* crosstype operators int82 */ -DATA(insert ( 1976 20 21 1 1870 403 )); -DATA(insert ( 1976 20 21 2 1872 403 )); -DATA(insert ( 1976 20 21 3 1868 403 )); -DATA(insert ( 1976 20 21 4 1873 403 )); -DATA(insert ( 1976 20 21 5 1871 403 )); +DATA(insert ( 1976 20 21 1 1870 403 )); +DATA(insert ( 1976 20 21 2 1872 403 )); +DATA(insert ( 1976 20 21 3 1868 403 )); +DATA(insert ( 1976 20 21 4 1873 403 )); +DATA(insert ( 1976 20 21 5 1871 403 )); /* crosstype operators int84 */ -DATA(insert ( 1976 20 23 1 418 403 )); -DATA(insert ( 1976 20 23 2 420 403 )); -DATA(insert ( 1976 20 23 3 416 403 )); -DATA(insert ( 1976 20 23 4 430 403 )); -DATA(insert ( 1976 20 23 5 419 403 )); +DATA(insert ( 1976 20 23 1 418 403 )); +DATA(insert ( 1976 20 23 2 420 403 )); +DATA(insert ( 1976 20 23 3 416 403 )); +DATA(insert ( 1976 20 23 4 430 403 )); +DATA(insert ( 1976 20 23 5 419 403 )); /* * btree oid_ops */ -DATA(insert ( 1989 26 26 1 609 403 )); -DATA(insert ( 1989 26 26 2 611 403 )); -DATA(insert ( 1989 26 26 3 607 403 )); -DATA(insert ( 1989 26 26 4 612 403 )); -DATA(insert ( 1989 26 26 5 610 403 )); +DATA(insert ( 1989 26 26 1 609 403 )); +DATA(insert ( 1989 26 26 2 611 403 )); +DATA(insert ( 1989 26 26 3 607 403 )); +DATA(insert ( 1989 26 26 4 612 403 )); +DATA(insert ( 1989 26 26 5 610 403 )); /* * btree tid_ops */ -DATA(insert ( 2789 27 27 1 2799 403 )); -DATA(insert ( 2789 27 27 2 2801 403 )); +DATA(insert ( 2789 27 27 1 2799 403 )); +DATA(insert ( 2789 27 27 2 2801 403 )); DATA(insert ( 2789 27 27 3 387 403 )); -DATA(insert ( 2789 27 27 4 2802 403 )); -DATA(insert ( 2789 27 27 5 2800 403 )); +DATA(insert ( 2789 27 27 4 2802 403 )); +DATA(insert ( 2789 27 27 5 2800 403 )); /* * btree oidvector_ops */ -DATA(insert ( 1991 30 30 1 645 403 )); -DATA(insert ( 1991 30 30 2 647 403 )); -DATA(insert ( 1991 30 30 3 649 403 )); -DATA(insert ( 1991 30 30 4 648 403 )); -DATA(insert ( 1991 30 30 5 646 403 )); +DATA(insert ( 1991 30 30 1 645 403 )); +DATA(insert ( 1991 30 30 2 647 403 )); +DATA(insert ( 1991 30 30 3 649 403 )); +DATA(insert ( 1991 30 30 4 648 403 )); +DATA(insert ( 1991 30 30 5 646 403 )); /* * btree float_ops @@ -215,21 +215,21 @@ DATA(insert ( 429 18 18 5 633 403 )); * btree name_ops */ -DATA(insert ( 1986 19 19 1 660 403 )); -DATA(insert ( 1986 19 19 2 661 403 )); +DATA(insert ( 1986 19 19 1 660 403 )); +DATA(insert ( 1986 19 19 2 661 403 )); DATA(insert ( 1986 19 19 3 93 403 )); -DATA(insert ( 1986 19 19 4 663 403 )); -DATA(insert ( 1986 19 19 5 662 403 )); +DATA(insert ( 1986 19 19 4 663 403 )); +DATA(insert ( 1986 19 19 5 662 403 )); /* * btree text_ops */ -DATA(insert ( 1994 25 25 1 664 403 )); -DATA(insert ( 1994 25 25 2 665 403 )); +DATA(insert ( 1994 25 25 1 664 403 )); +DATA(insert ( 1994 25 25 2 665 403 )); DATA(insert ( 1994 25 25 3 98 403 )); -DATA(insert ( 1994 25 25 4 667 403 )); -DATA(insert ( 1994 25 25 5 666 403 )); +DATA(insert ( 1994 25 25 4 667 403 )); +DATA(insert ( 1994 25 25 5 666 403 )); /* * btree bpchar_ops @@ -324,31 +324,31 @@ DATA(insert ( 434 1184 1114 5 2544 403 )); * btree time_ops */ -DATA(insert ( 1996 1083 1083 1 1110 403 )); -DATA(insert ( 1996 1083 1083 2 1111 403 )); -DATA(insert ( 1996 1083 1083 3 1108 403 )); -DATA(insert ( 1996 1083 1083 4 1113 403 )); -DATA(insert ( 1996 1083 1083 5 1112 403 )); +DATA(insert ( 1996 1083 1083 1 1110 403 )); +DATA(insert ( 1996 1083 1083 2 1111 403 )); +DATA(insert ( 1996 1083 1083 3 1108 403 )); +DATA(insert ( 1996 1083 1083 4 1113 403 )); +DATA(insert ( 1996 1083 1083 5 1112 403 )); /* * btree timetz_ops */ -DATA(insert ( 2000 1266 1266 1 1552 403 )); -DATA(insert ( 2000 1266 1266 2 1553 403 )); -DATA(insert ( 2000 1266 1266 3 1550 403 )); -DATA(insert ( 2000 1266 1266 4 1555 403 )); -DATA(insert ( 2000 1266 1266 5 1554 403 )); +DATA(insert ( 2000 1266 1266 1 1552 403 )); +DATA(insert ( 2000 1266 1266 2 1553 403 )); +DATA(insert ( 2000 1266 1266 3 1550 403 )); +DATA(insert ( 2000 1266 1266 4 1555 403 )); +DATA(insert ( 2000 1266 1266 5 1554 403 )); /* * btree interval_ops */ -DATA(insert ( 1982 1186 1186 1 1332 403 )); -DATA(insert ( 1982 1186 1186 2 1333 403 )); -DATA(insert ( 1982 1186 1186 3 1330 403 )); -DATA(insert ( 1982 1186 1186 4 1335 403 )); -DATA(insert ( 1982 1186 1186 5 1334 403 )); +DATA(insert ( 1982 1186 1186 1 1332 403 )); +DATA(insert ( 1982 1186 1186 2 1333 403 )); +DATA(insert ( 1982 1186 1186 3 1330 403 )); +DATA(insert ( 1982 1186 1186 4 1335 403 )); +DATA(insert ( 1982 1186 1186 5 1334 403 )); /* * btree macaddr @@ -374,11 +374,11 @@ DATA(insert ( 1974 869 869 5 1205 403 )); * btree numeric */ -DATA(insert ( 1988 1700 1700 1 1754 403 )); -DATA(insert ( 1988 1700 1700 2 1755 403 )); -DATA(insert ( 1988 1700 1700 3 1752 403 )); -DATA(insert ( 1988 1700 1700 4 1757 403 )); -DATA(insert ( 1988 1700 1700 5 1756 403 )); +DATA(insert ( 1988 1700 1700 1 1754 403 )); +DATA(insert ( 1988 1700 1700 2 1755 403 )); +DATA(insert ( 1988 1700 1700 3 1752 403 )); +DATA(insert ( 1988 1700 1700 4 1757 403 )); +DATA(insert ( 1988 1700 1700 5 1756 403 )); /* * btree bool @@ -404,31 +404,31 @@ DATA(insert ( 423 1560 1560 5 1787 403 )); * btree varbit */ -DATA(insert ( 2002 1562 1562 1 1806 403 )); -DATA(insert ( 2002 1562 1562 2 1808 403 )); -DATA(insert ( 2002 1562 1562 3 1804 403 )); -DATA(insert ( 2002 1562 1562 4 1809 403 )); -DATA(insert ( 2002 1562 1562 5 1807 403 )); +DATA(insert ( 2002 1562 1562 1 1806 403 )); +DATA(insert ( 2002 1562 1562 2 1808 403 )); +DATA(insert ( 2002 1562 1562 3 1804 403 )); +DATA(insert ( 2002 1562 1562 4 1809 403 )); +DATA(insert ( 2002 1562 1562 5 1807 403 )); /* * btree text pattern */ -DATA(insert ( 2095 25 25 1 2314 403 )); -DATA(insert ( 2095 25 25 2 2315 403 )); +DATA(insert ( 2095 25 25 1 2314 403 )); +DATA(insert ( 2095 25 25 2 2315 403 )); DATA(insert ( 2095 25 25 3 98 403 )); -DATA(insert ( 2095 25 25 4 2317 403 )); -DATA(insert ( 2095 25 25 5 2318 403 )); +DATA(insert ( 2095 25 25 4 2317 403 )); +DATA(insert ( 2095 25 25 5 2318 403 )); /* * btree bpchar pattern */ -DATA(insert ( 2097 1042 1042 1 2326 403 )); -DATA(insert ( 2097 1042 1042 2 2327 403 )); -DATA(insert ( 2097 1042 1042 3 1054 403 )); -DATA(insert ( 2097 1042 1042 4 2329 403 )); -DATA(insert ( 2097 1042 1042 5 2330 403 )); +DATA(insert ( 2097 1042 1042 1 2326 403 )); +DATA(insert ( 2097 1042 1042 2 2327 403 )); +DATA(insert ( 2097 1042 1042 3 1054 403 )); +DATA(insert ( 2097 1042 1042 4 2329 403 )); +DATA(insert ( 2097 1042 1042 5 2330 403 )); /* * btree money_ops @@ -512,41 +512,41 @@ DATA(insert ( 1977 21 21 1 94 405 )); DATA(insert ( 1977 23 23 1 96 405 )); DATA(insert ( 1977 20 20 1 410 405 )); DATA(insert ( 1977 21 23 1 532 405 )); -DATA(insert ( 1977 21 20 1 1862 405 )); +DATA(insert ( 1977 21 20 1 1862 405 )); DATA(insert ( 1977 23 21 1 533 405 )); DATA(insert ( 1977 23 20 1 15 405 )); -DATA(insert ( 1977 20 21 1 1868 405 )); +DATA(insert ( 1977 20 21 1 1868 405 )); DATA(insert ( 1977 20 23 1 416 405 )); /* interval_ops */ -DATA(insert ( 1983 1186 1186 1 1330 405 )); +DATA(insert ( 1983 1186 1186 1 1330 405 )); /* macaddr_ops */ DATA(insert ( 1985 829 829 1 1220 405 )); /* name_ops */ DATA(insert ( 1987 19 19 1 93 405 )); /* oid_ops */ -DATA(insert ( 1990 26 26 1 607 405 )); +DATA(insert ( 1990 26 26 1 607 405 )); /* oidvector_ops */ -DATA(insert ( 1992 30 30 1 649 405 )); +DATA(insert ( 1992 30 30 1 649 405 )); /* text_ops */ DATA(insert ( 1995 25 25 1 98 405 )); /* time_ops */ -DATA(insert ( 1997 1083 1083 1 1108 405 )); +DATA(insert ( 1997 1083 1083 1 1108 405 )); /* timestamptz_ops */ -DATA(insert ( 1999 1184 1184 1 1320 405 )); +DATA(insert ( 1999 1184 1184 1 1320 405 )); /* timetz_ops */ -DATA(insert ( 2001 1266 1266 1 1550 405 )); +DATA(insert ( 2001 1266 1266 1 1550 405 )); /* timestamp_ops */ -DATA(insert ( 2040 1114 1114 1 2060 405 )); +DATA(insert ( 2040 1114 1114 1 2060 405 )); /* bool_ops */ DATA(insert ( 2222 16 16 1 91 405 )); /* bytea_ops */ -DATA(insert ( 2223 17 17 1 1955 405 )); +DATA(insert ( 2223 17 17 1 1955 405 )); /* int2vector_ops */ -DATA(insert ( 2224 22 22 1 386 405 )); +DATA(insert ( 2224 22 22 1 386 405 )); /* xid_ops */ -DATA(insert ( 2225 28 28 1 352 405 )); +DATA(insert ( 2225 28 28 1 352 405 )); /* cid_ops */ -DATA(insert ( 2226 29 29 1 385 405 )); +DATA(insert ( 2226 29 29 1 385 405 )); /* abstime_ops */ DATA(insert ( 2227 702 702 1 560 405 )); /* reltime_ops */ @@ -554,9 +554,9 @@ DATA(insert ( 2228 703 703 1 566 405 )); /* text_pattern_ops */ DATA(insert ( 2229 25 25 1 98 405 )); /* bpchar_pattern_ops */ -DATA(insert ( 2231 1042 1042 1 1054 405 )); +DATA(insert ( 2231 1042 1042 1 1054 405 )); /* aclitem_ops */ -DATA(insert ( 2235 1033 1033 1 974 405 )); +DATA(insert ( 2235 1033 1033 1 974 405 )); /* uuid_ops */ DATA(insert ( 2969 2950 2950 1 2972 405 )); /* numeric_ops */ @@ -646,36 +646,36 @@ DATA(insert ( 3523 3500 3500 1 3516 405 )); /* * btree tsvector_ops */ -DATA(insert ( 3626 3614 3614 1 3627 403 )); -DATA(insert ( 3626 3614 3614 2 3628 403 )); -DATA(insert ( 3626 3614 3614 3 3629 403 )); -DATA(insert ( 3626 3614 3614 4 3631 403 )); -DATA(insert ( 3626 3614 3614 5 3632 403 )); +DATA(insert ( 3626 3614 3614 1 3627 403 )); +DATA(insert ( 3626 3614 3614 2 3628 403 )); +DATA(insert ( 3626 3614 3614 3 3629 403 )); +DATA(insert ( 3626 3614 3614 4 3631 403 )); +DATA(insert ( 3626 3614 3614 5 3632 403 )); /* * GiST tsvector_ops */ -DATA(insert ( 3655 3614 3615 1 3636 783 )); +DATA(insert ( 3655 3614 3615 1 3636 783 )); /* * GIN tsvector_ops */ -DATA(insert ( 3659 3614 3615 1 3636 2742 )); -DATA(insert ( 3659 3614 3615 2 3660 2742 )); +DATA(insert ( 3659 3614 3615 1 3636 2742 )); +DATA(insert ( 3659 3614 3615 2 3660 2742 )); /* * btree tsquery_ops */ -DATA(insert ( 3683 3615 3615 1 3674 403 )); -DATA(insert ( 3683 3615 3615 2 3675 403 )); -DATA(insert ( 3683 3615 3615 3 3676 403 )); -DATA(insert ( 3683 3615 3615 4 3678 403 )); -DATA(insert ( 3683 3615 3615 5 3679 403 )); +DATA(insert ( 3683 3615 3615 1 3674 403 )); +DATA(insert ( 3683 3615 3615 2 3675 403 )); +DATA(insert ( 3683 3615 3615 3 3676 403 )); +DATA(insert ( 3683 3615 3615 4 3678 403 )); +DATA(insert ( 3683 3615 3615 5 3679 403 )); /* * GiST tsquery_ops */ -DATA(insert ( 3702 3615 3615 7 3693 783 )); -DATA(insert ( 3702 3615 3615 8 3694 783 )); +DATA(insert ( 3702 3615 3615 7 3693 783 )); +DATA(insert ( 3702 3615 3615 8 3694 783 )); #endif /* PG_AMOP_H */ diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h index 6fd6a08fb9..b852a28cd5 100644 --- a/src/include/catalog/pg_attribute.h +++ b/src/include/catalog/pg_attribute.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_attribute.h,v 1.147 2009/03/31 17:59:56 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_attribute.h,v 1.148 2009/06/11 14:49:09 momjian Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -157,7 +157,7 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS /* * ATTRIBUTE_FIXED_PART_SIZE is the size of the fixed-layout, - * guaranteed-not-null part of a pg_attribute row. This is in fact as much + * guaranteed-not-null part of a pg_attribute row. This is in fact as much * of the row as gets copied into tuple descriptors, so don't expect you * can access fields beyond attinhcount except in a real tuple! */ @@ -363,7 +363,7 @@ DATA(insert ( 1255 tableoid 26 0 4 -7 0 -1 -1 t p i t f f t 0 _null_)); { 1249, {"attisdropped"}, 16, -1, 1, 15, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \ { 1249, {"attislocal"}, 16, -1, 1, 16, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \ { 1249, {"attinhcount"}, 23, -1, 4, 17, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \ -{ 1249, {"attacl"}, 1034, -1, -1, 18, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } } +{ 1249, {"attacl"}, 1034, -1, -1, 18, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } } DATA(insert ( 1249 attrelid 26 -1 4 1 0 -1 -1 t p i t f f t 0 _null_)); DATA(insert ( 1249 attname 19 -1 NAMEDATALEN 2 0 -1 -1 f p c t f f t 0 _null_)); @@ -409,7 +409,7 @@ DATA(insert ( 1249 tableoid 26 0 4 -7 0 -1 -1 t p i t f f t 0 _null_)); { 1259, {"reltoastidxid"}, 26, -1, 4, 11, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \ { 1259, {"relhasindex"}, 16, -1, 1, 12, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \ { 1259, {"relisshared"}, 16, -1, 1, 13, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \ -{ 1259, {"relistemp"}, 16, -1, 1, 14, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \ +{ 1259, {"relistemp"}, 16, -1, 1, 14, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \ { 1259, {"relkind"}, 18, -1, 1, 15, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \ { 1259, {"relnatts"}, 21, -1, 2, 16, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, { 0 } }, \ { 1259, {"relchecks"}, 21, -1, 2, 17, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, { 0 } }, \ diff --git a/src/include/catalog/pg_cast.h b/src/include/catalog/pg_cast.h index 99558cbf9b..b3b99f23c4 100644 --- a/src/include/catalog/pg_cast.h +++ b/src/include/catalog/pg_cast.h @@ -10,7 +10,7 @@ * * Copyright (c) 2002-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/catalog/pg_cast.h,v 1.41 2009/01/01 17:23:56 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_cast.h,v 1.42 2009/06/11 14:49:09 momjian Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -66,7 +66,7 @@ typedef enum CoercionMethod { COERCION_METHOD_FUNCTION = 'f', /* use a function */ COERCION_METHOD_BINARY = 'b', /* types are binary-compatible */ - COERCION_METHOD_INOUT = 'i' /* use input/output functions */ + COERCION_METHOD_INOUT = 'i' /* use input/output functions */ } CoercionMethod; diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h index 7ad4b42b3c..1aeb324e3b 100644 --- a/src/include/catalog/pg_class.h +++ b/src/include/catalog/pg_class.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_class.h,v 1.113 2009/03/31 17:59:56 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_class.h,v 1.114 2009/06/11 14:49:09 momjian Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -56,7 +56,7 @@ CATALOG(pg_class,1259) BKI_BOOTSTRAP bool relhasoids; /* T if we generate OIDs for rows of rel */ bool relhaspkey; /* has (or has had) PRIMARY KEY index */ bool relhasrules; /* has (or has had) any rules */ - bool relhastriggers; /* has (or has had) any TRIGGERs */ + bool relhastriggers; /* has (or has had) any TRIGGERs */ bool relhassubclass; /* has (or has had) derived classes */ TransactionId relfrozenxid; /* all Xids < this are frozen in this rel */ diff --git a/src/include/catalog/pg_conversion_fn.h b/src/include/catalog/pg_conversion_fn.h index 39abee8377..263c350271 100644 --- a/src/include/catalog/pg_conversion_fn.h +++ b/src/include/catalog/pg_conversion_fn.h @@ -1,13 +1,13 @@ /*------------------------------------------------------------------------- * * pg_conversion_fn.h - * prototypes for functions in catalog/pg_conversion.c + * prototypes for functions in catalog/pg_conversion.c * * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_conversion_fn.h,v 1.3 2009/01/01 17:23:57 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_conversion_fn.h,v 1.4 2009/06/11 14:49:09 momjian Exp $ * *------------------------------------------------------------------------- */ diff --git a/src/include/catalog/pg_foreign_server.h b/src/include/catalog/pg_foreign_server.h index 755b642a5e..44c95ccc20 100644 --- a/src/include/catalog/pg_foreign_server.h +++ b/src/include/catalog/pg_foreign_server.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_foreign_server.h,v 1.2 2009/01/01 17:23:57 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_foreign_server.h,v 1.3 2009/06/11 14:49:09 momjian Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -24,7 +24,7 @@ * typedef struct FormData_pg_foreign_server * ---------------- */ -#define ForeignServerRelationId 1417 +#define ForeignServerRelationId 1417 CATALOG(pg_foreign_server,1417) { diff --git a/src/include/catalog/pg_operator.h b/src/include/catalog/pg_operator.h index e926eace8c..8cea420cd6 100644 --- a/src/include/catalog/pg_operator.h +++ b/src/include/catalog/pg_operator.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_operator.h,v 1.165 2009/01/01 17:23:57 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_operator.h,v 1.166 2009/06/11 14:49:09 momjian Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -105,7 +105,7 @@ DATA(insert OID = 95 ( "<" PGNSP PGUID b f f 21 21 16 520 524 int2lt scalar DATA(insert OID = 96 ( "=" PGNSP PGUID b t t 23 23 16 96 518 int4eq eqsel eqjoinsel )); DATA(insert OID = 97 ( "<" PGNSP PGUID b f f 23 23 16 521 525 int4lt scalarltsel scalarltjoinsel )); DATA(insert OID = 98 ( "=" PGNSP PGUID b t t 25 25 16 98 531 texteq eqsel eqjoinsel )); -#define TextEqualOperator 98 +#define TextEqualOperator 98 DATA(insert OID = 349 ( "||" PGNSP PGUID b f f 2277 2283 2277 0 0 array_append - - )); DATA(insert OID = 374 ( "||" PGNSP PGUID b f f 2283 2277 2277 0 0 array_prepend - - )); diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 01d8021d03..d71623e667 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.543 2009/06/09 19:51:00 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.544 2009/06/11 14:49:09 momjian Exp $ * * NOTES * The script catalog/genbki.sh reads this file and generates .bki @@ -56,7 +56,7 @@ CATALOG(pg_proc,1255) BKI_BOOTSTRAP Oid proallargtypes[1]; /* all param types (NULL if IN only) */ char proargmodes[1]; /* parameter modes (NULL if IN only) */ text proargnames[1]; /* parameter names (NULL if no names) */ - text proargdefaults; /* list of expression trees for argument + text proargdefaults; /* list of expression trees for argument * defaults (NULL if none) */ text prosrc; /* procedure source text */ bytea probin; /* secondary procedure info (can be NULL) */ @@ -197,9 +197,9 @@ DATA(insert OID = 73 ( chargt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "18 DESCR("greater-than"); DATA(insert OID = 74 ( charge PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "18 18" _null_ _null_ _null_ _null_ charge _null_ _null_ _null_ )); DESCR("greater-than-or-equal"); -DATA(insert OID = 77 ( int4 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "18" _null_ _null_ _null_ _null_ chartoi4 _null_ _null_ _null_ )); +DATA(insert OID = 77 ( int4 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "18" _null_ _null_ _null_ _null_ chartoi4 _null_ _null_ _null_ )); DESCR("convert char to int4"); -DATA(insert OID = 78 ( char PGNSP PGUID 12 1 0 0 f f f t f i 1 0 18 "23" _null_ _null_ _null_ _null_ i4tochar _null_ _null_ _null_ )); +DATA(insert OID = 78 ( char PGNSP PGUID 12 1 0 0 f f f t f i 1 0 18 "23" _null_ _null_ _null_ _null_ i4tochar _null_ _null_ _null_ )); DESCR("convert int4 to char"); DATA(insert OID = 79 ( nameregexeq PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ nameregexeq _null_ _null_ _null_ )); @@ -210,7 +210,7 @@ DATA(insert OID = 1254 ( textregexeq PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 DESCR("matches regex., case-sensitive"); DATA(insert OID = 1256 ( textregexne PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ textregexne _null_ _null_ _null_ )); DESCR("does not match regex., case-sensitive"); -DATA(insert OID = 1257 ( textlen PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ textlen _null_ _null_ _null_ )); +DATA(insert OID = 1257 ( textlen PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ textlen _null_ _null_ _null_ )); DESCR("length"); DATA(insert OID = 1258 ( textcat PGNSP PGUID 12 1 0 0 f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ textcat _null_ _null_ _null_ )); DESCR("concatenate"); @@ -251,21 +251,21 @@ DESCR("is above (allows touching)"); DATA(insert OID = 116 ( box_below_eq PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_below_eq _null_ _null_ _null_ )); DESCR("is below (allows touching)"); -DATA(insert OID = 117 ( point_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 600 "2275" _null_ _null_ _null_ _null_ point_in _null_ _null_ _null_ )); +DATA(insert OID = 117 ( point_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 600 "2275" _null_ _null_ _null_ _null_ point_in _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 118 ( point_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "600" _null_ _null_ _null_ _null_ point_out _null_ _null_ _null_ )); +DATA(insert OID = 118 ( point_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "600" _null_ _null_ _null_ _null_ point_out _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 119 ( lseg_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 601 "2275" _null_ _null_ _null_ _null_ lseg_in _null_ _null_ _null_ )); +DATA(insert OID = 119 ( lseg_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 601 "2275" _null_ _null_ _null_ _null_ lseg_in _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 120 ( lseg_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "601" _null_ _null_ _null_ _null_ lseg_out _null_ _null_ _null_ )); +DATA(insert OID = 120 ( lseg_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "601" _null_ _null_ _null_ _null_ lseg_out _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 121 ( path_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 602 "2275" _null_ _null_ _null_ _null_ path_in _null_ _null_ _null_ )); +DATA(insert OID = 121 ( path_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 602 "2275" _null_ _null_ _null_ _null_ path_in _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 122 ( path_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "602" _null_ _null_ _null_ _null_ path_out _null_ _null_ _null_ )); +DATA(insert OID = 122 ( path_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "602" _null_ _null_ _null_ _null_ path_out _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 123 ( box_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 603 "2275" _null_ _null_ _null_ _null_ box_in _null_ _null_ _null_ )); +DATA(insert OID = 123 ( box_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 603 "2275" _null_ _null_ _null_ _null_ box_in _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 124 ( box_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "603" _null_ _null_ _null_ _null_ box_out _null_ _null_ _null_ )); +DATA(insert OID = 124 ( box_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "603" _null_ _null_ _null_ _null_ box_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 125 ( box_overlap PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "603 603" _null_ _null_ _null_ _null_ box_overlap _null_ _null_ _null_ )); DESCR("overlaps"); @@ -398,9 +398,9 @@ DESCR("is contained by?"); /* OIDS 200 - 299 */ -DATA(insert OID = 200 ( float4in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 700 "2275" _null_ _null_ _null_ _null_ float4in _null_ _null_ _null_ )); +DATA(insert OID = 200 ( float4in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 700 "2275" _null_ _null_ _null_ _null_ float4in _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 201 ( float4out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "700" _null_ _null_ _null_ _null_ float4out _null_ _null_ _null_ )); +DATA(insert OID = 201 ( float4out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "700" _null_ _null_ _null_ _null_ float4out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 202 ( float4mul PGNSP PGUID 12 1 0 0 f f f t f i 2 0 700 "700 700" _null_ _null_ _null_ _null_ float4mul _null_ _null_ _null_ )); DESCR("multiply"); @@ -414,21 +414,21 @@ DATA(insert OID = 206 ( float4um PGNSP PGUID 12 1 0 0 f f f t f i 1 0 700 " DESCR("negate"); DATA(insert OID = 207 ( float4abs PGNSP PGUID 12 1 0 0 f f f t f i 1 0 700 "700" _null_ _null_ _null_ _null_ float4abs _null_ _null_ _null_ )); DESCR("absolute value"); -DATA(insert OID = 208 ( float4_accum PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1022 "1022 700" _null_ _null_ _null_ _null_ float4_accum _null_ _null_ _null_ )); +DATA(insert OID = 208 ( float4_accum PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1022 "1022 700" _null_ _null_ _null_ _null_ float4_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 209 ( float4larger PGNSP PGUID 12 1 0 0 f f f t f i 2 0 700 "700 700" _null_ _null_ _null_ _null_ float4larger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 211 ( float4smaller PGNSP PGUID 12 1 0 0 f f f t f i 2 0 700 "700 700" _null_ _null_ _null_ _null_ float4smaller _null_ _null_ _null_ )); DESCR("smaller of two"); -DATA(insert OID = 212 ( int4um PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ int4um _null_ _null_ _null_ )); +DATA(insert OID = 212 ( int4um PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ int4um _null_ _null_ _null_ )); DESCR("negate"); -DATA(insert OID = 213 ( int2um PGNSP PGUID 12 1 0 0 f f f t f i 1 0 21 "21" _null_ _null_ _null_ _null_ int2um _null_ _null_ _null_ )); +DATA(insert OID = 213 ( int2um PGNSP PGUID 12 1 0 0 f f f t f i 1 0 21 "21" _null_ _null_ _null_ _null_ int2um _null_ _null_ _null_ )); DESCR("negate"); -DATA(insert OID = 214 ( float8in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "2275" _null_ _null_ _null_ _null_ float8in _null_ _null_ _null_ )); +DATA(insert OID = 214 ( float8in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "2275" _null_ _null_ _null_ _null_ float8in _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 215 ( float8out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "701" _null_ _null_ _null_ _null_ float8out _null_ _null_ _null_ )); +DATA(insert OID = 215 ( float8out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "701" _null_ _null_ _null_ _null_ float8out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 216 ( float8mul PGNSP PGUID 12 1 0 0 f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ float8mul _null_ _null_ _null_ )); DESCR("multiply"); @@ -442,7 +442,7 @@ DATA(insert OID = 220 ( float8um PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 " DESCR("negate"); DATA(insert OID = 221 ( float8abs PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ float8abs _null_ _null_ _null_ )); DESCR("absolute value"); -DATA(insert OID = 222 ( float8_accum PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1022 "1022 701" _null_ _null_ _null_ _null_ float8_accum _null_ _null_ _null_ )); +DATA(insert OID = 222 ( float8_accum PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1022 "1022 701" _null_ _null_ _null_ _null_ float8_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); DATA(insert OID = 223 ( float8larger PGNSP PGUID 12 1 0 0 f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ float8larger _null_ _null_ _null_ )); DESCR("larger of two"); @@ -489,27 +489,27 @@ DESCR("convert float4 to int2"); DATA(insert OID = 239 ( line_distance PGNSP PGUID 12 1 0 0 f f f t f i 2 0 701 "628 628" _null_ _null_ _null_ _null_ line_distance _null_ _null_ _null_ )); DESCR("distance between"); -DATA(insert OID = 240 ( abstimein PGNSP PGUID 12 1 0 0 f f f t f s 1 0 702 "2275" _null_ _null_ _null_ _null_ abstimein _null_ _null_ _null_ )); +DATA(insert OID = 240 ( abstimein PGNSP PGUID 12 1 0 0 f f f t f s 1 0 702 "2275" _null_ _null_ _null_ _null_ abstimein _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 241 ( abstimeout PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2275 "702" _null_ _null_ _null_ _null_ abstimeout _null_ _null_ _null_ )); +DATA(insert OID = 241 ( abstimeout PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2275 "702" _null_ _null_ _null_ _null_ abstimeout _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 242 ( reltimein PGNSP PGUID 12 1 0 0 f f f t f s 1 0 703 "2275" _null_ _null_ _null_ _null_ reltimein _null_ _null_ _null_ )); +DATA(insert OID = 242 ( reltimein PGNSP PGUID 12 1 0 0 f f f t f s 1 0 703 "2275" _null_ _null_ _null_ _null_ reltimein _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 243 ( reltimeout PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2275 "703" _null_ _null_ _null_ _null_ reltimeout _null_ _null_ _null_ )); +DATA(insert OID = 243 ( reltimeout PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2275 "703" _null_ _null_ _null_ _null_ reltimeout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 244 ( timepl PGNSP PGUID 12 1 0 0 f f f t f i 2 0 702 "702 703" _null_ _null_ _null_ _null_ timepl _null_ _null_ _null_ )); DESCR("add"); DATA(insert OID = 245 ( timemi PGNSP PGUID 12 1 0 0 f f f t f i 2 0 702 "702 703" _null_ _null_ _null_ _null_ timemi _null_ _null_ _null_ )); DESCR("subtract"); -DATA(insert OID = 246 ( tintervalin PGNSP PGUID 12 1 0 0 f f f t f s 1 0 704 "2275" _null_ _null_ _null_ _null_ tintervalin _null_ _null_ _null_ )); +DATA(insert OID = 246 ( tintervalin PGNSP PGUID 12 1 0 0 f f f t f s 1 0 704 "2275" _null_ _null_ _null_ _null_ tintervalin _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 247 ( tintervalout PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2275 "704" _null_ _null_ _null_ _null_ tintervalout _null_ _null_ _null_ )); +DATA(insert OID = 247 ( tintervalout PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2275 "704" _null_ _null_ _null_ _null_ tintervalout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 248 ( intinterval PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "702 704" _null_ _null_ _null_ _null_ intinterval _null_ _null_ _null_ )); DESCR("abstime in tinterval"); DATA(insert OID = 249 ( tintervalrel PGNSP PGUID 12 1 0 0 f f f t f i 1 0 703 "704" _null_ _null_ _null_ _null_ tintervalrel _null_ _null_ _null_ )); DESCR("tinterval to reltime"); -DATA(insert OID = 250 ( timenow PGNSP PGUID 12 1 0 0 f f f t f s 0 0 702 "" _null_ _null_ _null_ _null_ timenow _null_ _null_ _null_ )); +DATA(insert OID = 250 ( timenow PGNSP PGUID 12 1 0 0 f f f t f s 0 0 702 "" _null_ _null_ _null_ _null_ timenow _null_ _null_ _null_ )); DESCR("current date and time (abstime)"); DATA(insert OID = 251 ( abstimeeq PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "702 702" _null_ _null_ _null_ _null_ abstimeeq _null_ _null_ _null_ )); DESCR("equal"); @@ -637,16 +637,16 @@ DATA(insert OID = 309 ( float84gt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 " DESCR("greater-than"); DATA(insert OID = 310 ( float84ge PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "701 700" _null_ _null_ _null_ _null_ float84ge _null_ _null_ _null_ )); DESCR("greater-than-or-equal"); -DATA(insert OID = 320 ( width_bucket PGNSP PGUID 12 1 0 0 f f f t f i 4 0 23 "701 701 701 23" _null_ _null_ _null_ _null_ width_bucket_float8 _null_ _null_ _null_ )); +DATA(insert OID = 320 ( width_bucket PGNSP PGUID 12 1 0 0 f f f t f i 4 0 23 "701 701 701 23" _null_ _null_ _null_ _null_ width_bucket_float8 _null_ _null_ _null_ )); DESCR("bucket number of operand in equidepth histogram"); DATA(insert OID = 311 ( float8 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "700" _null_ _null_ _null_ _null_ ftod _null_ _null_ _null_ )); DESCR("convert float4 to float8"); DATA(insert OID = 312 ( float4 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 700 "701" _null_ _null_ _null_ _null_ dtof _null_ _null_ _null_ )); DESCR("convert float8 to float4"); -DATA(insert OID = 313 ( int4 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "21" _null_ _null_ _null_ _null_ i2toi4 _null_ _null_ _null_ )); +DATA(insert OID = 313 ( int4 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "21" _null_ _null_ _null_ _null_ i2toi4 _null_ _null_ _null_ )); DESCR("convert int2 to int4"); -DATA(insert OID = 314 ( int2 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 21 "23" _null_ _null_ _null_ _null_ i4toi2 _null_ _null_ _null_ )); +DATA(insert OID = 314 ( int2 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 21 "23" _null_ _null_ _null_ _null_ i4toi2 _null_ _null_ _null_ )); DESCR("convert int4 to int2"); DATA(insert OID = 315 ( int2vectoreq PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "22 22" _null_ _null_ _null_ _null_ int2vectoreq _null_ _null_ _null_ )); DESCR("equal"); @@ -659,9 +659,9 @@ DESCR("convert int4 to float4"); DATA(insert OID = 319 ( int4 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "700" _null_ _null_ _null_ _null_ ftoi4 _null_ _null_ _null_ )); DESCR("convert float4 to int4"); -DATA(insert OID = 330 ( btgettuple PGNSP PGUID 12 1 0 0 f f f t f v 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ btgettuple _null_ _null_ _null_ )); +DATA(insert OID = 330 ( btgettuple PGNSP PGUID 12 1 0 0 f f f t f v 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ btgettuple _null_ _null_ _null_ )); DESCR("btree(internal)"); -DATA(insert OID = 636 ( btgetbitmap PGNSP PGUID 12 1 0 0 f f f t f v 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ btgetbitmap _null_ _null_ _null_ )); +DATA(insert OID = 636 ( btgetbitmap PGNSP PGUID 12 1 0 0 f f f t f v 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ btgetbitmap _null_ _null_ _null_ )); DESCR("btree(internal)"); DATA(insert OID = 331 ( btinsert PGNSP PGUID 12 1 0 0 f f f t f v 6 0 16 "2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ btinsert _null_ _null_ _null_ )); DESCR("btree(internal)"); @@ -669,11 +669,11 @@ DATA(insert OID = 333 ( btbeginscan PGNSP PGUID 12 1 0 0 f f f t f v 3 0 228 DESCR("btree(internal)"); DATA(insert OID = 334 ( btrescan PGNSP PGUID 12 1 0 0 f f f t f v 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ btrescan _null_ _null_ _null_ )); DESCR("btree(internal)"); -DATA(insert OID = 335 ( btendscan PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ btendscan _null_ _null_ _null_ )); +DATA(insert OID = 335 ( btendscan PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ btendscan _null_ _null_ _null_ )); DESCR("btree(internal)"); -DATA(insert OID = 336 ( btmarkpos PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ btmarkpos _null_ _null_ _null_ )); +DATA(insert OID = 336 ( btmarkpos PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ btmarkpos _null_ _null_ _null_ )); DESCR("btree(internal)"); -DATA(insert OID = 337 ( btrestrpos PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ btrestrpos _null_ _null_ _null_ )); +DATA(insert OID = 337 ( btrestrpos PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ btrestrpos _null_ _null_ _null_ )); DESCR("btree(internal)"); DATA(insert OID = 338 ( btbuild PGNSP PGUID 12 1 0 0 f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ btbuild _null_ _null_ _null_ )); DESCR("btree(internal)"); @@ -681,7 +681,7 @@ DATA(insert OID = 332 ( btbulkdelete PGNSP PGUID 12 1 0 0 f f f t f v 4 0 22 DESCR("btree(internal)"); DATA(insert OID = 972 ( btvacuumcleanup PGNSP PGUID 12 1 0 0 f f f t f v 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ btvacuumcleanup _null_ _null_ _null_ )); DESCR("btree(internal)"); -DATA(insert OID = 1268 ( btcostestimate PGNSP PGUID 12 1 0 0 f f f t f v 8 0 2278 "2281 2281 2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ btcostestimate _null_ _null_ _null_ )); +DATA(insert OID = 1268 ( btcostestimate PGNSP PGUID 12 1 0 0 f f f t f v 8 0 2278 "2281 2281 2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ btcostestimate _null_ _null_ _null_ )); DESCR("btree(internal)"); DATA(insert OID = 2785 ( btoptions PGNSP PGUID 12 1 0 0 f f f t f s 2 0 17 "1009 16" _null_ _null_ _null_ _null_ btoptions _null_ _null_ _null_ )); DESCR("btree(internal)"); @@ -702,9 +702,9 @@ DATA(insert OID = 345 ( poly_contained PGNSP PGUID 12 1 0 0 f f f t f i 2 0 DESCR("is contained by?"); DATA(insert OID = 346 ( poly_overlap PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "604 604" _null_ _null_ _null_ _null_ poly_overlap _null_ _null_ _null_ )); DESCR("overlaps"); -DATA(insert OID = 347 ( poly_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 604 "2275" _null_ _null_ _null_ _null_ poly_in _null_ _null_ _null_ )); +DATA(insert OID = 347 ( poly_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 604 "2275" _null_ _null_ _null_ _null_ poly_in _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 348 ( poly_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "604" _null_ _null_ _null_ _null_ poly_out _null_ _null_ _null_ )); +DATA(insert OID = 348 ( poly_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "604" _null_ _null_ _null_ _null_ poly_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 350 ( btint2cmp PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "21 21" _null_ _null_ _null_ _null_ btint2cmp _null_ _null_ _null_ )); @@ -778,9 +778,9 @@ DESCR("convert name to char(n)"); DATA(insert OID = 409 ( name PGNSP PGUID 12 1 0 0 f f f t f i 1 0 19 "1042" _null_ _null_ _null_ _null_ bpchar_name _null_ _null_ _null_ )); DESCR("convert char(n) to name"); -DATA(insert OID = 440 ( hashgettuple PGNSP PGUID 12 1 0 0 f f f t f v 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ hashgettuple _null_ _null_ _null_ )); +DATA(insert OID = 440 ( hashgettuple PGNSP PGUID 12 1 0 0 f f f t f v 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ hashgettuple _null_ _null_ _null_ )); DESCR("hash(internal)"); -DATA(insert OID = 637 ( hashgetbitmap PGNSP PGUID 12 1 0 0 f f f t f v 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ hashgetbitmap _null_ _null_ _null_ )); +DATA(insert OID = 637 ( hashgetbitmap PGNSP PGUID 12 1 0 0 f f f t f v 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ hashgetbitmap _null_ _null_ _null_ )); DESCR("hash(internal)"); DATA(insert OID = 441 ( hashinsert PGNSP PGUID 12 1 0 0 f f f t f v 6 0 16 "2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ hashinsert _null_ _null_ _null_ )); DESCR("hash(internal)"); @@ -788,11 +788,11 @@ DATA(insert OID = 443 ( hashbeginscan PGNSP PGUID 12 1 0 0 f f f t f v 3 0 2 DESCR("hash(internal)"); DATA(insert OID = 444 ( hashrescan PGNSP PGUID 12 1 0 0 f f f t f v 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ hashrescan _null_ _null_ _null_ )); DESCR("hash(internal)"); -DATA(insert OID = 445 ( hashendscan PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ hashendscan _null_ _null_ _null_ )); +DATA(insert OID = 445 ( hashendscan PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ hashendscan _null_ _null_ _null_ )); DESCR("hash(internal)"); -DATA(insert OID = 446 ( hashmarkpos PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ hashmarkpos _null_ _null_ _null_ )); +DATA(insert OID = 446 ( hashmarkpos PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ hashmarkpos _null_ _null_ _null_ )); DESCR("hash(internal)"); -DATA(insert OID = 447 ( hashrestrpos PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ hashrestrpos _null_ _null_ _null_ )); +DATA(insert OID = 447 ( hashrestrpos PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ hashrestrpos _null_ _null_ _null_ )); DESCR("hash(internal)"); DATA(insert OID = 448 ( hashbuild PGNSP PGUID 12 1 0 0 f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ hashbuild _null_ _null_ _null_ )); DESCR("hash(internal)"); @@ -800,36 +800,36 @@ DATA(insert OID = 442 ( hashbulkdelete PGNSP PGUID 12 1 0 0 f f f t f v 4 0 DESCR("hash(internal)"); DATA(insert OID = 425 ( hashvacuumcleanup PGNSP PGUID 12 1 0 0 f f f t f v 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ hashvacuumcleanup _null_ _null_ _null_ )); DESCR("hash(internal)"); -DATA(insert OID = 438 ( hashcostestimate PGNSP PGUID 12 1 0 0 f f f t f v 8 0 2278 "2281 2281 2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ hashcostestimate _null_ _null_ _null_ )); +DATA(insert OID = 438 ( hashcostestimate PGNSP PGUID 12 1 0 0 f f f t f v 8 0 2278 "2281 2281 2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ hashcostestimate _null_ _null_ _null_ )); DESCR("hash(internal)"); DATA(insert OID = 2786 ( hashoptions PGNSP PGUID 12 1 0 0 f f f t f s 2 0 17 "1009 16" _null_ _null_ _null_ _null_ hashoptions _null_ _null_ _null_ )); DESCR("hash(internal)"); -DATA(insert OID = 449 ( hashint2 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "21" _null_ _null_ _null_ _null_ hashint2 _null_ _null_ _null_ )); +DATA(insert OID = 449 ( hashint2 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "21" _null_ _null_ _null_ _null_ hashint2 _null_ _null_ _null_ )); DESCR("hash"); -DATA(insert OID = 450 ( hashint4 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ hashint4 _null_ _null_ _null_ )); +DATA(insert OID = 450 ( hashint4 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ hashint4 _null_ _null_ _null_ )); DESCR("hash"); -DATA(insert OID = 949 ( hashint8 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "20" _null_ _null_ _null_ _null_ hashint8 _null_ _null_ _null_ )); +DATA(insert OID = 949 ( hashint8 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "20" _null_ _null_ _null_ _null_ hashint8 _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 451 ( hashfloat4 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "700" _null_ _null_ _null_ _null_ hashfloat4 _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 452 ( hashfloat8 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "701" _null_ _null_ _null_ _null_ hashfloat8 _null_ _null_ _null_ )); DESCR("hash"); -DATA(insert OID = 453 ( hashoid PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "26" _null_ _null_ _null_ _null_ hashoid _null_ _null_ _null_ )); +DATA(insert OID = 453 ( hashoid PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "26" _null_ _null_ _null_ _null_ hashoid _null_ _null_ _null_ )); DESCR("hash"); -DATA(insert OID = 454 ( hashchar PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "18" _null_ _null_ _null_ _null_ hashchar _null_ _null_ _null_ )); +DATA(insert OID = 454 ( hashchar PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "18" _null_ _null_ _null_ _null_ hashchar _null_ _null_ _null_ )); DESCR("hash"); -DATA(insert OID = 455 ( hashname PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "19" _null_ _null_ _null_ _null_ hashname _null_ _null_ _null_ )); +DATA(insert OID = 455 ( hashname PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "19" _null_ _null_ _null_ _null_ hashname _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 400 ( hashtext PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ hashtext _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 456 ( hashvarlena PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "2281" _null_ _null_ _null_ _null_ hashvarlena _null_ _null_ _null_ )); DESCR("hash any varlena type"); -DATA(insert OID = 457 ( hashoidvector PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "30" _null_ _null_ _null_ _null_ hashoidvector _null_ _null_ _null_ )); +DATA(insert OID = 457 ( hashoidvector PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "30" _null_ _null_ _null_ _null_ hashoidvector _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 329 ( hash_aclitem PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "1033" _null_ _null_ _null_ _null_ hash_aclitem _null_ _null_ _null_ )); DESCR("hash"); -DATA(insert OID = 398 ( hashint2vector PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "22" _null_ _null_ _null_ _null_ hashint2vector _null_ _null_ _null_ )); +DATA(insert OID = 398 ( hashint2vector PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "22" _null_ _null_ _null_ _null_ hashint2vector _null_ _null_ _null_ )); DESCR("hash"); DATA(insert OID = 399 ( hashmacaddr PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "829" _null_ _null_ _null_ _null_ hashmacaddr _null_ _null_ _null_ )); DESCR("hash"); @@ -846,7 +846,7 @@ DATA(insert OID = 460 ( int8in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 20 "22 DESCR("I/O"); DATA(insert OID = 461 ( int8out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "20" _null_ _null_ _null_ _null_ int8out _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 462 ( int8um PGNSP PGUID 12 1 0 0 f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ int8um _null_ _null_ _null_ )); +DATA(insert OID = 462 ( int8um PGNSP PGUID 12 1 0 0 f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ int8um _null_ _null_ _null_ )); DESCR("negate"); DATA(insert OID = 463 ( int8pl PGNSP PGUID 12 1 0 0 f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ int8pl _null_ _null_ _null_ )); DESCR("add"); @@ -944,7 +944,7 @@ DESCR("less-than"); DATA(insert OID = 717 ( oidle PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "26 26" _null_ _null_ _null_ _null_ oidle _null_ _null_ _null_ )); DESCR("less-than-or-equal"); -DATA(insert OID = 720 ( octet_length PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "17" _null_ _null_ _null_ _null_ byteaoctetlen _null_ _null_ _null_ )); +DATA(insert OID = 720 ( octet_length PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "17" _null_ _null_ _null_ _null_ byteaoctetlen _null_ _null_ _null_ )); DESCR("octet length"); DATA(insert OID = 721 ( get_byte PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "17 23" _null_ _null_ _null_ _null_ byteaGetByte _null_ _null_ _null_ )); DESCR("get byte"); @@ -997,13 +997,13 @@ DATA(insert OID = 747 ( array_dims PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 DESCR("array dimensions"); DATA(insert OID = 750 ( array_in PGNSP PGUID 12 1 0 0 f f f t f s 3 0 2277 "2275 26 23" _null_ _null_ _null_ _null_ array_in _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 751 ( array_out PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2275 "2277" _null_ _null_ _null_ _null_ array_out _null_ _null_ _null_ )); +DATA(insert OID = 751 ( array_out PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2275 "2277" _null_ _null_ _null_ _null_ array_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2091 ( array_lower PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "2277 23" _null_ _null_ _null_ _null_ array_lower _null_ _null_ _null_ )); DESCR("array lower dimension"); DATA(insert OID = 2092 ( array_upper PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "2277 23" _null_ _null_ _null_ _null_ array_upper _null_ _null_ _null_ )); DESCR("array upper dimension"); -DATA(insert OID = 2176 ( array_length PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "2277 23" _null_ _null_ _null_ _null_ array_length _null_ _null_ _null_ )); +DATA(insert OID = 2176 ( array_length PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "2277 23" _null_ _null_ _null_ _null_ array_length _null_ _null_ _null_ )); DESCR("array length"); DATA(insert OID = 378 ( array_append PGNSP PGUID 12 1 0 0 f f f f f i 2 0 2277 "2277 2283" _null_ _null_ _null_ _null_ array_push _null_ _null_ _null_ )); DESCR("append element onto end of array"); @@ -1033,26 +1033,26 @@ DATA(insert OID = 2333 ( array_agg_transfn PGNSP PGUID 12 1 0 0 f f f f f i 2 DESCR("array_agg transition function"); DATA(insert OID = 2334 ( array_agg_finalfn PGNSP PGUID 12 1 0 0 f f f f f i 1 0 2277 "2281" _null_ _null_ _null_ _null_ array_agg_finalfn _null_ _null_ _null_ )); DESCR("array_agg final function"); -DATA(insert OID = 2335 ( array_agg PGNSP PGUID 12 1 0 0 t f f f f i 1 0 2277 "2283" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2335 ( array_agg PGNSP PGUID 12 1 0 0 t f f f f i 1 0 2277 "2283" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("concatenate aggregate input into an array"); -DATA(insert OID = 760 ( smgrin PGNSP PGUID 12 1 0 0 f f f t f s 1 0 210 "2275" _null_ _null_ _null_ _null_ smgrin _null_ _null_ _null_ )); +DATA(insert OID = 760 ( smgrin PGNSP PGUID 12 1 0 0 f f f t f s 1 0 210 "2275" _null_ _null_ _null_ _null_ smgrin _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 761 ( smgrout PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2275 "210" _null_ _null_ _null_ _null_ smgrout _null_ _null_ _null_ )); +DATA(insert OID = 761 ( smgrout PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2275 "210" _null_ _null_ _null_ _null_ smgrout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 762 ( smgreq PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "210 210" _null_ _null_ _null_ _null_ smgreq _null_ _null_ _null_ )); DESCR("storage manager"); DATA(insert OID = 763 ( smgrne PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "210 210" _null_ _null_ _null_ _null_ smgrne _null_ _null_ _null_ )); DESCR("storage manager"); -DATA(insert OID = 764 ( lo_import PGNSP PGUID 12 1 0 0 f f f t f v 1 0 26 "25" _null_ _null_ _null_ _null_ lo_import _null_ _null_ _null_ )); +DATA(insert OID = 764 ( lo_import PGNSP PGUID 12 1 0 0 f f f t f v 1 0 26 "25" _null_ _null_ _null_ _null_ lo_import _null_ _null_ _null_ )); DESCR("large object import"); DATA(insert OID = 767 ( lo_import PGNSP PGUID 12 1 0 0 f f f t f v 2 0 26 "25 26" _null_ _null_ _null_ _null_ lo_import_with_oid _null_ _null_ _null_ )); DESCR("large object import"); DATA(insert OID = 765 ( lo_export PGNSP PGUID 12 1 0 0 f f f t f v 2 0 23 "26 25" _null_ _null_ _null_ _null_ lo_export _null_ _null_ _null_ )); DESCR("large object export"); -DATA(insert OID = 766 ( int4inc PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ int4inc _null_ _null_ _null_ )); +DATA(insert OID = 766 ( int4inc PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ int4inc _null_ _null_ _null_ )); DESCR("increment"); DATA(insert OID = 768 ( int4larger PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ int4larger _null_ _null_ _null_ )); DESCR("larger of two"); @@ -1063,9 +1063,9 @@ DESCR("larger of two"); DATA(insert OID = 771 ( int2smaller PGNSP PGUID 12 1 0 0 f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ int2smaller _null_ _null_ _null_ )); DESCR("smaller of two"); -DATA(insert OID = 774 ( gistgettuple PGNSP PGUID 12 1 0 0 f f f t f v 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ gistgettuple _null_ _null_ _null_ )); +DATA(insert OID = 774 ( gistgettuple PGNSP PGUID 12 1 0 0 f f f t f v 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ gistgettuple _null_ _null_ _null_ )); DESCR("gist(internal)"); -DATA(insert OID = 638 ( gistgetbitmap PGNSP PGUID 12 1 0 0 f f f t f v 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ gistgetbitmap _null_ _null_ _null_ )); +DATA(insert OID = 638 ( gistgetbitmap PGNSP PGUID 12 1 0 0 f f f t f v 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ gistgetbitmap _null_ _null_ _null_ )); DESCR("gist(internal)"); DATA(insert OID = 775 ( gistinsert PGNSP PGUID 12 1 0 0 f f f t f v 6 0 16 "2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ gistinsert _null_ _null_ _null_ )); DESCR("gist(internal)"); @@ -1073,11 +1073,11 @@ DATA(insert OID = 777 ( gistbeginscan PGNSP PGUID 12 1 0 0 f f f t f v 3 0 2 DESCR("gist(internal)"); DATA(insert OID = 778 ( gistrescan PGNSP PGUID 12 1 0 0 f f f t f v 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ gistrescan _null_ _null_ _null_ )); DESCR("gist(internal)"); -DATA(insert OID = 779 ( gistendscan PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ gistendscan _null_ _null_ _null_ )); +DATA(insert OID = 779 ( gistendscan PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ gistendscan _null_ _null_ _null_ )); DESCR("gist(internal)"); -DATA(insert OID = 780 ( gistmarkpos PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ gistmarkpos _null_ _null_ _null_ )); +DATA(insert OID = 780 ( gistmarkpos PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ gistmarkpos _null_ _null_ _null_ )); DESCR("gist(internal)"); -DATA(insert OID = 781 ( gistrestrpos PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ gistrestrpos _null_ _null_ _null_ )); +DATA(insert OID = 781 ( gistrestrpos PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ gistrestrpos _null_ _null_ _null_ )); DESCR("gist(internal)"); DATA(insert OID = 782 ( gistbuild PGNSP PGUID 12 1 0 0 f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ gistbuild _null_ _null_ _null_ )); DESCR("gist(internal)"); @@ -1085,7 +1085,7 @@ DATA(insert OID = 776 ( gistbulkdelete PGNSP PGUID 12 1 0 0 f f f t f v 4 0 DESCR("gist(internal)"); DATA(insert OID = 2561 ( gistvacuumcleanup PGNSP PGUID 12 1 0 0 f f f t f v 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ gistvacuumcleanup _null_ _null_ _null_ )); DESCR("gist(internal)"); -DATA(insert OID = 772 ( gistcostestimate PGNSP PGUID 12 1 0 0 f f f t f v 8 0 2278 "2281 2281 2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ gistcostestimate _null_ _null_ _null_ )); +DATA(insert OID = 772 ( gistcostestimate PGNSP PGUID 12 1 0 0 f f f t f v 8 0 2278 "2281 2281 2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ gistcostestimate _null_ _null_ _null_ )); DESCR("gist(internal)"); DATA(insert OID = 2787 ( gistoptions PGNSP PGUID 12 1 0 0 f f f t f s 2 0 17 "1009 16" _null_ _null_ _null_ _null_ gistoptions _null_ _null_ _null_ )); DESCR("gist(internal)"); @@ -1142,7 +1142,7 @@ DESCR("convert char to char()"); DATA(insert OID = 861 ( current_database PGNSP PGUID 12 1 0 0 f f f t f s 0 0 19 "" _null_ _null_ _null_ _null_ current_database _null_ _null_ _null_ )); DESCR("returns the current database"); -DATA(insert OID = 817 ( current_query PGNSP PGUID 12 1 0 0 f f f f f v 0 0 25 "" _null_ _null_ _null_ _null_ current_query _null_ _null_ _null_ )); +DATA(insert OID = 817 ( current_query PGNSP PGUID 12 1 0 0 f f f f f v 0 0 25 "" _null_ _null_ _null_ _null_ current_query _null_ _null_ _null_ )); DESCR("returns the currently executing query"); DATA(insert OID = 862 ( int4_mul_cash PGNSP PGUID 12 1 0 0 f f f t f i 2 0 790 "23 790" _null_ _null_ _null_ _null_ int4_mul_cash _null_ _null_ _null_ )); @@ -1158,9 +1158,9 @@ DESCR("multiply"); DATA(insert OID = 867 ( cash_div_int2 PGNSP PGUID 12 1 0 0 f f f t f i 2 0 790 "790 21" _null_ _null_ _null_ _null_ cash_div_int2 _null_ _null_ _null_ )); DESCR("divide"); -DATA(insert OID = 886 ( cash_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 790 "2275" _null_ _null_ _null_ _null_ cash_in _null_ _null_ _null_ )); +DATA(insert OID = 886 ( cash_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 790 "2275" _null_ _null_ _null_ _null_ cash_in _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 887 ( cash_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "790" _null_ _null_ _null_ _null_ cash_out _null_ _null_ _null_ )); +DATA(insert OID = 887 ( cash_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "790" _null_ _null_ _null_ _null_ cash_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 888 ( cash_eq PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "790 790" _null_ _null_ _null_ _null_ cash_eq _null_ _null_ _null_ )); DESCR("equal"); @@ -1203,14 +1203,14 @@ DESCR("modulus"); DATA(insert OID = 947 ( mod PGNSP PGUID 12 1 0 0 f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ int8mod _null_ _null_ _null_ )); DESCR("modulus"); -DATA(insert OID = 944 ( char PGNSP PGUID 12 1 0 0 f f f t f i 1 0 18 "25" _null_ _null_ _null_ _null_ text_char _null_ _null_ _null_ )); +DATA(insert OID = 944 ( char PGNSP PGUID 12 1 0 0 f f f t f i 1 0 18 "25" _null_ _null_ _null_ _null_ text_char _null_ _null_ _null_ )); DESCR("convert text to char"); -DATA(insert OID = 946 ( text PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "18" _null_ _null_ _null_ _null_ char_text _null_ _null_ _null_ )); +DATA(insert OID = 946 ( text PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "18" _null_ _null_ _null_ _null_ char_text _null_ _null_ _null_ )); DESCR("convert char to text"); DATA(insert OID = 952 ( lo_open PGNSP PGUID 12 1 0 0 f f f t f v 2 0 23 "26 23" _null_ _null_ _null_ _null_ lo_open _null_ _null_ _null_ )); DESCR("large object open"); -DATA(insert OID = 953 ( lo_close PGNSP PGUID 12 1 0 0 f f f t f v 1 0 23 "23" _null_ _null_ _null_ _null_ lo_close _null_ _null_ _null_ )); +DATA(insert OID = 953 ( lo_close PGNSP PGUID 12 1 0 0 f f f t f v 1 0 23 "23" _null_ _null_ _null_ _null_ lo_close _null_ _null_ _null_ )); DESCR("large object close"); DATA(insert OID = 954 ( loread PGNSP PGUID 12 1 0 0 f f f t f v 2 0 17 "23 23" _null_ _null_ _null_ _null_ loread _null_ _null_ _null_ )); DESCR("large object read"); @@ -1218,11 +1218,11 @@ DATA(insert OID = 955 ( lowrite PGNSP PGUID 12 1 0 0 f f f t f v 2 0 23 "23 DESCR("large object write"); DATA(insert OID = 956 ( lo_lseek PGNSP PGUID 12 1 0 0 f f f t f v 3 0 23 "23 23 23" _null_ _null_ _null_ _null_ lo_lseek _null_ _null_ _null_ )); DESCR("large object seek"); -DATA(insert OID = 957 ( lo_creat PGNSP PGUID 12 1 0 0 f f f t f v 1 0 26 "23" _null_ _null_ _null_ _null_ lo_creat _null_ _null_ _null_ )); +DATA(insert OID = 957 ( lo_creat PGNSP PGUID 12 1 0 0 f f f t f v 1 0 26 "23" _null_ _null_ _null_ _null_ lo_creat _null_ _null_ _null_ )); DESCR("large object create"); -DATA(insert OID = 715 ( lo_create PGNSP PGUID 12 1 0 0 f f f t f v 1 0 26 "26" _null_ _null_ _null_ _null_ lo_create _null_ _null_ _null_ )); +DATA(insert OID = 715 ( lo_create PGNSP PGUID 12 1 0 0 f f f t f v 1 0 26 "26" _null_ _null_ _null_ _null_ lo_create _null_ _null_ _null_ )); DESCR("large object create"); -DATA(insert OID = 958 ( lo_tell PGNSP PGUID 12 1 0 0 f f f t f v 1 0 23 "23" _null_ _null_ _null_ _null_ lo_tell _null_ _null_ _null_ )); +DATA(insert OID = 958 ( lo_tell PGNSP PGUID 12 1 0 0 f f f t f v 1 0 23 "23" _null_ _null_ _null_ _null_ lo_tell _null_ _null_ _null_ )); DESCR("large object position"); DATA(insert OID = 1004 ( lo_truncate PGNSP PGUID 12 1 0 0 f f f t f v 2 0 23 "23 23" _null_ _null_ _null_ _null_ lo_truncate _null_ _null_ _null_ )); DESCR("truncate large object"); @@ -1299,9 +1299,9 @@ DESCR("equal"); DATA(insert OID = 1026 ( timezone PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1114 "1186 1184" _null_ _null_ _null_ _null_ timestamptz_izone _null_ _null_ _null_ )); DESCR("adjust timestamp to new time zone"); -DATA(insert OID = 1031 ( aclitemin PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1033 "2275" _null_ _null_ _null_ _null_ aclitemin _null_ _null_ _null_ )); +DATA(insert OID = 1031 ( aclitemin PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1033 "2275" _null_ _null_ _null_ _null_ aclitemin _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 1032 ( aclitemout PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2275 "1033" _null_ _null_ _null_ _null_ aclitemout _null_ _null_ _null_ )); +DATA(insert OID = 1032 ( aclitemout PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2275 "1033" _null_ _null_ _null_ _null_ aclitemout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1035 ( aclinsert PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1034 "1034 1033" _null_ _null_ _null_ _null_ aclinsert _null_ _null_ _null_ )); DESCR("add/update ACL item"); @@ -1315,7 +1315,7 @@ DATA(insert OID = 1365 ( makeaclitem PGNSP PGUID 12 1 0 0 f f f t f i 4 0 10 DESCR("make ACL item"); DATA(insert OID = 1044 ( bpcharin PGNSP PGUID 12 1 0 0 f f f t f i 3 0 1042 "2275 26 23" _null_ _null_ _null_ _null_ bpcharin _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 1045 ( bpcharout PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "1042" _null_ _null_ _null_ _null_ bpcharout _null_ _null_ _null_ )); +DATA(insert OID = 1045 ( bpcharout PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "1042" _null_ _null_ _null_ _null_ bpcharout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2913 ( bpchartypmodin PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ bpchartypmodin _null_ _null_ _null_ )); DESCR("I/O typmod"); @@ -1323,7 +1323,7 @@ DATA(insert OID = 2914 ( bpchartypmodout PGNSP PGUID 12 1 0 0 f f f t f i 1 0 DESCR("I/O typmod"); DATA(insert OID = 1046 ( varcharin PGNSP PGUID 12 1 0 0 f f f t f i 3 0 1043 "2275 26 23" _null_ _null_ _null_ _null_ varcharin _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 1047 ( varcharout PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "1043" _null_ _null_ _null_ _null_ varcharout _null_ _null_ _null_ )); +DATA(insert OID = 1047 ( varcharout PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "1043" _null_ _null_ _null_ _null_ varcharout _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2915 ( varchartypmodin PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ varchartypmodin _null_ _null_ _null_ )); DESCR("I/O typmod"); @@ -1351,9 +1351,9 @@ DATA(insert OID = 1080 ( hashbpchar PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 DESCR("hash"); DATA(insert OID = 1081 ( format_type PGNSP PGUID 12 1 0 0 f f f f f s 2 0 25 "26 23" _null_ _null_ _null_ _null_ format_type _null_ _null_ _null_ )); DESCR("format a type oid and atttypmod to canonical SQL"); -DATA(insert OID = 1084 ( date_in PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1082 "2275" _null_ _null_ _null_ _null_ date_in _null_ _null_ _null_ )); +DATA(insert OID = 1084 ( date_in PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1082 "2275" _null_ _null_ _null_ _null_ date_in _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 1085 ( date_out PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2275 "1082" _null_ _null_ _null_ _null_ date_out _null_ _null_ _null_ )); +DATA(insert OID = 1085 ( date_out PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2275 "1082" _null_ _null_ _null_ _null_ date_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1086 ( date_eq PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1082 1082" _null_ _null_ _null_ _null_ date_eq _null_ _null_ _null_ )); DESCR("equal"); @@ -1396,7 +1396,7 @@ DATA(insert OID = 1142 ( date_mii PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1082 DESCR("subtract"); DATA(insert OID = 1143 ( time_in PGNSP PGUID 12 1 0 0 f f f t f s 3 0 1083 "2275 26 23" _null_ _null_ _null_ _null_ time_in _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 1144 ( time_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "1083" _null_ _null_ _null_ _null_ time_out _null_ _null_ _null_ )); +DATA(insert OID = 1144 ( time_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "1083" _null_ _null_ _null_ _null_ time_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2909 ( timetypmodin PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ timetypmodin _null_ _null_ _null_ )); DESCR("I/O typmod"); @@ -1416,7 +1416,7 @@ DESCR("divide"); DATA(insert OID = 1150 ( timestamptz_in PGNSP PGUID 12 1 0 0 f f f t f s 3 0 1184 "2275 26 23" _null_ _null_ _null_ _null_ timestamptz_in _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 1151 ( timestamptz_out PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2275 "1184" _null_ _null_ _null_ _null_ timestamptz_out _null_ _null_ _null_ )); +DATA(insert OID = 1151 ( timestamptz_out PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2275 "1184" _null_ _null_ _null_ _null_ timestamptz_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2907 ( timestamptztypmodin PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ timestamptztypmodin _null_ _null_ _null_ )); DESCR("I/O typmod"); @@ -1436,12 +1436,12 @@ DATA(insert OID = 1157 ( timestamptz_gt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 DESCR("greater-than"); DATA(insert OID = 1158 ( to_timestamp PGNSP PGUID 14 1 0 0 f f f t f i 1 0 1184 "701" _null_ _null_ _null_ _null_ "select (''epoch''::pg_catalog.timestamptz + $1 * ''1 second''::pg_catalog.interval)" _null_ _null_ _null_ )); DESCR("convert UNIX epoch to timestamptz"); -DATA(insert OID = 1159 ( timezone PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1114 "25 1184" _null_ _null_ _null_ _null_ timestamptz_zone _null_ _null_ _null_ )); +DATA(insert OID = 1159 ( timezone PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1114 "25 1184" _null_ _null_ _null_ _null_ timestamptz_zone _null_ _null_ _null_ )); DESCR("adjust timestamp to new time zone"); DATA(insert OID = 1160 ( interval_in PGNSP PGUID 12 1 0 0 f f f t f s 3 0 1186 "2275 26 23" _null_ _null_ _null_ _null_ interval_in _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 1161 ( interval_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "1186" _null_ _null_ _null_ _null_ interval_out _null_ _null_ _null_ )); +DATA(insert OID = 1161 ( interval_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "1186" _null_ _null_ _null_ _null_ interval_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2903 ( intervaltypmodin PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ intervaltypmodin _null_ _null_ _null_ )); DESCR("I/O typmod"); @@ -1459,7 +1459,7 @@ DATA(insert OID = 1166 ( interval_ge PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 DESCR("greater-than-or-equal"); DATA(insert OID = 1167 ( interval_gt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1186 1186" _null_ _null_ _null_ _null_ interval_gt _null_ _null_ _null_ )); DESCR("greater-than"); -DATA(insert OID = 1168 ( interval_um PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ interval_um _null_ _null_ _null_ )); +DATA(insert OID = 1168 ( interval_um PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ interval_um _null_ _null_ _null_ )); DESCR("subtract"); DATA(insert OID = 1169 ( interval_pl PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1186 "1186 1186" _null_ _null_ _null_ _null_ interval_pl _null_ _null_ _null_ )); DESCR("add"); @@ -1471,38 +1471,38 @@ DATA(insert OID = 1172 ( date_part PGNSP PGUID 12 1 0 0 f f f t f i 2 0 701 DESCR("extract field from interval"); DATA(insert OID = 1173 ( timestamptz PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1184 "702" _null_ _null_ _null_ _null_ abstime_timestamptz _null_ _null_ _null_ )); DESCR("convert abstime to timestamp with time zone"); -DATA(insert OID = 1174 ( timestamptz PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1184 "1082" _null_ _null_ _null_ _null_ date_timestamptz _null_ _null_ _null_ )); +DATA(insert OID = 1174 ( timestamptz PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1184 "1082" _null_ _null_ _null_ _null_ date_timestamptz _null_ _null_ _null_ )); DESCR("convert date to timestamp with time zone"); -DATA(insert OID = 2711 ( justify_interval PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ interval_justify_interval _null_ _null_ _null_ )); +DATA(insert OID = 2711 ( justify_interval PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ interval_justify_interval _null_ _null_ _null_ )); DESCR("promote groups of 24 hours to numbers of days and promote groups of 30 days to numbers of months"); -DATA(insert OID = 1175 ( justify_hours PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ interval_justify_hours _null_ _null_ _null_ )); +DATA(insert OID = 1175 ( justify_hours PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ interval_justify_hours _null_ _null_ _null_ )); DESCR("promote groups of 24 hours to numbers of days"); -DATA(insert OID = 1295 ( justify_days PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ interval_justify_days _null_ _null_ _null_ )); +DATA(insert OID = 1295 ( justify_days PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ interval_justify_days _null_ _null_ _null_ )); DESCR("promote groups of 30 days to numbers of months"); DATA(insert OID = 1176 ( timestamptz PGNSP PGUID 14 1 0 0 f f f t f s 2 0 1184 "1082 1083" _null_ _null_ _null_ _null_ "select cast(($1 + $2) as timestamp with time zone)" _null_ _null_ _null_ )); DESCR("convert date and time to timestamp with time zone"); DATA(insert OID = 1177 ( interval PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1186 "703" _null_ _null_ _null_ _null_ reltime_interval _null_ _null_ _null_ )); DESCR("convert reltime to interval"); -DATA(insert OID = 1178 ( date PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1082 "1184" _null_ _null_ _null_ _null_ timestamptz_date _null_ _null_ _null_ )); +DATA(insert OID = 1178 ( date PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1082 "1184" _null_ _null_ _null_ _null_ timestamptz_date _null_ _null_ _null_ )); DESCR("convert timestamp with time zone to date"); DATA(insert OID = 1179 ( date PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1082 "702" _null_ _null_ _null_ _null_ abstime_date _null_ _null_ _null_ )); DESCR("convert abstime to date"); DATA(insert OID = 1180 ( abstime PGNSP PGUID 12 1 0 0 f f f t f i 1 0 702 "1184" _null_ _null_ _null_ _null_ timestamptz_abstime _null_ _null_ _null_ )); DESCR("convert timestamp with time zone to abstime"); -DATA(insert OID = 1181 ( age PGNSP PGUID 12 1 0 0 f f f t f s 1 0 23 "28" _null_ _null_ _null_ _null_ xid_age _null_ _null_ _null_ )); +DATA(insert OID = 1181 ( age PGNSP PGUID 12 1 0 0 f f f t f s 1 0 23 "28" _null_ _null_ _null_ _null_ xid_age _null_ _null_ _null_ )); DESCR("age of a transaction ID, in transactions before current transaction"); DATA(insert OID = 1188 ( timestamptz_mi PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1186 "1184 1184" _null_ _null_ _null_ _null_ timestamp_mi _null_ _null_ _null_ )); DESCR("subtract"); -DATA(insert OID = 1189 ( timestamptz_pl_interval PGNSP PGUID 12 1 0 0 f f f t f s 2 0 1184 "1184 1186" _null_ _null_ _null_ _null_ timestamptz_pl_interval _null_ _null_ _null_ )); +DATA(insert OID = 1189 ( timestamptz_pl_interval PGNSP PGUID 12 1 0 0 f f f t f s 2 0 1184 "1184 1186" _null_ _null_ _null_ _null_ timestamptz_pl_interval _null_ _null_ _null_ )); DESCR("plus"); -DATA(insert OID = 1190 ( timestamptz_mi_interval PGNSP PGUID 12 1 0 0 f f f t f s 2 0 1184 "1184 1186" _null_ _null_ _null_ _null_ timestamptz_mi_interval _null_ _null_ _null_ )); +DATA(insert OID = 1190 ( timestamptz_mi_interval PGNSP PGUID 12 1 0 0 f f f t f s 2 0 1184 "1184 1186" _null_ _null_ _null_ _null_ timestamptz_mi_interval _null_ _null_ _null_ )); DESCR("minus"); DATA(insert OID = 1194 ( reltime PGNSP PGUID 12 1 0 0 f f f t f i 1 0 703 "1186" _null_ _null_ _null_ _null_ interval_reltime _null_ _null_ _null_ )); DESCR("convert interval to reltime"); -DATA(insert OID = 1195 ( timestamptz_smaller PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1184 "1184 1184" _null_ _null_ _null_ _null_ timestamp_smaller _null_ _null_ _null_ )); +DATA(insert OID = 1195 ( timestamptz_smaller PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1184 "1184 1184" _null_ _null_ _null_ _null_ timestamp_smaller _null_ _null_ _null_ )); DESCR("smaller of two"); -DATA(insert OID = 1196 ( timestamptz_larger PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1184 "1184 1184" _null_ _null_ _null_ _null_ timestamp_larger _null_ _null_ _null_ )); +DATA(insert OID = 1196 ( timestamptz_larger PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1184 "1184 1184" _null_ _null_ _null_ _null_ timestamp_larger _null_ _null_ _null_ )); DESCR("larger of two"); DATA(insert OID = 1197 ( interval_smaller PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1186 "1186 1186" _null_ _null_ _null_ _null_ interval_smaller _null_ _null_ _null_ )); DESCR("smaller of two"); @@ -1513,7 +1513,7 @@ DESCR("date difference preserving months and years"); /* OIDS 1200 - 1299 */ -DATA(insert OID = 1200 ( interval PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1186 "1186 23" _null_ _null_ _null_ _null_ interval_scale _null_ _null_ _null_ )); +DATA(insert OID = 1200 ( interval PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1186 "1186 23" _null_ _null_ _null_ _null_ interval_scale _null_ _null_ _null_ )); DESCR("adjust interval precision"); DATA(insert OID = 1215 ( obj_description PGNSP PGUID 14 100 0 0 f f f t f s 2 0 25 "26 19" _null_ _null_ _null_ _null_ "select description from pg_catalog.pg_description where objoid = $1 and classoid = (select oid from pg_catalog.pg_class where relname = $2 and relnamespace = PGNSP) and objsubid = 0" _null_ _null_ _null_ )); @@ -1528,11 +1528,11 @@ DESCR("truncate timestamp with time zone to specified units"); DATA(insert OID = 1218 ( date_trunc PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1186 "25 1186" _null_ _null_ _null_ _null_ interval_trunc _null_ _null_ _null_ )); DESCR("truncate interval to specified units"); -DATA(insert OID = 1219 ( int8inc PGNSP PGUID 12 1 0 0 f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ int8inc _null_ _null_ _null_ )); +DATA(insert OID = 1219 ( int8inc PGNSP PGUID 12 1 0 0 f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ int8inc _null_ _null_ _null_ )); DESCR("increment"); DATA(insert OID = 2804 ( int8inc_any PGNSP PGUID 12 1 0 0 f f f t f i 2 0 20 "20 2276" _null_ _null_ _null_ _null_ int8inc_any _null_ _null_ _null_ )); DESCR("increment, ignores second argument"); -DATA(insert OID = 1230 ( int8abs PGNSP PGUID 12 1 0 0 f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ int8abs _null_ _null_ _null_ )); +DATA(insert OID = 1230 ( int8abs PGNSP PGUID 12 1 0 0 f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ int8abs _null_ _null_ _null_ )); DESCR("absolute value"); DATA(insert OID = 1236 ( int8larger PGNSP PGUID 12 1 0 0 f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ int8larger _null_ _null_ _null_ )); @@ -1549,9 +1549,9 @@ DESCR("matches regex., case-insensitive"); DATA(insert OID = 1241 ( nameicregexne PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ nameicregexne _null_ _null_ _null_ )); DESCR("does not match regex., case-insensitive"); -DATA(insert OID = 1251 ( int4abs PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ int4abs _null_ _null_ _null_ )); +DATA(insert OID = 1251 ( int4abs PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ int4abs _null_ _null_ _null_ )); DESCR("absolute value"); -DATA(insert OID = 1253 ( int2abs PGNSP PGUID 12 1 0 0 f f f t f i 1 0 21 "21" _null_ _null_ _null_ _null_ int2abs _null_ _null_ _null_ )); +DATA(insert OID = 1253 ( int2abs PGNSP PGUID 12 1 0 0 f f f t f i 1 0 21 "21" _null_ _null_ _null_ _null_ int2abs _null_ _null_ _null_ )); DESCR("absolute value"); DATA(insert OID = 1271 ( overlaps PGNSP PGUID 12 1 0 0 f f f f f i 4 0 16 "1266 1266 1266 1266" _null_ _null_ _null_ _null_ overlaps_timetz _null_ _null_ _null_ )); @@ -1594,9 +1594,9 @@ DESCR("multiply"); DATA(insert OID = 948 ( int28div PGNSP PGUID 12 1 0 0 f f f t f i 2 0 20 "21 20" _null_ _null_ _null_ _null_ int28div _null_ _null_ _null_ )); DESCR("divide"); -DATA(insert OID = 1287 ( oid PGNSP PGUID 12 1 0 0 f f f t f i 1 0 26 "20" _null_ _null_ _null_ _null_ i8tooid _null_ _null_ _null_ )); +DATA(insert OID = 1287 ( oid PGNSP PGUID 12 1 0 0 f f f t f i 1 0 26 "20" _null_ _null_ _null_ _null_ i8tooid _null_ _null_ _null_ )); DESCR("convert int8 to oid"); -DATA(insert OID = 1288 ( int8 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 20 "26" _null_ _null_ _null_ _null_ oidtoi8 _null_ _null_ _null_ )); +DATA(insert OID = 1288 ( int8 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 20 "26" _null_ _null_ _null_ _null_ oidtoi8 _null_ _null_ _null_ )); DESCR("convert oid to int8"); DATA(insert OID = 1291 ( suppress_redundant_updates_trigger PGNSP PGUID 12 1 0 0 f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ suppress_redundant_updates_trigger _null_ _null_ _null_ )); @@ -1631,7 +1631,7 @@ DATA(insert OID = 1297 ( datetimetz_pl PGNSP PGUID 12 1 0 0 f f f t f i 2 0 DESCR("convert date and time with time zone to timestamp with time zone"); DATA(insert OID = 1298 ( timetzdate_pl PGNSP PGUID 14 1 0 0 f f f t f i 2 0 1184 "1266 1082" _null_ _null_ _null_ _null_ "select ($2 + $1)" _null_ _null_ _null_ )); DESCR("convert time with time zone and date to timestamp with time zone"); -DATA(insert OID = 1299 ( now PGNSP PGUID 12 1 0 0 f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ now _null_ _null_ _null_ )); +DATA(insert OID = 1299 ( now PGNSP PGUID 12 1 0 0 f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ now _null_ _null_ _null_ )); DESCR("current transaction time"); DATA(insert OID = 2647 ( transaction_timestamp PGNSP PGUID 12 1 0 0 f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ now _null_ _null_ _null_ )); DESCR("current transaction time"); @@ -1686,7 +1686,7 @@ DESCR("convert timestamp to time"); DATA(insert OID = 1317 ( length PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ textlen _null_ _null_ _null_ )); DESCR("length"); -DATA(insert OID = 1318 ( length PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "1042" _null_ _null_ _null_ _null_ bpcharlen _null_ _null_ _null_ )); +DATA(insert OID = 1318 ( length PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "1042" _null_ _null_ _null_ _null_ bpcharlen _null_ _null_ _null_ )); DESCR("character length"); DATA(insert OID = 1319 ( xideqint4 PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "28 23" _null_ _null_ _null_ _null_ xideq _null_ _null_ _null_ )); @@ -1695,32 +1695,32 @@ DESCR("equal"); DATA(insert OID = 1326 ( interval_div PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1186 "1186 701" _null_ _null_ _null_ _null_ interval_div _null_ _null_ _null_ )); DESCR("divide"); -DATA(insert OID = 1339 ( dlog10 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dlog10 _null_ _null_ _null_ )); +DATA(insert OID = 1339 ( dlog10 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dlog10 _null_ _null_ _null_ )); DESCR("base 10 logarithm"); -DATA(insert OID = 1340 ( log PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dlog10 _null_ _null_ _null_ )); +DATA(insert OID = 1340 ( log PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dlog10 _null_ _null_ _null_ )); DESCR("base 10 logarithm"); -DATA(insert OID = 1341 ( ln PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dlog1 _null_ _null_ _null_ )); +DATA(insert OID = 1341 ( ln PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dlog1 _null_ _null_ _null_ )); DESCR("natural logarithm"); -DATA(insert OID = 1342 ( round PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dround _null_ _null_ _null_ )); +DATA(insert OID = 1342 ( round PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dround _null_ _null_ _null_ )); DESCR("round to nearest integer"); -DATA(insert OID = 1343 ( trunc PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dtrunc _null_ _null_ _null_ )); +DATA(insert OID = 1343 ( trunc PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dtrunc _null_ _null_ _null_ )); DESCR("truncate to integer"); -DATA(insert OID = 1344 ( sqrt PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dsqrt _null_ _null_ _null_ )); +DATA(insert OID = 1344 ( sqrt PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dsqrt _null_ _null_ _null_ )); DESCR("square root"); -DATA(insert OID = 1345 ( cbrt PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dcbrt _null_ _null_ _null_ )); +DATA(insert OID = 1345 ( cbrt PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dcbrt _null_ _null_ _null_ )); DESCR("cube root"); -DATA(insert OID = 1346 ( pow PGNSP PGUID 12 1 0 0 f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ dpow _null_ _null_ _null_ )); +DATA(insert OID = 1346 ( pow PGNSP PGUID 12 1 0 0 f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ dpow _null_ _null_ _null_ )); DESCR("exponentiation"); -DATA(insert OID = 1368 ( power PGNSP PGUID 12 1 0 0 f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ dpow _null_ _null_ _null_ )); +DATA(insert OID = 1368 ( power PGNSP PGUID 12 1 0 0 f f f t f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ dpow _null_ _null_ _null_ )); DESCR("exponentiation"); -DATA(insert OID = 1347 ( exp PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dexp _null_ _null_ _null_ )); +DATA(insert OID = 1347 ( exp PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ dexp _null_ _null_ _null_ )); DESCR("exponential"); /* * This form of obj_description is now deprecated, since it will fail if * OIDs are not unique across system catalogs. Use the other forms instead. */ -DATA(insert OID = 1348 ( obj_description PGNSP PGUID 14 100 0 0 f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ "select description from pg_catalog.pg_description where objoid = $1 and objsubid = 0" _null_ _null_ _null_ )); +DATA(insert OID = 1348 ( obj_description PGNSP PGUID 14 100 0 0 f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ "select description from pg_catalog.pg_description where objoid = $1 and objsubid = 0" _null_ _null_ _null_ )); DESCR("get description for object id (deprecated)"); DATA(insert OID = 1349 ( oidvectortypes PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "30" _null_ _null_ _null_ _null_ oidvectortypes _null_ _null_ _null_ )); DESCR("print type names of oidvector field"); @@ -1728,7 +1728,7 @@ DESCR("print type names of oidvector field"); DATA(insert OID = 1350 ( timetz_in PGNSP PGUID 12 1 0 0 f f f t f s 3 0 1266 "2275 26 23" _null_ _null_ _null_ _null_ timetz_in _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 1351 ( timetz_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "1266" _null_ _null_ _null_ _null_ timetz_out _null_ _null_ _null_ )); +DATA(insert OID = 1351 ( timetz_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "1266" _null_ _null_ _null_ _null_ timetz_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2911 ( timetztypmodin PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "1263" _null_ _null_ _null_ _null_ timetztypmodin _null_ _null_ _null_ )); DESCR("I/O typmod"); @@ -1751,7 +1751,7 @@ DESCR("less-equal-greater"); DATA(insert OID = 1359 ( timestamptz PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1184 "1082 1266" _null_ _null_ _null_ _null_ datetimetz_timestamptz _null_ _null_ _null_ )); DESCR("convert date and time with time zone to timestamp with time zone"); -DATA(insert OID = 1364 ( time PGNSP PGUID 14 1 0 0 f f f t f s 1 0 1083 "702" _null_ _null_ _null_ _null_ "select cast(cast($1 as timestamp without time zone) as pg_catalog.time)" _null_ _null_ _null_ )); +DATA(insert OID = 1364 ( time PGNSP PGUID 14 1 0 0 f f f t f s 1 0 1083 "702" _null_ _null_ _null_ _null_ "select cast(cast($1 as timestamp without time zone) as pg_catalog.time)" _null_ _null_ _null_ )); DESCR("convert abstime to time"); DATA(insert OID = 1367 ( character_length PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "1042" _null_ _null_ _null_ _null_ bpcharlen _null_ _null_ _null_ )); @@ -1761,11 +1761,11 @@ DESCR("character length"); DATA(insert OID = 1370 ( interval PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1186 "1083" _null_ _null_ _null_ _null_ time_interval _null_ _null_ _null_ )); DESCR("convert time to interval"); -DATA(insert OID = 1372 ( char_length PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "1042" _null_ _null_ _null_ _null_ bpcharlen _null_ _null_ _null_ )); +DATA(insert OID = 1372 ( char_length PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "1042" _null_ _null_ _null_ _null_ bpcharlen _null_ _null_ _null_ )); DESCR("character length"); DATA(insert OID = 1374 ( octet_length PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ textoctetlen _null_ _null_ _null_ )); DESCR("octet length"); -DATA(insert OID = 1375 ( octet_length PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "1042" _null_ _null_ _null_ _null_ bpcharoctetlen _null_ _null_ _null_ )); +DATA(insert OID = 1375 ( octet_length PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "1042" _null_ _null_ _null_ _null_ bpcharoctetlen _null_ _null_ _null_ )); DESCR("octet length"); DATA(insert OID = 1377 ( time_larger PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1083 "1083 1083" _null_ _null_ _null_ _null_ time_larger _null_ _null_ _null_ )); @@ -1777,7 +1777,7 @@ DESCR("larger of two"); DATA(insert OID = 1380 ( timetz_smaller PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1266 "1266 1266" _null_ _null_ _null_ _null_ timetz_smaller _null_ _null_ _null_ )); DESCR("smaller of two"); -DATA(insert OID = 1381 ( char_length PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ textlen _null_ _null_ _null_ )); +DATA(insert OID = 1381 ( char_length PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "25" _null_ _null_ _null_ _null_ textlen _null_ _null_ _null_ )); DESCR("character length"); DATA(insert OID = 1382 ( date_part PGNSP PGUID 14 1 0 0 f f f t f s 2 0 701 "25 702" _null_ _null_ _null_ _null_ "select pg_catalog.date_part($1, cast($2 as timestamp with time zone))" _null_ _null_ _null_ )); @@ -1788,10 +1788,10 @@ DATA(insert OID = 1384 ( date_part PGNSP PGUID 14 1 0 0 f f f t f i 2 0 701 DESCR("extract field from date"); DATA(insert OID = 1385 ( date_part PGNSP PGUID 12 1 0 0 f f f t f i 2 0 701 "25 1083" _null_ _null_ _null_ _null_ time_part _null_ _null_ _null_ )); DESCR("extract field from time"); -DATA(insert OID = 1386 ( age PGNSP PGUID 14 1 0 0 f f f t f s 1 0 1186 "1184" _null_ _null_ _null_ _null_ "select pg_catalog.age(cast(current_date as timestamp with time zone), $1)" _null_ _null_ _null_ )); +DATA(insert OID = 1386 ( age PGNSP PGUID 14 1 0 0 f f f t f s 1 0 1186 "1184" _null_ _null_ _null_ _null_ "select pg_catalog.age(cast(current_date as timestamp with time zone), $1)" _null_ _null_ _null_ )); DESCR("date difference from today preserving months and years"); -DATA(insert OID = 1388 ( timetz PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1266 "1184" _null_ _null_ _null_ _null_ timestamptz_timetz _null_ _null_ _null_ )); +DATA(insert OID = 1388 ( timetz PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1266 "1184" _null_ _null_ _null_ _null_ timestamptz_timetz _null_ _null_ _null_ )); DESCR("convert timestamptz to timetz"); DATA(insert OID = 1373 ( isfinite PGNSP PGUID 12 1 0 0 f f f t f i 1 0 16 "1082" _null_ _null_ _null_ _null_ date_finite _null_ _null_ _null_ )); @@ -1808,11 +1808,11 @@ DATA(insert OID = 1394 ( abs PGNSP PGUID 12 1 0 0 f f f t f i 1 0 700 "700 DESCR("absolute value"); DATA(insert OID = 1395 ( abs PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ float8abs _null_ _null_ _null_ )); DESCR("absolute value"); -DATA(insert OID = 1396 ( abs PGNSP PGUID 12 1 0 0 f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ int8abs _null_ _null_ _null_ )); +DATA(insert OID = 1396 ( abs PGNSP PGUID 12 1 0 0 f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ int8abs _null_ _null_ _null_ )); DESCR("absolute value"); -DATA(insert OID = 1397 ( abs PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ int4abs _null_ _null_ _null_ )); +DATA(insert OID = 1397 ( abs PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ int4abs _null_ _null_ _null_ )); DESCR("absolute value"); -DATA(insert OID = 1398 ( abs PGNSP PGUID 12 1 0 0 f f f t f i 1 0 21 "21" _null_ _null_ _null_ _null_ int2abs _null_ _null_ _null_ )); +DATA(insert OID = 1398 ( abs PGNSP PGUID 12 1 0 0 f f f t f i 1 0 21 "21" _null_ _null_ _null_ _null_ int2abs _null_ _null_ _null_ )); DESCR("absolute value"); /* OIDS 1400 - 1499 */ @@ -1829,7 +1829,7 @@ DESCR("current schema search list"); DATA(insert OID = 1404 ( overlay PGNSP PGUID 14 1 0 0 f f f t f i 4 0 25 "25 25 23 23" _null_ _null_ _null_ _null_ "select pg_catalog.substring($1, 1, ($3 - 1)) || $2 || pg_catalog.substring($1, ($3 + $4))" _null_ _null_ _null_ )); DESCR("substitute portion of string"); -DATA(insert OID = 1405 ( overlay PGNSP PGUID 14 1 0 0 f f f t f i 3 0 25 "25 25 23" _null_ _null_ _null_ _null_ "select pg_catalog.substring($1, 1, ($3 - 1)) || $2 || pg_catalog.substring($1, ($3 + pg_catalog.char_length($2)))" _null_ _null_ _null_ )); +DATA(insert OID = 1405 ( overlay PGNSP PGUID 14 1 0 0 f f f t f i 3 0 25 "25 25 23" _null_ _null_ _null_ _null_ "select pg_catalog.substring($1, 1, ($3 - 1)) || $2 || pg_catalog.substring($1, ($3 + pg_catalog.char_length($2)))" _null_ _null_ _null_ )); DESCR("substitute portion of string"); DATA(insert OID = 1406 ( isvertical PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "600 600" _null_ _null_ _null_ _null_ point_vert _null_ _null_ _null_ )); @@ -1923,9 +1923,9 @@ DESCR("convert box to polygon"); DATA(insert OID = 1449 ( polygon PGNSP PGUID 12 1 0 0 f f f t f i 1 0 604 "602" _null_ _null_ _null_ _null_ path_poly _null_ _null_ _null_ )); DESCR("convert path to polygon"); -DATA(insert OID = 1450 ( circle_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 718 "2275" _null_ _null_ _null_ _null_ circle_in _null_ _null_ _null_ )); +DATA(insert OID = 1450 ( circle_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 718 "2275" _null_ _null_ _null_ _null_ circle_in _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 1451 ( circle_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "718" _null_ _null_ _null_ _null_ circle_out _null_ _null_ _null_ )); +DATA(insert OID = 1451 ( circle_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "718" _null_ _null_ _null_ _null_ circle_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1452 ( circle_same PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "718 718" _null_ _null_ _null_ _null_ circle_same _null_ _null_ _null_ )); DESCR("same as?"); @@ -2005,9 +2005,9 @@ DESCR("closest point to line on line segment"); DATA(insert OID = 1489 ( close_lseg PGNSP PGUID 12 1 0 0 f f f t f i 2 0 600 "601 601" _null_ _null_ _null_ _null_ close_lseg _null_ _null_ _null_ )); DESCR("closest point to line segment on line segment"); -DATA(insert OID = 1490 ( line_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 628 "2275" _null_ _null_ _null_ _null_ line_in _null_ _null_ _null_ )); +DATA(insert OID = 1490 ( line_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 628 "2275" _null_ _null_ _null_ _null_ line_in _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 1491 ( line_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "628" _null_ _null_ _null_ _null_ line_out _null_ _null_ _null_ )); +DATA(insert OID = 1491 ( line_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "628" _null_ _null_ _null_ _null_ line_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1492 ( line_eq PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "628 628" _null_ _null_ _null_ _null_ line_eq _null_ _null_ _null_ )); DESCR("lines equal?"); @@ -2064,13 +2064,13 @@ DESCR("I/O typmod"); DATA(insert OID = 2920 ( bittypmodout PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ bittypmodout _null_ _null_ _null_ )); DESCR("I/O typmod"); -DATA(insert OID = 1569 ( like PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ textlike _null_ _null_ _null_ )); +DATA(insert OID = 1569 ( like PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ textlike _null_ _null_ _null_ )); DESCR("matches LIKE expression"); -DATA(insert OID = 1570 ( notlike PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ textnlike _null_ _null_ _null_ )); +DATA(insert OID = 1570 ( notlike PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ textnlike _null_ _null_ _null_ )); DESCR("does not match LIKE expression"); -DATA(insert OID = 1571 ( like PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ namelike _null_ _null_ _null_ )); +DATA(insert OID = 1571 ( like PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ namelike _null_ _null_ _null_ )); DESCR("matches LIKE expression"); -DATA(insert OID = 1572 ( notlike PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ namenlike _null_ _null_ _null_ )); +DATA(insert OID = 1572 ( notlike PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ namenlike _null_ _null_ _null_ )); DESCR("does not match LIKE expression"); @@ -2093,22 +2093,22 @@ DESCR("I/O typmod"); DATA(insert OID = 2921 ( varbittypmodout PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ varbittypmodout _null_ _null_ _null_ )); DESCR("I/O typmod"); -DATA(insert OID = 1581 ( biteq PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ biteq _null_ _null_ _null_ )); +DATA(insert OID = 1581 ( biteq PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ biteq _null_ _null_ _null_ )); DESCR("equal"); -DATA(insert OID = 1582 ( bitne PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ bitne _null_ _null_ _null_ )); +DATA(insert OID = 1582 ( bitne PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ bitne _null_ _null_ _null_ )); DESCR("not equal"); -DATA(insert OID = 1592 ( bitge PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ bitge _null_ _null_ _null_ )); +DATA(insert OID = 1592 ( bitge PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ bitge _null_ _null_ _null_ )); DESCR("greater than or equal"); -DATA(insert OID = 1593 ( bitgt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ bitgt _null_ _null_ _null_ )); +DATA(insert OID = 1593 ( bitgt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ bitgt _null_ _null_ _null_ )); DESCR("greater than"); -DATA(insert OID = 1594 ( bitle PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ bitle _null_ _null_ _null_ )); +DATA(insert OID = 1594 ( bitle PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ bitle _null_ _null_ _null_ )); DESCR("less than or equal"); -DATA(insert OID = 1595 ( bitlt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ bitlt _null_ _null_ _null_ )); +DATA(insert OID = 1595 ( bitlt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1560 1560" _null_ _null_ _null_ _null_ bitlt _null_ _null_ _null_ )); DESCR("less than"); -DATA(insert OID = 1596 ( bitcmp PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "1560 1560" _null_ _null_ _null_ _null_ bitcmp _null_ _null_ _null_ )); +DATA(insert OID = 1596 ( bitcmp PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "1560 1560" _null_ _null_ _null_ _null_ bitcmp _null_ _null_ _null_ )); DESCR("compare"); -DATA(insert OID = 1598 ( random PGNSP PGUID 12 1 0 0 f f f t f v 0 0 701 "" _null_ _null_ _null_ _null_ drandom _null_ _null_ _null_ )); +DATA(insert OID = 1598 ( random PGNSP PGUID 12 1 0 0 f f f t f v 0 0 701 "" _null_ _null_ _null_ _null_ drandom _null_ _null_ _null_ )); DESCR("random value"); DATA(insert OID = 1599 ( setseed PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "701" _null_ _null_ _null_ _null_ setseed _null_ _null_ _null_ )); DESCR("set random seed"); @@ -2135,7 +2135,7 @@ DATA(insert OID = 1608 ( degrees PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "70 DESCR("radians to degrees"); DATA(insert OID = 1609 ( radians PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ radians _null_ _null_ _null_ )); DESCR("degrees to radians"); -DATA(insert OID = 1610 ( pi PGNSP PGUID 12 1 0 0 f f f t f i 0 0 701 "" _null_ _null_ _null_ _null_ dpi _null_ _null_ _null_ )); +DATA(insert OID = 1610 ( pi PGNSP PGUID 12 1 0 0 f f f t f i 0 0 701 "" _null_ _null_ _null_ _null_ dpi _null_ _null_ _null_ )); DESCR("PI"); DATA(insert OID = 1618 ( interval_mul PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1186 "1186 701" _null_ _null_ _null_ _null_ interval_mul _null_ _null_ _null_ )); @@ -2145,7 +2145,7 @@ DATA(insert OID = 1620 ( ascii PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "25" DESCR("convert first char to int4"); DATA(insert OID = 1621 ( chr PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "23" _null_ _null_ _null_ _null_ chr _null_ _null_ _null_ )); DESCR("convert int4 to char"); -DATA(insert OID = 1622 ( repeat PGNSP PGUID 12 1 0 0 f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_ repeat _null_ _null_ _null_ )); +DATA(insert OID = 1622 ( repeat PGNSP PGUID 12 1 0 0 f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_ repeat _null_ _null_ _null_ )); DESCR("replicate string int4 times"); DATA(insert OID = 1623 ( similar_escape PGNSP PGUID 12 1 0 0 f f f f f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ similar_escape _null_ _null_ _null_ )); @@ -2162,9 +2162,9 @@ DATA(insert OID = 1633 ( texticlike PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "2 DESCR("matches LIKE expression, case-insensitive"); DATA(insert OID = 1634 ( texticnlike PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ texticnlike _null_ _null_ _null_ )); DESCR("does not match LIKE expression, case-insensitive"); -DATA(insert OID = 1635 ( nameiclike PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ nameiclike _null_ _null_ _null_ )); +DATA(insert OID = 1635 ( nameiclike PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ nameiclike _null_ _null_ _null_ )); DESCR("matches LIKE expression, case-insensitive"); -DATA(insert OID = 1636 ( nameicnlike PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ nameicnlike _null_ _null_ _null_ )); +DATA(insert OID = 1636 ( nameicnlike PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "19 25" _null_ _null_ _null_ _null_ nameicnlike _null_ _null_ _null_ )); DESCR("does not match LIKE expression, case-insensitive"); DATA(insert OID = 1637 ( like_escape PGNSP PGUID 12 1 0 0 f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ like_escape _null_ _null_ _null_ )); DESCR("convert LIKE pattern to use backslash escapes"); @@ -2188,11 +2188,11 @@ DESCR("update flat-file copy of a shared catalog"); /* Oracle Compatibility Related Functions - By Edmund Mergl <E.Mergl@bawue.de> */ DATA(insert OID = 868 ( strpos PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "25 25" _null_ _null_ _null_ _null_ textpos _null_ _null_ _null_ )); DESCR("find position of substring"); -DATA(insert OID = 870 ( lower PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ lower _null_ _null_ _null_ )); +DATA(insert OID = 870 ( lower PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ lower _null_ _null_ _null_ )); DESCR("lowercase"); -DATA(insert OID = 871 ( upper PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ upper _null_ _null_ _null_ )); +DATA(insert OID = 871 ( upper PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ upper _null_ _null_ _null_ )); DESCR("uppercase"); -DATA(insert OID = 872 ( initcap PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ initcap _null_ _null_ _null_ )); +DATA(insert OID = 872 ( initcap PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ initcap _null_ _null_ _null_ )); DESCR("capitalize each word"); DATA(insert OID = 873 ( lpad PGNSP PGUID 12 1 0 0 f f f t f i 3 0 25 "25 23 25" _null_ _null_ _null_ _null_ lpad _null_ _null_ _null_ )); DESCR("left-pad string to length"); @@ -2210,15 +2210,15 @@ DATA(insert OID = 879 ( lpad PGNSP PGUID 14 1 0 0 f f f t f i 2 0 25 "25 2 DESCR("left-pad string to length"); DATA(insert OID = 880 ( rpad PGNSP PGUID 14 1 0 0 f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_ "select pg_catalog.rpad($1, $2, '' '')" _null_ _null_ _null_ )); DESCR("right-pad string to length"); -DATA(insert OID = 881 ( ltrim PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ ltrim1 _null_ _null_ _null_ )); +DATA(insert OID = 881 ( ltrim PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ ltrim1 _null_ _null_ _null_ )); DESCR("trim spaces from left end of string"); -DATA(insert OID = 882 ( rtrim PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ rtrim1 _null_ _null_ _null_ )); +DATA(insert OID = 882 ( rtrim PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ rtrim1 _null_ _null_ _null_ )); DESCR("trim spaces from right end of string"); DATA(insert OID = 883 ( substr PGNSP PGUID 12 1 0 0 f f f t f i 2 0 25 "25 23" _null_ _null_ _null_ _null_ text_substr_no_len _null_ _null_ _null_ )); DESCR("return portion of string"); DATA(insert OID = 884 ( btrim PGNSP PGUID 12 1 0 0 f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ btrim _null_ _null_ _null_ )); DESCR("trim selected characters from both ends of string"); -DATA(insert OID = 885 ( btrim PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ btrim1 _null_ _null_ _null_ )); +DATA(insert OID = 885 ( btrim PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ btrim1 _null_ _null_ _null_ )); DESCR("trim spaces from both ends of string"); DATA(insert OID = 936 ( substring PGNSP PGUID 12 1 0 0 f f f t f i 3 0 25 "25 23 23" _null_ _null_ _null_ _null_ text_substr _null_ _null_ _null_ )); @@ -2245,9 +2245,9 @@ DATA(insert OID = 2767 ( regexp_split_to_array PGNSP PGUID 12 1 0 0 f f f t f i DESCR("split string by pattern"); DATA(insert OID = 2768 ( regexp_split_to_array PGNSP PGUID 12 1 0 0 f f f t f i 3 0 1009 "25 25 25" _null_ _null_ _null_ _null_ regexp_split_to_array _null_ _null_ _null_ )); DESCR("split string by pattern"); -DATA(insert OID = 2089 ( to_hex PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "23" _null_ _null_ _null_ _null_ to_hex32 _null_ _null_ _null_ )); +DATA(insert OID = 2089 ( to_hex PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "23" _null_ _null_ _null_ _null_ to_hex32 _null_ _null_ _null_ )); DESCR("convert int4 number to hex"); -DATA(insert OID = 2090 ( to_hex PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "20" _null_ _null_ _null_ _null_ to_hex64 _null_ _null_ _null_ )); +DATA(insert OID = 2090 ( to_hex PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "20" _null_ _null_ _null_ _null_ to_hex64 _null_ _null_ _null_ )); DESCR("convert int8 number to hex"); /* for character set encoding support */ @@ -2272,10 +2272,10 @@ DESCR("convert string with specified destination encoding name"); DATA(insert OID = 1813 ( convert PGNSP PGUID 12 1 0 0 f f f t f s 3 0 17 "17 19 19" _null_ _null_ _null_ _null_ pg_convert _null_ _null_ _null_ )); DESCR("convert string with specified encoding names"); -DATA(insert OID = 1264 ( pg_char_to_encoding PGNSP PGUID 12 1 0 0 f f f t f s 1 0 23 "19" _null_ _null_ _null_ _null_ PG_char_to_encoding _null_ _null_ _null_ )); +DATA(insert OID = 1264 ( pg_char_to_encoding PGNSP PGUID 12 1 0 0 f f f t f s 1 0 23 "19" _null_ _null_ _null_ _null_ PG_char_to_encoding _null_ _null_ _null_ )); DESCR("convert encoding name to encoding id"); -DATA(insert OID = 1597 ( pg_encoding_to_char PGNSP PGUID 12 1 0 0 f f f t f s 1 0 19 "23" _null_ _null_ _null_ _null_ PG_encoding_to_char _null_ _null_ _null_ )); +DATA(insert OID = 1597 ( pg_encoding_to_char PGNSP PGUID 12 1 0 0 f f f t f s 1 0 19 "23" _null_ _null_ _null_ _null_ PG_encoding_to_char _null_ _null_ _null_ )); DESCR("convert encoding id to encoding name"); DATA(insert OID = 1638 ( oidgt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "26 26" _null_ _null_ _null_ _null_ oidgt _null_ _null_ _null_ )); @@ -2284,31 +2284,31 @@ DATA(insert OID = 1639 ( oidge PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "2 DESCR("greater-than-or-equal"); /* System-view support functions */ -DATA(insert OID = 1573 ( pg_get_ruledef PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_ruledef _null_ _null_ _null_ )); +DATA(insert OID = 1573 ( pg_get_ruledef PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_ruledef _null_ _null_ _null_ )); DESCR("source text of a rule"); -DATA(insert OID = 1640 ( pg_get_viewdef PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "25" _null_ _null_ _null_ _null_ pg_get_viewdef_name _null_ _null_ _null_ )); +DATA(insert OID = 1640 ( pg_get_viewdef PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "25" _null_ _null_ _null_ _null_ pg_get_viewdef_name _null_ _null_ _null_ )); DESCR("select statement of a view"); -DATA(insert OID = 1641 ( pg_get_viewdef PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_viewdef _null_ _null_ _null_ )); +DATA(insert OID = 1641 ( pg_get_viewdef PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_viewdef _null_ _null_ _null_ )); DESCR("select statement of a view"); -DATA(insert OID = 1642 ( pg_get_userbyid PGNSP PGUID 12 1 0 0 f f f t f s 1 0 19 "26" _null_ _null_ _null_ _null_ pg_get_userbyid _null_ _null_ _null_ )); +DATA(insert OID = 1642 ( pg_get_userbyid PGNSP PGUID 12 1 0 0 f f f t f s 1 0 19 "26" _null_ _null_ _null_ _null_ pg_get_userbyid _null_ _null_ _null_ )); DESCR("role name by OID (with fallback)"); -DATA(insert OID = 1643 ( pg_get_indexdef PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_indexdef _null_ _null_ _null_ )); +DATA(insert OID = 1643 ( pg_get_indexdef PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_indexdef _null_ _null_ _null_ )); DESCR("index description"); -DATA(insert OID = 1662 ( pg_get_triggerdef PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_triggerdef _null_ _null_ _null_ )); +DATA(insert OID = 1662 ( pg_get_triggerdef PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_triggerdef _null_ _null_ _null_ )); DESCR("trigger description"); -DATA(insert OID = 1387 ( pg_get_constraintdef PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_constraintdef _null_ _null_ _null_ )); +DATA(insert OID = 1387 ( pg_get_constraintdef PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_constraintdef _null_ _null_ _null_ )); DESCR("constraint description"); DATA(insert OID = 1716 ( pg_get_expr PGNSP PGUID 12 1 0 0 f f f t f s 2 0 25 "25 26" _null_ _null_ _null_ _null_ pg_get_expr _null_ _null_ _null_ )); DESCR("deparse an encoded expression"); -DATA(insert OID = 1665 ( pg_get_serial_sequence PGNSP PGUID 12 1 0 0 f f f t f s 2 0 25 "25 25" _null_ _null_ _null_ _null_ pg_get_serial_sequence _null_ _null_ _null_ )); +DATA(insert OID = 1665 ( pg_get_serial_sequence PGNSP PGUID 12 1 0 0 f f f t f s 2 0 25 "25 25" _null_ _null_ _null_ _null_ pg_get_serial_sequence _null_ _null_ _null_ )); DESCR("name of sequence for a serial column"); DATA(insert OID = 2098 ( pg_get_functiondef PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_functiondef _null_ _null_ _null_ )); DESCR("definition of a function"); -DATA(insert OID = 2162 ( pg_get_function_arguments PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_function_arguments _null_ _null_ _null_ )); +DATA(insert OID = 2162 ( pg_get_function_arguments PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_function_arguments _null_ _null_ _null_ )); DESCR("argument list of a function"); -DATA(insert OID = 2232 ( pg_get_function_identity_arguments PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_function_identity_arguments _null_ _null_ _null_ )); +DATA(insert OID = 2232 ( pg_get_function_identity_arguments PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_function_identity_arguments _null_ _null_ _null_ )); DESCR("identity argument list of a function"); -DATA(insert OID = 2165 ( pg_get_function_result PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_function_result _null_ _null_ _null_ )); +DATA(insert OID = 2165 ( pg_get_function_result PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "26" _null_ _null_ _null_ _null_ pg_get_function_result _null_ _null_ _null_ )); DESCR("result type of a function"); DATA(insert OID = 1686 ( pg_get_keywords PGNSP PGUID 12 10 400 0 f f f t t s 0 0 2249 "" "{25,18,25}" "{o,o,o}" "{word,catcode,catdesc}" _null_ pg_get_keywords _null_ _null_ _null_ )); @@ -2341,24 +2341,24 @@ DATA(insert OID = 1652 ( RI_FKey_setdefault_del PGNSP PGUID 12 1 0 0 f f f t f DESCR("referential integrity ON DELETE SET DEFAULT"); DATA(insert OID = 1653 ( RI_FKey_setdefault_upd PGNSP PGUID 12 1 0 0 f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ RI_FKey_setdefault_upd _null_ _null_ _null_ )); DESCR("referential integrity ON UPDATE SET DEFAULT"); -DATA(insert OID = 1654 ( RI_FKey_noaction_del PGNSP PGUID 12 1 0 0 f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ RI_FKey_noaction_del _null_ _null_ _null_ )); +DATA(insert OID = 1654 ( RI_FKey_noaction_del PGNSP PGUID 12 1 0 0 f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ RI_FKey_noaction_del _null_ _null_ _null_ )); DESCR("referential integrity ON DELETE NO ACTION"); -DATA(insert OID = 1655 ( RI_FKey_noaction_upd PGNSP PGUID 12 1 0 0 f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ RI_FKey_noaction_upd _null_ _null_ _null_ )); +DATA(insert OID = 1655 ( RI_FKey_noaction_upd PGNSP PGUID 12 1 0 0 f f f t f v 0 0 2279 "" _null_ _null_ _null_ _null_ RI_FKey_noaction_upd _null_ _null_ _null_ )); DESCR("referential integrity ON UPDATE NO ACTION"); -DATA(insert OID = 1666 ( varbiteq PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ biteq _null_ _null_ _null_ )); +DATA(insert OID = 1666 ( varbiteq PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ biteq _null_ _null_ _null_ )); DESCR("equal"); -DATA(insert OID = 1667 ( varbitne PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ bitne _null_ _null_ _null_ )); +DATA(insert OID = 1667 ( varbitne PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ bitne _null_ _null_ _null_ )); DESCR("not equal"); -DATA(insert OID = 1668 ( varbitge PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ bitge _null_ _null_ _null_ )); +DATA(insert OID = 1668 ( varbitge PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ bitge _null_ _null_ _null_ )); DESCR("greater than or equal"); -DATA(insert OID = 1669 ( varbitgt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ bitgt _null_ _null_ _null_ )); +DATA(insert OID = 1669 ( varbitgt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ bitgt _null_ _null_ _null_ )); DESCR("greater than"); -DATA(insert OID = 1670 ( varbitle PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ bitle _null_ _null_ _null_ )); +DATA(insert OID = 1670 ( varbitle PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ bitle _null_ _null_ _null_ )); DESCR("less than or equal"); -DATA(insert OID = 1671 ( varbitlt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ bitlt _null_ _null_ _null_ )); +DATA(insert OID = 1671 ( varbitlt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1562 1562" _null_ _null_ _null_ _null_ bitlt _null_ _null_ _null_ )); DESCR("less than"); -DATA(insert OID = 1672 ( varbitcmp PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "1562 1562" _null_ _null_ _null_ _null_ bitcmp _null_ _null_ _null_ )); +DATA(insert OID = 1672 ( varbitcmp PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "1562 1562" _null_ _null_ _null_ _null_ bitcmp _null_ _null_ _null_ )); DESCR("compare"); DATA(insert OID = 1673 ( bitand PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1560 "1560 1560" _null_ _null_ _null_ _null_ bitand _null_ _null_ _null_ )); @@ -2369,9 +2369,9 @@ DATA(insert OID = 1675 ( bitxor PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1560 "15 DESCR("bitwise exclusive or"); DATA(insert OID = 1676 ( bitnot PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1560 "1560" _null_ _null_ _null_ _null_ bitnot _null_ _null_ _null_ )); DESCR("bitwise not"); -DATA(insert OID = 1677 ( bitshiftleft PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1560 "1560 23" _null_ _null_ _null_ _null_ bitshiftleft _null_ _null_ _null_ )); +DATA(insert OID = 1677 ( bitshiftleft PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1560 "1560 23" _null_ _null_ _null_ _null_ bitshiftleft _null_ _null_ _null_ )); DESCR("bitwise left shift"); -DATA(insert OID = 1678 ( bitshiftright PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1560 "1560 23" _null_ _null_ _null_ _null_ bitshiftright _null_ _null_ _null_ )); +DATA(insert OID = 1678 ( bitshiftright PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1560 "1560 23" _null_ _null_ _null_ _null_ bitshiftright _null_ _null_ _null_ )); DESCR("bitwise right shift"); DATA(insert OID = 1679 ( bitcat PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1562 "1562 1562" _null_ _null_ _null_ _null_ bitcat _null_ _null_ _null_ )); DESCR("bitwise concatenation"); @@ -2393,14 +2393,14 @@ DESCR("adjust varbit() to typmod length"); DATA(insert OID = 1698 ( position PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "1560 1560" _null_ _null_ _null_ _null_ bitposition _null_ _null_ _null_ )); DESCR("return position of sub-bitstring"); -DATA(insert OID = 1699 ( substring PGNSP PGUID 14 1 0 0 f f f t f i 2 0 1560 "1560 23" _null_ _null_ _null_ _null_ "select pg_catalog.substring($1, $2, -1)" _null_ _null_ _null_ )); +DATA(insert OID = 1699 ( substring PGNSP PGUID 14 1 0 0 f f f t f i 2 0 1560 "1560 23" _null_ _null_ _null_ _null_ "select pg_catalog.substring($1, $2, -1)" _null_ _null_ _null_ )); DESCR("return portion of bitstring"); /* for mac type support */ -DATA(insert OID = 436 ( macaddr_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 829 "2275" _null_ _null_ _null_ _null_ macaddr_in _null_ _null_ _null_ )); +DATA(insert OID = 436 ( macaddr_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 829 "2275" _null_ _null_ _null_ _null_ macaddr_in _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 437 ( macaddr_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "829" _null_ _null_ _null_ _null_ macaddr_out _null_ _null_ _null_ )); +DATA(insert OID = 437 ( macaddr_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "829" _null_ _null_ _null_ _null_ macaddr_out _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 753 ( trunc PGNSP PGUID 12 1 0 0 f f f t f i 1 0 829 "829" _null_ _null_ _null_ _null_ macaddr_trunc _null_ _null_ _null_ )); @@ -2422,15 +2422,15 @@ DATA(insert OID = 836 ( macaddr_cmp PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "8 DESCR("less-equal-greater"); /* for inet type support */ -DATA(insert OID = 910 ( inet_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 869 "2275" _null_ _null_ _null_ _null_ inet_in _null_ _null_ _null_ )); +DATA(insert OID = 910 ( inet_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 869 "2275" _null_ _null_ _null_ _null_ inet_in _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 911 ( inet_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "869" _null_ _null_ _null_ _null_ inet_out _null_ _null_ _null_ )); +DATA(insert OID = 911 ( inet_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "869" _null_ _null_ _null_ _null_ inet_out _null_ _null_ _null_ )); DESCR("I/O"); /* for cidr type support */ -DATA(insert OID = 1267 ( cidr_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 650 "2275" _null_ _null_ _null_ _null_ cidr_in _null_ _null_ _null_ )); +DATA(insert OID = 1267 ( cidr_in PGNSP PGUID 12 1 0 0 f f f t f i 1 0 650 "2275" _null_ _null_ _null_ _null_ cidr_in _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 1427 ( cidr_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "650" _null_ _null_ _null_ _null_ cidr_out _null_ _null_ _null_ )); +DATA(insert OID = 1427 ( cidr_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "650" _null_ _null_ _null_ _null_ cidr_out _null_ _null_ _null_ )); DESCR("I/O"); /* these are used for both inet and cidr */ @@ -2485,13 +2485,13 @@ DESCR("hostmask of address"); DATA(insert OID = 1715 ( cidr PGNSP PGUID 12 1 0 0 f f f t f i 1 0 650 "869" _null_ _null_ _null_ _null_ inet_to_cidr _null_ _null_ _null_ )); DESCR("coerce inet to cidr"); -DATA(insert OID = 2196 ( inet_client_addr PGNSP PGUID 12 1 0 0 f f f f f s 0 0 869 "" _null_ _null_ _null_ _null_ inet_client_addr _null_ _null_ _null_ )); +DATA(insert OID = 2196 ( inet_client_addr PGNSP PGUID 12 1 0 0 f f f f f s 0 0 869 "" _null_ _null_ _null_ _null_ inet_client_addr _null_ _null_ _null_ )); DESCR("inet address of the client"); -DATA(insert OID = 2197 ( inet_client_port PGNSP PGUID 12 1 0 0 f f f f f s 0 0 23 "" _null_ _null_ _null_ _null_ inet_client_port _null_ _null_ _null_ )); +DATA(insert OID = 2197 ( inet_client_port PGNSP PGUID 12 1 0 0 f f f f f s 0 0 23 "" _null_ _null_ _null_ _null_ inet_client_port _null_ _null_ _null_ )); DESCR("client's port number for this connection"); -DATA(insert OID = 2198 ( inet_server_addr PGNSP PGUID 12 1 0 0 f f f f f s 0 0 869 "" _null_ _null_ _null_ _null_ inet_server_addr _null_ _null_ _null_ )); +DATA(insert OID = 2198 ( inet_server_addr PGNSP PGUID 12 1 0 0 f f f f f s 0 0 869 "" _null_ _null_ _null_ _null_ inet_server_addr _null_ _null_ _null_ )); DESCR("inet address of the server"); -DATA(insert OID = 2199 ( inet_server_port PGNSP PGUID 12 1 0 0 f f f f f s 0 0 23 "" _null_ _null_ _null_ _null_ inet_server_port _null_ _null_ _null_ )); +DATA(insert OID = 2199 ( inet_server_port PGNSP PGUID 12 1 0 0 f f f f f s 0 0 23 "" _null_ _null_ _null_ _null_ inet_server_port _null_ _null_ _null_ )); DESCR("server's port number for this connection"); DATA(insert OID = 2627 ( inetnot PGNSP PGUID 12 1 0 0 f f f t f i 1 0 869 "869" _null_ _null_ _null_ _null_ inetnot _null_ _null_ _null_ )); @@ -2512,11 +2512,11 @@ DESCR("subtract inet values"); DATA(insert OID = 1690 ( time_mi_time PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1186 "1083 1083" _null_ _null_ _null_ _null_ time_mi_time _null_ _null_ _null_ )); DESCR("minus"); -DATA(insert OID = 1691 ( boolle PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ boolle _null_ _null_ _null_ )); +DATA(insert OID = 1691 ( boolle PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ boolle _null_ _null_ _null_ )); DESCR("less-than-or-equal"); -DATA(insert OID = 1692 ( boolge PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ boolge _null_ _null_ _null_ )); +DATA(insert OID = 1692 ( boolge PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "16 16" _null_ _null_ _null_ _null_ boolge _null_ _null_ _null_ )); DESCR("greater-than-or-equal"); -DATA(insert OID = 1693 ( btboolcmp PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "16 16" _null_ _null_ _null_ _null_ btboolcmp _null_ _null_ _null_ )); +DATA(insert OID = 1693 ( btboolcmp PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "16 16" _null_ _null_ _null_ _null_ btboolcmp _null_ _null_ _null_ )); DESCR("btree less-equal-greater"); DATA(insert OID = 1688 ( time_hash PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "1083" _null_ _null_ _null_ _null_ time_hash _null_ _null_ _null_ )); @@ -2528,7 +2528,7 @@ DESCR("hash"); /* OID's 1700 - 1799 NUMERIC data type */ -DATA(insert OID = 1701 ( numeric_in PGNSP PGUID 12 1 0 0 f f f t f i 3 0 1700 "2275 26 23" _null_ _null_ _null_ _null_ numeric_in _null_ _null_ _null_ )); +DATA(insert OID = 1701 ( numeric_in PGNSP PGUID 12 1 0 0 f f f t f i 3 0 1700 "2275 26 23" _null_ _null_ _null_ _null_ numeric_in _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 1702 ( numeric_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "1700" _null_ _null_ _null_ _null_ numeric_out _null_ _null_ _null_ )); DESCR("I/O"); @@ -2536,7 +2536,7 @@ DATA(insert OID = 2917 ( numerictypmodin PGNSP PGUID 12 1 0 0 f f f t f i 1 0 DESCR("I/O typmod"); DATA(insert OID = 2918 ( numerictypmodout PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2275 "23" _null_ _null_ _null_ _null_ numerictypmodout _null_ _null_ _null_ )); DESCR("I/O typmod"); -DATA(insert OID = 1703 ( numeric PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1700 "1700 23" _null_ _null_ _null_ _null_ numeric _null_ _null_ _null_ )); +DATA(insert OID = 1703 ( numeric PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1700 "1700 23" _null_ _null_ _null_ _null_ numeric _null_ _null_ _null_ )); DESCR("adjust numeric to typmod precision/scale"); DATA(insert OID = 1704 ( numeric_abs PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ numeric_abs _null_ _null_ _null_ )); DESCR("absolute value"); @@ -2544,11 +2544,11 @@ DATA(insert OID = 1705 ( abs PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "1700 DESCR("absolute value"); DATA(insert OID = 1706 ( sign PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ numeric_sign _null_ _null_ _null_ )); DESCR("sign of value"); -DATA(insert OID = 1707 ( round PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1700 "1700 23" _null_ _null_ _null_ _null_ numeric_round _null_ _null_ _null_ )); +DATA(insert OID = 1707 ( round PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1700 "1700 23" _null_ _null_ _null_ _null_ numeric_round _null_ _null_ _null_ )); DESCR("value rounded to 'scale'"); DATA(insert OID = 1708 ( round PGNSP PGUID 14 1 0 0 f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ "select pg_catalog.round($1,0)" _null_ _null_ _null_ )); DESCR("value rounded to 'scale' of zero"); -DATA(insert OID = 1709 ( trunc PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1700 "1700 23" _null_ _null_ _null_ _null_ numeric_trunc _null_ _null_ _null_ )); +DATA(insert OID = 1709 ( trunc PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1700 "1700 23" _null_ _null_ _null_ _null_ numeric_trunc _null_ _null_ _null_ )); DESCR("value truncated to 'scale'"); DATA(insert OID = 1710 ( trunc PGNSP PGUID 14 1 0 0 f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ "select pg_catalog.trunc($1,0)" _null_ _null_ _null_ )); DESCR("value truncated to 'scale' of zero"); @@ -2558,17 +2558,17 @@ DATA(insert OID = 2167 ( ceiling PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "1 DESCR("smallest integer >= value"); DATA(insert OID = 1712 ( floor PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ numeric_floor _null_ _null_ _null_ )); DESCR("largest integer <= value"); -DATA(insert OID = 1718 ( numeric_eq PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ numeric_eq _null_ _null_ _null_ )); +DATA(insert OID = 1718 ( numeric_eq PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ numeric_eq _null_ _null_ _null_ )); DESCR("equal"); -DATA(insert OID = 1719 ( numeric_ne PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ numeric_ne _null_ _null_ _null_ )); +DATA(insert OID = 1719 ( numeric_ne PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ numeric_ne _null_ _null_ _null_ )); DESCR("not equal"); -DATA(insert OID = 1720 ( numeric_gt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ numeric_gt _null_ _null_ _null_ )); +DATA(insert OID = 1720 ( numeric_gt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ numeric_gt _null_ _null_ _null_ )); DESCR("greater-than"); -DATA(insert OID = 1721 ( numeric_ge PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ numeric_ge _null_ _null_ _null_ )); +DATA(insert OID = 1721 ( numeric_ge PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ numeric_ge _null_ _null_ _null_ )); DESCR("greater-than-or-equal"); -DATA(insert OID = 1722 ( numeric_lt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ numeric_lt _null_ _null_ _null_ )); +DATA(insert OID = 1722 ( numeric_lt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ numeric_lt _null_ _null_ _null_ )); DESCR("less-than"); -DATA(insert OID = 1723 ( numeric_le PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ numeric_le _null_ _null_ _null_ )); +DATA(insert OID = 1723 ( numeric_le PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ numeric_le _null_ _null_ _null_ )); DESCR("less-than-or-equal"); DATA(insert OID = 1724 ( numeric_add PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ numeric_add _null_ _null_ _null_ )); DESCR("add"); @@ -2608,21 +2608,21 @@ DATA(insert OID = 1740 ( numeric PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "2 DESCR("(internal)"); DATA(insert OID = 1741 ( log PGNSP PGUID 14 1 0 0 f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ "select pg_catalog.log(10, $1)" _null_ _null_ _null_ )); DESCR("logarithm base 10 of n"); -DATA(insert OID = 1742 ( numeric PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "700" _null_ _null_ _null_ _null_ float4_numeric _null_ _null_ _null_ )); +DATA(insert OID = 1742 ( numeric PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "700" _null_ _null_ _null_ _null_ float4_numeric _null_ _null_ _null_ )); DESCR("(internal)"); -DATA(insert OID = 1743 ( numeric PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "701" _null_ _null_ _null_ _null_ float8_numeric _null_ _null_ _null_ )); +DATA(insert OID = 1743 ( numeric PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "701" _null_ _null_ _null_ _null_ float8_numeric _null_ _null_ _null_ )); DESCR("(internal)"); DATA(insert OID = 1744 ( int4 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "1700" _null_ _null_ _null_ _null_ numeric_int4 _null_ _null_ _null_ )); DESCR("(internal)"); -DATA(insert OID = 1745 ( float4 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 700 "1700" _null_ _null_ _null_ _null_ numeric_float4 _null_ _null_ _null_ )); +DATA(insert OID = 1745 ( float4 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 700 "1700" _null_ _null_ _null_ _null_ numeric_float4 _null_ _null_ _null_ )); DESCR("(internal)"); -DATA(insert OID = 1746 ( float8 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "1700" _null_ _null_ _null_ _null_ numeric_float8 _null_ _null_ _null_ )); +DATA(insert OID = 1746 ( float8 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "1700" _null_ _null_ _null_ _null_ numeric_float8 _null_ _null_ _null_ )); DESCR("(internal)"); DATA(insert OID = 1973 ( div PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ numeric_div_trunc _null_ _null_ _null_ )); DESCR("trunc(x/y)"); DATA(insert OID = 1980 ( numeric_div_trunc PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ numeric_div_trunc _null_ _null_ _null_ )); DESCR("trunc(x/y)"); -DATA(insert OID = 2170 ( width_bucket PGNSP PGUID 12 1 0 0 f f f t f i 4 0 23 "1700 1700 1700 23" _null_ _null_ _null_ _null_ width_bucket_numeric _null_ _null_ _null_ )); +DATA(insert OID = 2170 ( width_bucket PGNSP PGUID 12 1 0 0 f f f t f i 4 0 23 "1700 1700 1700 23" _null_ _null_ _null_ _null_ width_bucket_numeric _null_ _null_ _null_ )); DESCR("bucket number of operand in equidepth histogram"); DATA(insert OID = 1747 ( time_pl_interval PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1083 "1083 1186" _null_ _null_ _null_ _null_ time_pl_interval _null_ _null_ _null_ )); @@ -2640,7 +2640,7 @@ DATA(insert OID = 1766 ( numeric_smaller PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1 DESCR("smaller of two numbers"); DATA(insert OID = 1767 ( numeric_larger PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1700 "1700 1700" _null_ _null_ _null_ _null_ numeric_larger _null_ _null_ _null_ )); DESCR("larger of two numbers"); -DATA(insert OID = 1769 ( numeric_cmp PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "1700 1700" _null_ _null_ _null_ _null_ numeric_cmp _null_ _null_ _null_ )); +DATA(insert OID = 1769 ( numeric_cmp PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "1700 1700" _null_ _null_ _null_ _null_ numeric_cmp _null_ _null_ _null_ )); DESCR("compare two numbers"); DATA(insert OID = 1771 ( numeric_uminus PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ numeric_uminus _null_ _null_ _null_ )); DESCR("negate"); @@ -2700,25 +2700,25 @@ DATA(insert OID = 1812 ( bit_length PGNSP PGUID 14 1 0 0 f f f t f i 1 0 23 DESCR("length in bits"); /* Selectivity estimators for LIKE and related operators */ -DATA(insert OID = 1814 ( iclikesel PGNSP PGUID 12 1 0 0 f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ iclikesel _null_ _null_ _null_ )); +DATA(insert OID = 1814 ( iclikesel PGNSP PGUID 12 1 0 0 f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ iclikesel _null_ _null_ _null_ )); DESCR("restriction selectivity of ILIKE"); -DATA(insert OID = 1815 ( icnlikesel PGNSP PGUID 12 1 0 0 f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ icnlikesel _null_ _null_ _null_ )); +DATA(insert OID = 1815 ( icnlikesel PGNSP PGUID 12 1 0 0 f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ icnlikesel _null_ _null_ _null_ )); DESCR("restriction selectivity of NOT ILIKE"); DATA(insert OID = 1816 ( iclikejoinsel PGNSP PGUID 12 1 0 0 f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ iclikejoinsel _null_ _null_ _null_ )); DESCR("join selectivity of ILIKE"); DATA(insert OID = 1817 ( icnlikejoinsel PGNSP PGUID 12 1 0 0 f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ icnlikejoinsel _null_ _null_ _null_ )); DESCR("join selectivity of NOT ILIKE"); -DATA(insert OID = 1818 ( regexeqsel PGNSP PGUID 12 1 0 0 f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ regexeqsel _null_ _null_ _null_ )); +DATA(insert OID = 1818 ( regexeqsel PGNSP PGUID 12 1 0 0 f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ regexeqsel _null_ _null_ _null_ )); DESCR("restriction selectivity of regex match"); -DATA(insert OID = 1819 ( likesel PGNSP PGUID 12 1 0 0 f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ likesel _null_ _null_ _null_ )); +DATA(insert OID = 1819 ( likesel PGNSP PGUID 12 1 0 0 f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ likesel _null_ _null_ _null_ )); DESCR("restriction selectivity of LIKE"); -DATA(insert OID = 1820 ( icregexeqsel PGNSP PGUID 12 1 0 0 f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ icregexeqsel _null_ _null_ _null_ )); +DATA(insert OID = 1820 ( icregexeqsel PGNSP PGUID 12 1 0 0 f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ icregexeqsel _null_ _null_ _null_ )); DESCR("restriction selectivity of case-insensitive regex match"); -DATA(insert OID = 1821 ( regexnesel PGNSP PGUID 12 1 0 0 f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ regexnesel _null_ _null_ _null_ )); +DATA(insert OID = 1821 ( regexnesel PGNSP PGUID 12 1 0 0 f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ regexnesel _null_ _null_ _null_ )); DESCR("restriction selectivity of regex non-match"); -DATA(insert OID = 1822 ( nlikesel PGNSP PGUID 12 1 0 0 f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ nlikesel _null_ _null_ _null_ )); +DATA(insert OID = 1822 ( nlikesel PGNSP PGUID 12 1 0 0 f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ nlikesel _null_ _null_ _null_ )); DESCR("restriction selectivity of NOT LIKE"); -DATA(insert OID = 1823 ( icregexnesel PGNSP PGUID 12 1 0 0 f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ icregexnesel _null_ _null_ _null_ )); +DATA(insert OID = 1823 ( icregexnesel PGNSP PGUID 12 1 0 0 f f f t f s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ icregexnesel _null_ _null_ _null_ )); DESCR("restriction selectivity of case-insensitive regex non-match"); DATA(insert OID = 1824 ( regexeqjoinsel PGNSP PGUID 12 1 0 0 f f f t f s 5 0 701 "2281 26 2281 21 2281" _null_ _null_ _null_ _null_ regexeqjoinsel _null_ _null_ _null_ )); DESCR("join selectivity of regex match"); @@ -2756,11 +2756,11 @@ DATA(insert OID = 1836 ( int8_accum PGNSP PGUID 12 1 0 0 f f f t f i 2 0 123 DESCR("aggregate transition function"); DATA(insert OID = 2746 ( int8_avg_accum PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1231 "1231 20" _null_ _null_ _null_ _null_ int8_avg_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); -DATA(insert OID = 1837 ( numeric_avg PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "1231" _null_ _null_ _null_ _null_ numeric_avg _null_ _null_ _null_ )); +DATA(insert OID = 1837 ( numeric_avg PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "1231" _null_ _null_ _null_ _null_ numeric_avg _null_ _null_ _null_ )); DESCR("AVG aggregate final function"); -DATA(insert OID = 2514 ( numeric_var_pop PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "1231" _null_ _null_ _null_ _null_ numeric_var_pop _null_ _null_ _null_ )); +DATA(insert OID = 2514 ( numeric_var_pop PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "1231" _null_ _null_ _null_ _null_ numeric_var_pop _null_ _null_ _null_ )); DESCR("VAR_POP aggregate final function"); -DATA(insert OID = 1838 ( numeric_var_samp PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "1231" _null_ _null_ _null_ _null_ numeric_var_samp _null_ _null_ _null_ )); +DATA(insert OID = 1838 ( numeric_var_samp PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "1231" _null_ _null_ _null_ _null_ numeric_var_samp _null_ _null_ _null_ )); DESCR("VAR_SAMP aggregate final function"); DATA(insert OID = 2596 ( numeric_stddev_pop PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "1231" _null_ _null_ _null_ _null_ numeric_stddev_pop _null_ _null_ _null_ )); DESCR("STDDEV_POP aggregate final function"); @@ -2774,13 +2774,13 @@ DATA(insert OID = 1842 ( int8_sum PGNSP PGUID 12 1 0 0 f f f f f i 2 0 1700 DESCR("SUM(int8) transition function"); DATA(insert OID = 1843 ( interval_accum PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1187 "1187 1186" _null_ _null_ _null_ _null_ interval_accum _null_ _null_ _null_ )); DESCR("aggregate transition function"); -DATA(insert OID = 1844 ( interval_avg PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1186 "1187" _null_ _null_ _null_ _null_ interval_avg _null_ _null_ _null_ )); +DATA(insert OID = 1844 ( interval_avg PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1186 "1187" _null_ _null_ _null_ _null_ interval_avg _null_ _null_ _null_ )); DESCR("AVG aggregate final function"); DATA(insert OID = 1962 ( int2_avg_accum PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1016 "1016 21" _null_ _null_ _null_ _null_ int2_avg_accum _null_ _null_ _null_ )); DESCR("AVG(int2) transition function"); DATA(insert OID = 1963 ( int4_avg_accum PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1016 "1016 23" _null_ _null_ _null_ _null_ int4_avg_accum _null_ _null_ _null_ )); DESCR("AVG(int4) transition function"); -DATA(insert OID = 1964 ( int8_avg PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "1016" _null_ _null_ _null_ _null_ int8_avg _null_ _null_ _null_ )); +DATA(insert OID = 1964 ( int8_avg PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1700 "1016" _null_ _null_ _null_ _null_ int8_avg _null_ _null_ _null_ )); DESCR("AVG(int) aggregate final function"); DATA(insert OID = 2805 ( int8inc_float8_float8 PGNSP PGUID 12 1 0 0 f f f t f i 3 0 20 "20 701 701" _null_ _null_ _null_ _null_ int8inc_float8_float8 _null_ _null_ _null_ )); DESCR("REGR_COUNT(double, double) transition function"); @@ -2852,7 +2852,7 @@ DATA(insert OID = 1893 ( int2or PGNSP PGUID 12 1 0 0 f f f t f i 2 0 21 "21 DESCR("bitwise or"); DATA(insert OID = 1894 ( int2xor PGNSP PGUID 12 1 0 0 f f f t f i 2 0 21 "21 21" _null_ _null_ _null_ _null_ int2xor _null_ _null_ _null_ )); DESCR("bitwise xor"); -DATA(insert OID = 1895 ( int2not PGNSP PGUID 12 1 0 0 f f f t f i 1 0 21 "21" _null_ _null_ _null_ _null_ int2not _null_ _null_ _null_ )); +DATA(insert OID = 1895 ( int2not PGNSP PGUID 12 1 0 0 f f f t f i 1 0 21 "21" _null_ _null_ _null_ _null_ int2not _null_ _null_ _null_ )); DESCR("bitwise not"); DATA(insert OID = 1896 ( int2shl PGNSP PGUID 12 1 0 0 f f f t f i 2 0 21 "21 23" _null_ _null_ _null_ _null_ int2shl _null_ _null_ _null_ )); DESCR("bitwise shift left"); @@ -2865,7 +2865,7 @@ DATA(insert OID = 1899 ( int4or PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "23 DESCR("bitwise or"); DATA(insert OID = 1900 ( int4xor PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ int4xor _null_ _null_ _null_ )); DESCR("bitwise xor"); -DATA(insert OID = 1901 ( int4not PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ int4not _null_ _null_ _null_ )); +DATA(insert OID = 1901 ( int4not PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "23" _null_ _null_ _null_ _null_ int4not _null_ _null_ _null_ )); DESCR("bitwise not"); DATA(insert OID = 1902 ( int4shl PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "23 23" _null_ _null_ _null_ _null_ int4shl _null_ _null_ _null_ )); DESCR("bitwise shift left"); @@ -2878,7 +2878,7 @@ DATA(insert OID = 1905 ( int8or PGNSP PGUID 12 1 0 0 f f f t f i 2 0 20 "20 DESCR("bitwise or"); DATA(insert OID = 1906 ( int8xor PGNSP PGUID 12 1 0 0 f f f t f i 2 0 20 "20 20" _null_ _null_ _null_ _null_ int8xor _null_ _null_ _null_ )); DESCR("bitwise xor"); -DATA(insert OID = 1907 ( int8not PGNSP PGUID 12 1 0 0 f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ int8not _null_ _null_ _null_ )); +DATA(insert OID = 1907 ( int8not PGNSP PGUID 12 1 0 0 f f f t f i 1 0 20 "20" _null_ _null_ _null_ _null_ int8not _null_ _null_ _null_ )); DESCR("bitwise not"); DATA(insert OID = 1908 ( int8shl PGNSP PGUID 12 1 0 0 f f f t f i 2 0 20 "20 23" _null_ _null_ _null_ _null_ int8shl _null_ _null_ _null_ )); DESCR("bitwise shift left"); @@ -2995,9 +2995,9 @@ DATA(insert OID = 1940 ( pg_stat_get_backend_activity PGNSP PGUID 12 1 0 0 f f DESCR("statistics: current query of backend"); DATA(insert OID = 2853 ( pg_stat_get_backend_waiting PGNSP PGUID 12 1 0 0 f f f t f s 1 0 16 "23" _null_ _null_ _null_ _null_ pg_stat_get_backend_waiting _null_ _null_ _null_ )); DESCR("statistics: is backend currently waiting for a lock"); -DATA(insert OID = 2094 ( pg_stat_get_backend_activity_start PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1184 "23" _null_ _null_ _null_ _null_ pg_stat_get_backend_activity_start _null_ _null_ _null_ )); +DATA(insert OID = 2094 ( pg_stat_get_backend_activity_start PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1184 "23" _null_ _null_ _null_ _null_ pg_stat_get_backend_activity_start _null_ _null_ _null_ )); DESCR("statistics: start time for current query of backend"); -DATA(insert OID = 2857 ( pg_stat_get_backend_xact_start PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1184 "23" _null_ _null_ _null_ _null_ pg_stat_get_backend_xact_start _null_ _null_ _null_ )); +DATA(insert OID = 2857 ( pg_stat_get_backend_xact_start PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1184 "23" _null_ _null_ _null_ _null_ pg_stat_get_backend_xact_start _null_ _null_ _null_ )); DESCR("statistics: start time for backend's current transaction"); DATA(insert OID = 1391 ( pg_stat_get_backend_start PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1184 "23" _null_ _null_ _null_ _null_ pg_stat_get_backend_start _null_ _null_ _null_ )); DESCR("statistics: start time for current backend session"); @@ -3052,9 +3052,9 @@ DESCR("statistics: discard current transaction's statistics snapshot"); DATA(insert OID = 2274 ( pg_stat_reset PGNSP PGUID 12 1 0 0 f f f f f v 0 0 2278 "" _null_ _null_ _null_ _null_ pg_stat_reset _null_ _null_ _null_ )); DESCR("statistics: reset collected statistics for current database"); -DATA(insert OID = 1946 ( encode PGNSP PGUID 12 1 0 0 f f f t f i 2 0 25 "17 25" _null_ _null_ _null_ _null_ binary_encode _null_ _null_ _null_ )); +DATA(insert OID = 1946 ( encode PGNSP PGUID 12 1 0 0 f f f t f i 2 0 25 "17 25" _null_ _null_ _null_ _null_ binary_encode _null_ _null_ _null_ )); DESCR("convert bytea value into some ascii-only text string"); -DATA(insert OID = 1947 ( decode PGNSP PGUID 12 1 0 0 f f f t f i 2 0 17 "25 25" _null_ _null_ _null_ _null_ binary_decode _null_ _null_ _null_ )); +DATA(insert OID = 1947 ( decode PGNSP PGUID 12 1 0 0 f f f t f i 2 0 17 "25 25" _null_ _null_ _null_ _null_ binary_decode _null_ _null_ _null_ )); DESCR("convert ascii-encoded text string into bytea value"); DATA(insert OID = 1948 ( byteaeq PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "17 17" _null_ _null_ _null_ _null_ byteaeq _null_ _null_ _null_ )); @@ -3102,7 +3102,7 @@ DATA(insert OID = 2008 ( notlike PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1 DESCR("does not match LIKE expression"); DATA(insert OID = 2009 ( like_escape PGNSP PGUID 12 1 0 0 f f f t f i 2 0 17 "17 17" _null_ _null_ _null_ _null_ like_escape_bytea _null_ _null_ _null_ )); DESCR("convert LIKE pattern to use backslash escapes"); -DATA(insert OID = 2010 ( length PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "17" _null_ _null_ _null_ _null_ byteaoctetlen _null_ _null_ _null_ )); +DATA(insert OID = 2010 ( length PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "17" _null_ _null_ _null_ _null_ byteaoctetlen _null_ _null_ _null_ )); DESCR("octet length"); DATA(insert OID = 2011 ( byteacat PGNSP PGUID 12 1 0 0 f f f t f i 2 0 17 "17 17" _null_ _null_ _null_ _null_ byteacat _null_ _null_ _null_ )); DESCR("concatenate"); @@ -3121,11 +3121,11 @@ DESCR("trim both ends of string"); DATA(insert OID = 2019 ( time PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1083 "1184" _null_ _null_ _null_ _null_ timestamptz_time _null_ _null_ _null_ )); DESCR("convert timestamptz to time"); -DATA(insert OID = 2020 ( date_trunc PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1114 "25 1114" _null_ _null_ _null_ _null_ timestamp_trunc _null_ _null_ _null_ )); +DATA(insert OID = 2020 ( date_trunc PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1114 "25 1114" _null_ _null_ _null_ _null_ timestamp_trunc _null_ _null_ _null_ )); DESCR("truncate timestamp to specified units"); DATA(insert OID = 2021 ( date_part PGNSP PGUID 12 1 0 0 f f f t f i 2 0 701 "25 1114" _null_ _null_ _null_ _null_ timestamp_part _null_ _null_ _null_ )); DESCR("extract field from timestamp"); -DATA(insert OID = 2023 ( timestamp PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1114 "702" _null_ _null_ _null_ _null_ abstime_timestamp _null_ _null_ _null_ )); +DATA(insert OID = 2023 ( timestamp PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1114 "702" _null_ _null_ _null_ _null_ abstime_timestamp _null_ _null_ _null_ )); DESCR("convert abstime to timestamp"); DATA(insert OID = 2024 ( timestamp PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1114 "1082" _null_ _null_ _null_ _null_ date_timestamp _null_ _null_ _null_ )); DESCR("convert date to timestamp"); @@ -3149,7 +3149,7 @@ DATA(insert OID = 2035 ( timestamp_smaller PGNSP PGUID 12 1 0 0 f f f t f i 2 0 DESCR("smaller of two"); DATA(insert OID = 2036 ( timestamp_larger PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1114 "1114 1114" _null_ _null_ _null_ _null_ timestamp_larger _null_ _null_ _null_ )); DESCR("larger of two"); -DATA(insert OID = 2037 ( timezone PGNSP PGUID 12 1 0 0 f f f t f v 2 0 1266 "25 1266" _null_ _null_ _null_ _null_ timetz_zone _null_ _null_ _null_ )); +DATA(insert OID = 2037 ( timezone PGNSP PGUID 12 1 0 0 f f f t f v 2 0 1266 "25 1266" _null_ _null_ _null_ _null_ timetz_zone _null_ _null_ _null_ )); DESCR("adjust time with time zone to new zone"); DATA(insert OID = 2038 ( timezone PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1266 "1186 1266" _null_ _null_ _null_ _null_ timetz_izone _null_ _null_ _null_ )); DESCR("adjust time with time zone to new zone"); @@ -3173,24 +3173,24 @@ DATA(insert OID = 2048 ( isfinite PGNSP PGUID 12 1 0 0 f f f t f i 1 0 16 "11 DESCR("finite timestamp?"); DATA(insert OID = 2049 ( to_char PGNSP PGUID 12 1 0 0 f f f t f s 2 0 25 "1114 25" _null_ _null_ _null_ _null_ timestamp_to_char _null_ _null_ _null_ )); DESCR("format timestamp to text"); -DATA(insert OID = 2052 ( timestamp_eq PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ timestamp_eq _null_ _null_ _null_ )); +DATA(insert OID = 2052 ( timestamp_eq PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ timestamp_eq _null_ _null_ _null_ )); DESCR("equal"); -DATA(insert OID = 2053 ( timestamp_ne PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ timestamp_ne _null_ _null_ _null_ )); +DATA(insert OID = 2053 ( timestamp_ne PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ timestamp_ne _null_ _null_ _null_ )); DESCR("not equal"); -DATA(insert OID = 2054 ( timestamp_lt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ timestamp_lt _null_ _null_ _null_ )); +DATA(insert OID = 2054 ( timestamp_lt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ timestamp_lt _null_ _null_ _null_ )); DESCR("less-than"); -DATA(insert OID = 2055 ( timestamp_le PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ timestamp_le _null_ _null_ _null_ )); +DATA(insert OID = 2055 ( timestamp_le PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ timestamp_le _null_ _null_ _null_ )); DESCR("less-than-or-equal"); -DATA(insert OID = 2056 ( timestamp_ge PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ timestamp_ge _null_ _null_ _null_ )); +DATA(insert OID = 2056 ( timestamp_ge PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ timestamp_ge _null_ _null_ _null_ )); DESCR("greater-than-or-equal"); -DATA(insert OID = 2057 ( timestamp_gt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ timestamp_gt _null_ _null_ _null_ )); +DATA(insert OID = 2057 ( timestamp_gt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "1114 1114" _null_ _null_ _null_ _null_ timestamp_gt _null_ _null_ _null_ )); DESCR("greater-than"); DATA(insert OID = 2058 ( age PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1186 "1114 1114" _null_ _null_ _null_ _null_ timestamp_age _null_ _null_ _null_ )); DESCR("date difference preserving months and years"); DATA(insert OID = 2059 ( age PGNSP PGUID 14 1 0 0 f f f t f s 1 0 1186 "1114" _null_ _null_ _null_ _null_ "select pg_catalog.age(cast(current_date as timestamp without time zone), $1)" _null_ _null_ _null_ )); DESCR("date difference from today preserving months and years"); -DATA(insert OID = 2069 ( timezone PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1184 "25 1114" _null_ _null_ _null_ _null_ timestamp_zone _null_ _null_ _null_ )); +DATA(insert OID = 2069 ( timezone PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1184 "25 1114" _null_ _null_ _null_ _null_ timestamp_zone _null_ _null_ _null_ )); DESCR("adjust timestamp to new time zone"); DATA(insert OID = 2070 ( timezone PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1184 "1186 1114" _null_ _null_ _null_ _null_ timestamp_izone _null_ _null_ _null_ )); DESCR("adjust timestamp to new time zone"); @@ -3199,7 +3199,7 @@ DESCR("add"); DATA(insert OID = 2072 ( date_mi_interval PGNSP PGUID 12 1 0 0 f f f t f i 2 0 1114 "1082 1186" _null_ _null_ _null_ _null_ date_mi_interval _null_ _null_ _null_ )); DESCR("subtract"); -DATA(insert OID = 2073 ( substring PGNSP PGUID 12 1 0 0 f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ textregexsubstr _null_ _null_ _null_ )); +DATA(insert OID = 2073 ( substring PGNSP PGUID 12 1 0 0 f f f t f i 2 0 25 "25 25" _null_ _null_ _null_ _null_ textregexsubstr _null_ _null_ _null_ )); DESCR("extracts text matching regular expression"); DATA(insert OID = 2074 ( substring PGNSP PGUID 14 1 0 0 f f f t f i 3 0 25 "25 25 25" _null_ _null_ _null_ _null_ "select pg_catalog.substring($1, pg_catalog.similar_escape($2, $3))" _null_ _null_ _null_ )); DESCR("extracts text matching SQL99 regular expression"); @@ -3284,32 +3284,32 @@ DESCR("convert boolean to text"); /* Aggregates (moved here from pg_aggregate for 7.3) */ -DATA(insert OID = 2100 ( avg PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2100 ( avg PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("the average (arithmetic mean) as numeric of all bigint values"); -DATA(insert OID = 2101 ( avg PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2101 ( avg PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("the average (arithmetic mean) as numeric of all integer values"); -DATA(insert OID = 2102 ( avg PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2102 ( avg PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("the average (arithmetic mean) as numeric of all smallint values"); DATA(insert OID = 2103 ( avg PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("the average (arithmetic mean) as numeric of all numeric values"); -DATA(insert OID = 2104 ( avg PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2104 ( avg PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("the average (arithmetic mean) as float8 of all float4 values"); -DATA(insert OID = 2105 ( avg PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2105 ( avg PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("the average (arithmetic mean) as float8 of all float8 values"); DATA(insert OID = 2106 ( avg PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("the average (arithmetic mean) as interval of all interval values"); -DATA(insert OID = 2107 ( sum PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2107 ( sum PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum as numeric across all bigint input values"); DATA(insert OID = 2108 ( sum PGNSP PGUID 12 1 0 0 t f f f f i 1 0 20 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum as bigint across all integer input values"); DATA(insert OID = 2109 ( sum PGNSP PGUID 12 1 0 0 t f f f f i 1 0 20 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum as bigint across all smallint input values"); -DATA(insert OID = 2110 ( sum PGNSP PGUID 12 1 0 0 t f f f f i 1 0 700 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2110 ( sum PGNSP PGUID 12 1 0 0 t f f f f i 1 0 700 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum as float4 across all float4 input values"); -DATA(insert OID = 2111 ( sum PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2111 ( sum PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum as float8 across all float8 input values"); -DATA(insert OID = 2112 ( sum PGNSP PGUID 12 1 0 0 t f f f f i 1 0 790 "790" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2112 ( sum PGNSP PGUID 12 1 0 0 t f f f f i 1 0 790 "790" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum as money across all money input values"); DATA(insert OID = 2113 ( sum PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1186 "1186" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum as interval across all interval input values"); @@ -3324,11 +3324,11 @@ DATA(insert OID = 2117 ( max PGNSP PGUID 12 1 0 0 t f f f f i 1 0 21 "21" _n DESCR("maximum value of all smallint input values"); DATA(insert OID = 2118 ( max PGNSP PGUID 12 1 0 0 t f f f f i 1 0 26 "26" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all oid input values"); -DATA(insert OID = 2119 ( max PGNSP PGUID 12 1 0 0 t f f f f i 1 0 700 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2119 ( max PGNSP PGUID 12 1 0 0 t f f f f i 1 0 700 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all float4 input values"); -DATA(insert OID = 2120 ( max PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2120 ( max PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all float8 input values"); -DATA(insert OID = 2121 ( max PGNSP PGUID 12 1 0 0 t f f f f i 1 0 702 "702" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2121 ( max PGNSP PGUID 12 1 0 0 t f f f f i 1 0 702 "702" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all abstime input values"); DATA(insert OID = 2122 ( max PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1082 "1082" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all date input values"); @@ -3336,7 +3336,7 @@ DATA(insert OID = 2123 ( max PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1083 "1083 DESCR("maximum value of all time input values"); DATA(insert OID = 2124 ( max PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1266 "1266" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all time with time zone input values"); -DATA(insert OID = 2125 ( max PGNSP PGUID 12 1 0 0 t f f f f i 1 0 790 "790" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2125 ( max PGNSP PGUID 12 1 0 0 t f f f f i 1 0 790 "790" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all money input values"); DATA(insert OID = 2126 ( max PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1114 "1114" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("maximum value of all timestamp input values"); @@ -3363,11 +3363,11 @@ DATA(insert OID = 2133 ( min PGNSP PGUID 12 1 0 0 t f f f f i 1 0 21 "21" _n DESCR("minimum value of all smallint input values"); DATA(insert OID = 2134 ( min PGNSP PGUID 12 1 0 0 t f f f f i 1 0 26 "26" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all oid input values"); -DATA(insert OID = 2135 ( min PGNSP PGUID 12 1 0 0 t f f f f i 1 0 700 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2135 ( min PGNSP PGUID 12 1 0 0 t f f f f i 1 0 700 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all float4 input values"); -DATA(insert OID = 2136 ( min PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2136 ( min PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all float8 input values"); -DATA(insert OID = 2137 ( min PGNSP PGUID 12 1 0 0 t f f f f i 1 0 702 "702" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2137 ( min PGNSP PGUID 12 1 0 0 t f f f f i 1 0 702 "702" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all abstime input values"); DATA(insert OID = 2138 ( min PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1082 "1082" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all date input values"); @@ -3375,7 +3375,7 @@ DATA(insert OID = 2139 ( min PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1083 "1083 DESCR("minimum value of all time input values"); DATA(insert OID = 2140 ( min PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1266 "1266" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all time with time zone input values"); -DATA(insert OID = 2141 ( min PGNSP PGUID 12 1 0 0 t f f f f i 1 0 790 "790" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2141 ( min PGNSP PGUID 12 1 0 0 t f f f f i 1 0 790 "790" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all money input values"); DATA(insert OID = 2142 ( min PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1114 "1114" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("minimum value of all timestamp input values"); @@ -3395,114 +3395,114 @@ DATA(insert OID = 2798 ( min PGNSP PGUID 12 1 0 0 t f f f f i 1 0 27 "27" _n DESCR("minimum value of all tid input values"); /* count has two forms: count(any) and count(*) */ -DATA(insert OID = 2147 ( count PGNSP PGUID 12 1 0 0 t f f f f i 1 0 20 "2276" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2147 ( count PGNSP PGUID 12 1 0 0 t f f f f i 1 0 20 "2276" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("number of input rows for which the input expression is not null"); -DATA(insert OID = 2803 ( count PGNSP PGUID 12 1 0 0 t f f f f i 0 0 20 "" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2803 ( count PGNSP PGUID 12 1 0 0 t f f f f i 0 0 20 "" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("number of input rows"); -DATA(insert OID = 2718 ( var_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2718 ( var_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population variance of bigint input values (square of the population standard deviation)"); -DATA(insert OID = 2719 ( var_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2719 ( var_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population variance of integer input values (square of the population standard deviation)"); -DATA(insert OID = 2720 ( var_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2720 ( var_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population variance of smallint input values (square of the population standard deviation)"); -DATA(insert OID = 2721 ( var_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2721 ( var_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population variance of float4 input values (square of the population standard deviation)"); -DATA(insert OID = 2722 ( var_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2722 ( var_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population variance of float8 input values (square of the population standard deviation)"); DATA(insert OID = 2723 ( var_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population variance of numeric input values (square of the population standard deviation)"); -DATA(insert OID = 2641 ( var_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2641 ( var_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample variance of bigint input values (square of the sample standard deviation)"); -DATA(insert OID = 2642 ( var_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2642 ( var_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample variance of integer input values (square of the sample standard deviation)"); -DATA(insert OID = 2643 ( var_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2643 ( var_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample variance of smallint input values (square of the sample standard deviation)"); -DATA(insert OID = 2644 ( var_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2644 ( var_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample variance of float4 input values (square of the sample standard deviation)"); -DATA(insert OID = 2645 ( var_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2645 ( var_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample variance of float8 input values (square of the sample standard deviation)"); DATA(insert OID = 2646 ( var_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample variance of numeric input values (square of the sample standard deviation)"); -DATA(insert OID = 2148 ( variance PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2148 ( variance PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for var_samp"); -DATA(insert OID = 2149 ( variance PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2149 ( variance PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for var_samp"); -DATA(insert OID = 2150 ( variance PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2150 ( variance PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for var_samp"); -DATA(insert OID = 2151 ( variance PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2151 ( variance PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for var_samp"); -DATA(insert OID = 2152 ( variance PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2152 ( variance PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for var_samp"); DATA(insert OID = 2153 ( variance PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for var_samp"); -DATA(insert OID = 2724 ( stddev_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2724 ( stddev_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population standard deviation of bigint input values"); -DATA(insert OID = 2725 ( stddev_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2725 ( stddev_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population standard deviation of integer input values"); -DATA(insert OID = 2726 ( stddev_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2726 ( stddev_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population standard deviation of smallint input values"); -DATA(insert OID = 2727 ( stddev_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2727 ( stddev_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population standard deviation of float4 input values"); -DATA(insert OID = 2728 ( stddev_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2728 ( stddev_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population standard deviation of float8 input values"); DATA(insert OID = 2729 ( stddev_pop PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population standard deviation of numeric input values"); -DATA(insert OID = 2712 ( stddev_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2712 ( stddev_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample standard deviation of bigint input values"); -DATA(insert OID = 2713 ( stddev_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2713 ( stddev_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample standard deviation of integer input values"); -DATA(insert OID = 2714 ( stddev_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2714 ( stddev_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample standard deviation of smallint input values"); -DATA(insert OID = 2715 ( stddev_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2715 ( stddev_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample standard deviation of float4 input values"); -DATA(insert OID = 2716 ( stddev_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2716 ( stddev_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample standard deviation of float8 input values"); DATA(insert OID = 2717 ( stddev_samp PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample standard deviation of numeric input values"); -DATA(insert OID = 2154 ( stddev PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2154 ( stddev PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for stddev_samp"); -DATA(insert OID = 2155 ( stddev PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2155 ( stddev PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "23" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for stddev_samp"); -DATA(insert OID = 2156 ( stddev PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2156 ( stddev PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "21" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for stddev_samp"); -DATA(insert OID = 2157 ( stddev PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2157 ( stddev PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for stddev_samp"); -DATA(insert OID = 2158 ( stddev PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2158 ( stddev PGNSP PGUID 12 1 0 0 t f f f f i 1 0 701 "701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for stddev_samp"); DATA(insert OID = 2159 ( stddev PGNSP PGUID 12 1 0 0 t f f f f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("historical alias for stddev_samp"); DATA(insert OID = 2818 ( regr_count PGNSP PGUID 12 1 0 0 t f f f f i 2 0 20 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("number of input rows in which both expressions are nonnull"); -DATA(insert OID = 2819 ( regr_sxx PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2819 ( regr_sxx PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum of squares of the independent variable (sum(X^2) - sum(X)^2/N)"); -DATA(insert OID = 2820 ( regr_syy PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2820 ( regr_syy PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum of squares of the dependent variable (sum(Y^2) - sum(Y)^2/N)"); -DATA(insert OID = 2821 ( regr_sxy PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2821 ( regr_sxy PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sum of products of independent times dependent variable (sum(X*Y) - sum(X) * sum(Y)/N)"); -DATA(insert OID = 2822 ( regr_avgx PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2822 ( regr_avgx PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("average of the independent variable (sum(X)/N)"); -DATA(insert OID = 2823 ( regr_avgy PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2823 ( regr_avgy PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("average of the dependent variable (sum(Y)/N)"); -DATA(insert OID = 2824 ( regr_r2 PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2824 ( regr_r2 PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("square of the correlation coefficient"); -DATA(insert OID = 2825 ( regr_slope PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2825 ( regr_slope PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("slope of the least-squares-fit linear equation determined by the (X, Y) pairs"); -DATA(insert OID = 2826 ( regr_intercept PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2826 ( regr_intercept PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("y-intercept of the least-squares-fit linear equation determined by the (X, Y) pairs"); -DATA(insert OID = 2827 ( covar_pop PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2827 ( covar_pop PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("population covariance"); -DATA(insert OID = 2828 ( covar_samp PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2828 ( covar_samp PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("sample covariance"); -DATA(insert OID = 2829 ( corr PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); +DATA(insert OID = 2829 ( corr PGNSP PGUID 12 1 0 0 t f f f f i 2 0 701 "701 701" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ )); DESCR("correlation coefficient"); DATA(insert OID = 2160 ( text_pattern_lt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "25 25" _null_ _null_ _null_ _null_ text_pattern_lt _null_ _null_ _null_ )); @@ -3661,7 +3661,7 @@ DESCR("current user privilege on role by role name"); DATA(insert OID = 2710 ( pg_has_role PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ pg_has_role_id _null_ _null_ _null_ )); DESCR("current user privilege on role by role oid"); -DATA(insert OID = 1269 ( pg_column_size PGNSP PGUID 12 1 0 0 f f f t f s 1 0 23 "2276" _null_ _null_ _null_ _null_ pg_column_size _null_ _null_ _null_ )); +DATA(insert OID = 1269 ( pg_column_size PGNSP PGUID 12 1 0 0 f f f t f s 1 0 23 "2276" _null_ _null_ _null_ _null_ pg_column_size _null_ _null_ _null_ )); DESCR("bytes required to store the value, perhaps with compression"); DATA(insert OID = 2322 ( pg_tablespace_size PGNSP PGUID 12 1 0 0 f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_tablespace_size_oid _null_ _null_ _null_ )); DESCR("total disk space usage for the specified tablespace"); @@ -3736,9 +3736,9 @@ DATA(insert OID = 2778 ( anynonarray_out PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2 DESCR("I/O"); /* cryptographic */ -DATA(insert OID = 2311 ( md5 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ md5_text _null_ _null_ _null_ )); +DATA(insert OID = 2311 ( md5 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ md5_text _null_ _null_ _null_ )); DESCR("calculates md5 hash"); -DATA(insert OID = 2321 ( md5 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "17" _null_ _null_ _null_ _null_ md5_bytea _null_ _null_ _null_ )); +DATA(insert OID = 2321 ( md5 PGNSP PGUID 12 1 0 0 f f f t f i 1 0 25 "17" _null_ _null_ _null_ _null_ md5_bytea _null_ _null_ _null_ )); DESCR("calculates md5 hash"); /* crosstype operations for date vs. timestamp and timestamptz */ @@ -3803,34 +3803,34 @@ DATA(insert OID = 2383 ( timestamptz_cmp_date PGNSP PGUID 12 1 0 0 f f f t f DESCR("less-equal-greater"); /* crosstype operations for timestamp vs. timestamptz */ -DATA(insert OID = 2520 ( timestamp_lt_timestamptz PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ timestamp_lt_timestamptz _null_ _null_ _null_ )); +DATA(insert OID = 2520 ( timestamp_lt_timestamptz PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ timestamp_lt_timestamptz _null_ _null_ _null_ )); DESCR("less-than"); -DATA(insert OID = 2521 ( timestamp_le_timestamptz PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ timestamp_le_timestamptz _null_ _null_ _null_ )); +DATA(insert OID = 2521 ( timestamp_le_timestamptz PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ timestamp_le_timestamptz _null_ _null_ _null_ )); DESCR("less-than-or-equal"); -DATA(insert OID = 2522 ( timestamp_eq_timestamptz PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ timestamp_eq_timestamptz _null_ _null_ _null_ )); +DATA(insert OID = 2522 ( timestamp_eq_timestamptz PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ timestamp_eq_timestamptz _null_ _null_ _null_ )); DESCR("equal"); -DATA(insert OID = 2523 ( timestamp_gt_timestamptz PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ timestamp_gt_timestamptz _null_ _null_ _null_ )); +DATA(insert OID = 2523 ( timestamp_gt_timestamptz PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ timestamp_gt_timestamptz _null_ _null_ _null_ )); DESCR("greater-than"); -DATA(insert OID = 2524 ( timestamp_ge_timestamptz PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ timestamp_ge_timestamptz _null_ _null_ _null_ )); +DATA(insert OID = 2524 ( timestamp_ge_timestamptz PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ timestamp_ge_timestamptz _null_ _null_ _null_ )); DESCR("greater-than-or-equal"); -DATA(insert OID = 2525 ( timestamp_ne_timestamptz PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ timestamp_ne_timestamptz _null_ _null_ _null_ )); +DATA(insert OID = 2525 ( timestamp_ne_timestamptz PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1114 1184" _null_ _null_ _null_ _null_ timestamp_ne_timestamptz _null_ _null_ _null_ )); DESCR("not equal"); -DATA(insert OID = 2526 ( timestamp_cmp_timestamptz PGNSP PGUID 12 1 0 0 f f f t f s 2 0 23 "1114 1184" _null_ _null_ _null_ _null_ timestamp_cmp_timestamptz _null_ _null_ _null_ )); +DATA(insert OID = 2526 ( timestamp_cmp_timestamptz PGNSP PGUID 12 1 0 0 f f f t f s 2 0 23 "1114 1184" _null_ _null_ _null_ _null_ timestamp_cmp_timestamptz _null_ _null_ _null_ )); DESCR("less-equal-greater"); -DATA(insert OID = 2527 ( timestamptz_lt_timestamp PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_lt_timestamp _null_ _null_ _null_ )); +DATA(insert OID = 2527 ( timestamptz_lt_timestamp PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_lt_timestamp _null_ _null_ _null_ )); DESCR("less-than"); -DATA(insert OID = 2528 ( timestamptz_le_timestamp PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_le_timestamp _null_ _null_ _null_ )); +DATA(insert OID = 2528 ( timestamptz_le_timestamp PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_le_timestamp _null_ _null_ _null_ )); DESCR("less-than-or-equal"); -DATA(insert OID = 2529 ( timestamptz_eq_timestamp PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_eq_timestamp _null_ _null_ _null_ )); +DATA(insert OID = 2529 ( timestamptz_eq_timestamp PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_eq_timestamp _null_ _null_ _null_ )); DESCR("equal"); -DATA(insert OID = 2530 ( timestamptz_gt_timestamp PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_gt_timestamp _null_ _null_ _null_ )); +DATA(insert OID = 2530 ( timestamptz_gt_timestamp PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_gt_timestamp _null_ _null_ _null_ )); DESCR("greater-than"); -DATA(insert OID = 2531 ( timestamptz_ge_timestamp PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_ge_timestamp _null_ _null_ _null_ )); +DATA(insert OID = 2531 ( timestamptz_ge_timestamp PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_ge_timestamp _null_ _null_ _null_ )); DESCR("greater-than-or-equal"); -DATA(insert OID = 2532 ( timestamptz_ne_timestamp PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_ne_timestamp _null_ _null_ _null_ )); +DATA(insert OID = 2532 ( timestamptz_ne_timestamp PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_ne_timestamp _null_ _null_ _null_ )); DESCR("not equal"); -DATA(insert OID = 2533 ( timestamptz_cmp_timestamp PGNSP PGUID 12 1 0 0 f f f t f s 2 0 23 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_cmp_timestamp _null_ _null_ _null_ )); +DATA(insert OID = 2533 ( timestamptz_cmp_timestamp PGNSP PGUID 12 1 0 0 f f f t f s 2 0 23 "1184 1114" _null_ _null_ _null_ _null_ timestamptz_cmp_timestamp _null_ _null_ _null_ )); DESCR("less-equal-greater"); @@ -3845,53 +3845,53 @@ DATA(insert OID = 2403 ( record_send PGNSP PGUID 12 1 0 0 f f f t f v 1 0 1 DESCR("I/O"); DATA(insert OID = 2404 ( int2recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 21 "2281" _null_ _null_ _null_ _null_ int2recv _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2405 ( int2send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "21" _null_ _null_ _null_ _null_ int2send _null_ _null_ _null_ )); +DATA(insert OID = 2405 ( int2send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "21" _null_ _null_ _null_ _null_ int2send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2406 ( int4recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 23 "2281" _null_ _null_ _null_ _null_ int4recv _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2407 ( int4send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "23" _null_ _null_ _null_ _null_ int4send _null_ _null_ _null_ )); +DATA(insert OID = 2407 ( int4send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "23" _null_ _null_ _null_ _null_ int4send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2408 ( int8recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 20 "2281" _null_ _null_ _null_ _null_ int8recv _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2409 ( int8send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "20" _null_ _null_ _null_ _null_ int8send _null_ _null_ _null_ )); +DATA(insert OID = 2409 ( int8send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "20" _null_ _null_ _null_ _null_ int8send _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2410 ( int2vectorrecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 22 "2281" _null_ _null_ _null_ _null_ int2vectorrecv _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2411 ( int2vectorsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "22" _null_ _null_ _null_ _null_ int2vectorsend _null_ _null_ _null_ )); +DATA(insert OID = 2411 ( int2vectorsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "22" _null_ _null_ _null_ _null_ int2vectorsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2412 ( bytearecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "2281" _null_ _null_ _null_ _null_ bytearecv _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2413 ( byteasend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "17" _null_ _null_ _null_ _null_ byteasend _null_ _null_ _null_ )); +DATA(insert OID = 2413 ( byteasend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "17" _null_ _null_ _null_ _null_ byteasend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2414 ( textrecv PGNSP PGUID 12 1 0 0 f f f t f s 1 0 25 "2281" _null_ _null_ _null_ _null_ textrecv _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2415 ( textsend PGNSP PGUID 12 1 0 0 f f f t f s 1 0 17 "25" _null_ _null_ _null_ _null_ textsend _null_ _null_ _null_ )); +DATA(insert OID = 2415 ( textsend PGNSP PGUID 12 1 0 0 f f f t f s 1 0 17 "25" _null_ _null_ _null_ _null_ textsend _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2416 ( unknownrecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 705 "2281" _null_ _null_ _null_ _null_ unknownrecv _null_ _null_ _null_ )); +DATA(insert OID = 2416 ( unknownrecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 705 "2281" _null_ _null_ _null_ _null_ unknownrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2417 ( unknownsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "705" _null_ _null_ _null_ _null_ unknownsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2418 ( oidrecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 26 "2281" _null_ _null_ _null_ _null_ oidrecv _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2419 ( oidsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "26" _null_ _null_ _null_ _null_ oidsend _null_ _null_ _null_ )); +DATA(insert OID = 2419 ( oidsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "26" _null_ _null_ _null_ _null_ oidsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2420 ( oidvectorrecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 30 "2281" _null_ _null_ _null_ _null_ oidvectorrecv _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2421 ( oidvectorsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "30" _null_ _null_ _null_ _null_ oidvectorsend _null_ _null_ _null_ )); +DATA(insert OID = 2421 ( oidvectorsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "30" _null_ _null_ _null_ _null_ oidvectorsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2422 ( namerecv PGNSP PGUID 12 1 0 0 f f f t f s 1 0 19 "2281" _null_ _null_ _null_ _null_ namerecv _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2423 ( namesend PGNSP PGUID 12 1 0 0 f f f t f s 1 0 17 "19" _null_ _null_ _null_ _null_ namesend _null_ _null_ _null_ )); +DATA(insert OID = 2423 ( namesend PGNSP PGUID 12 1 0 0 f f f t f s 1 0 17 "19" _null_ _null_ _null_ _null_ namesend _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2424 ( float4recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 700 "2281" _null_ _null_ _null_ _null_ float4recv _null_ _null_ _null_ )); +DATA(insert OID = 2424 ( float4recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 700 "2281" _null_ _null_ _null_ _null_ float4recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2425 ( float4send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "700" _null_ _null_ _null_ _null_ float4send _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2426 ( float8recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "2281" _null_ _null_ _null_ _null_ float8recv _null_ _null_ _null_ )); +DATA(insert OID = 2426 ( float8recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 701 "2281" _null_ _null_ _null_ _null_ float8recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2427 ( float8send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "701" _null_ _null_ _null_ _null_ float8send _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2428 ( point_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 600 "2281" _null_ _null_ _null_ _null_ point_recv _null_ _null_ _null_ )); +DATA(insert OID = 2428 ( point_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 600 "2281" _null_ _null_ _null_ _null_ point_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2429 ( point_send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "600" _null_ _null_ _null_ _null_ point_send _null_ _null_ _null_ )); DESCR("I/O"); @@ -3905,45 +3905,45 @@ DATA(insert OID = 2433 ( varcharsend PGNSP PGUID 12 1 0 0 f f f t f s 1 0 1 DESCR("I/O"); DATA(insert OID = 2434 ( charrecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 18 "2281" _null_ _null_ _null_ _null_ charrecv _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2435 ( charsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "18" _null_ _null_ _null_ _null_ charsend _null_ _null_ _null_ )); +DATA(insert OID = 2435 ( charsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "18" _null_ _null_ _null_ _null_ charsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2436 ( boolrecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 16 "2281" _null_ _null_ _null_ _null_ boolrecv _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2437 ( boolsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "16" _null_ _null_ _null_ _null_ boolsend _null_ _null_ _null_ )); +DATA(insert OID = 2437 ( boolsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "16" _null_ _null_ _null_ _null_ boolsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2438 ( tidrecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 27 "2281" _null_ _null_ _null_ _null_ tidrecv _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2439 ( tidsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "27" _null_ _null_ _null_ _null_ tidsend _null_ _null_ _null_ )); +DATA(insert OID = 2439 ( tidsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "27" _null_ _null_ _null_ _null_ tidsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2440 ( xidrecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 28 "2281" _null_ _null_ _null_ _null_ xidrecv _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2441 ( xidsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "28" _null_ _null_ _null_ _null_ xidsend _null_ _null_ _null_ )); +DATA(insert OID = 2441 ( xidsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "28" _null_ _null_ _null_ _null_ xidsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2442 ( cidrecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 29 "2281" _null_ _null_ _null_ _null_ cidrecv _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2443 ( cidsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "29" _null_ _null_ _null_ _null_ cidsend _null_ _null_ _null_ )); +DATA(insert OID = 2443 ( cidsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "29" _null_ _null_ _null_ _null_ cidsend _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2444 ( regprocrecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 24 "2281" _null_ _null_ _null_ _null_ regprocrecv _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2445 ( regprocsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "24" _null_ _null_ _null_ _null_ regprocsend _null_ _null_ _null_ )); +DATA(insert OID = 2445 ( regprocsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "24" _null_ _null_ _null_ _null_ regprocsend _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2446 ( regprocedurerecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2202 "2281" _null_ _null_ _null_ _null_ regprocedurerecv _null_ _null_ _null_ )); +DATA(insert OID = 2446 ( regprocedurerecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2202 "2281" _null_ _null_ _null_ _null_ regprocedurerecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2447 ( regproceduresend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "2202" _null_ _null_ _null_ _null_ regproceduresend _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2448 ( regoperrecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2203 "2281" _null_ _null_ _null_ _null_ regoperrecv _null_ _null_ _null_ )); +DATA(insert OID = 2448 ( regoperrecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2203 "2281" _null_ _null_ _null_ _null_ regoperrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2449 ( regopersend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "2203" _null_ _null_ _null_ _null_ regopersend _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2450 ( regoperatorrecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2204 "2281" _null_ _null_ _null_ _null_ regoperatorrecv _null_ _null_ _null_ )); +DATA(insert OID = 2450 ( regoperatorrecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2204 "2281" _null_ _null_ _null_ _null_ regoperatorrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2451 ( regoperatorsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "2204" _null_ _null_ _null_ _null_ regoperatorsend _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2452 ( regclassrecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2205 "2281" _null_ _null_ _null_ _null_ regclassrecv _null_ _null_ _null_ )); +DATA(insert OID = 2452 ( regclassrecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2205 "2281" _null_ _null_ _null_ _null_ regclassrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2453 ( regclasssend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "2205" _null_ _null_ _null_ _null_ regclasssend _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2454 ( regtyperecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2206 "2281" _null_ _null_ _null_ _null_ regtyperecv _null_ _null_ _null_ )); +DATA(insert OID = 2454 ( regtyperecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 2206 "2281" _null_ _null_ _null_ _null_ regtyperecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2455 ( regtypesend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "2206" _null_ _null_ _null_ _null_ regtypesend _null_ _null_ _null_ )); DESCR("I/O"); @@ -3959,19 +3959,19 @@ DATA(insert OID = 2460 ( numeric_recv PGNSP PGUID 12 1 0 0 f f f t f i 3 0 DESCR("I/O"); DATA(insert OID = 2461 ( numeric_send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "1700" _null_ _null_ _null_ _null_ numeric_send _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2462 ( abstimerecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 702 "2281" _null_ _null_ _null_ _null_ abstimerecv _null_ _null_ _null_ )); +DATA(insert OID = 2462 ( abstimerecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 702 "2281" _null_ _null_ _null_ _null_ abstimerecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2463 ( abstimesend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "702" _null_ _null_ _null_ _null_ abstimesend _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2464 ( reltimerecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 703 "2281" _null_ _null_ _null_ _null_ reltimerecv _null_ _null_ _null_ )); +DATA(insert OID = 2464 ( reltimerecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 703 "2281" _null_ _null_ _null_ _null_ reltimerecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2465 ( reltimesend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "703" _null_ _null_ _null_ _null_ reltimesend _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2466 ( tintervalrecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 704 "2281" _null_ _null_ _null_ _null_ tintervalrecv _null_ _null_ _null_ )); +DATA(insert OID = 2466 ( tintervalrecv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 704 "2281" _null_ _null_ _null_ _null_ tintervalrecv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2467 ( tintervalsend PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "704" _null_ _null_ _null_ _null_ tintervalsend _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2468 ( date_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1082 "2281" _null_ _null_ _null_ _null_ date_recv _null_ _null_ _null_ )); +DATA(insert OID = 2468 ( date_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 1082 "2281" _null_ _null_ _null_ _null_ date_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2469 ( date_send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "1082" _null_ _null_ _null_ _null_ date_send _null_ _null_ _null_ )); DESCR("I/O"); @@ -3995,65 +3995,65 @@ DATA(insert OID = 2478 ( interval_recv PGNSP PGUID 12 1 0 0 f f f t f i 3 0 DESCR("I/O"); DATA(insert OID = 2479 ( interval_send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "1186" _null_ _null_ _null_ _null_ interval_send _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2480 ( lseg_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 601 "2281" _null_ _null_ _null_ _null_ lseg_recv _null_ _null_ _null_ )); +DATA(insert OID = 2480 ( lseg_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 601 "2281" _null_ _null_ _null_ _null_ lseg_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2481 ( lseg_send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "601" _null_ _null_ _null_ _null_ lseg_send _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2482 ( path_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 602 "2281" _null_ _null_ _null_ _null_ path_recv _null_ _null_ _null_ )); +DATA(insert OID = 2482 ( path_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 602 "2281" _null_ _null_ _null_ _null_ path_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2483 ( path_send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "602" _null_ _null_ _null_ _null_ path_send _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2484 ( box_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 603 "2281" _null_ _null_ _null_ _null_ box_recv _null_ _null_ _null_ )); +DATA(insert OID = 2484 ( box_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 603 "2281" _null_ _null_ _null_ _null_ box_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2485 ( box_send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "603" _null_ _null_ _null_ _null_ box_send _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2486 ( poly_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 604 "2281" _null_ _null_ _null_ _null_ poly_recv _null_ _null_ _null_ )); +DATA(insert OID = 2486 ( poly_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 604 "2281" _null_ _null_ _null_ _null_ poly_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2487 ( poly_send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "604" _null_ _null_ _null_ _null_ poly_send _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2488 ( line_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 628 "2281" _null_ _null_ _null_ _null_ line_recv _null_ _null_ _null_ )); +DATA(insert OID = 2488 ( line_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 628 "2281" _null_ _null_ _null_ _null_ line_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2489 ( line_send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "628" _null_ _null_ _null_ _null_ line_send _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2490 ( circle_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 718 "2281" _null_ _null_ _null_ _null_ circle_recv _null_ _null_ _null_ )); +DATA(insert OID = 2490 ( circle_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 718 "2281" _null_ _null_ _null_ _null_ circle_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2491 ( circle_send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "718" _null_ _null_ _null_ _null_ circle_send _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2492 ( cash_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 790 "2281" _null_ _null_ _null_ _null_ cash_recv _null_ _null_ _null_ )); +DATA(insert OID = 2492 ( cash_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 790 "2281" _null_ _null_ _null_ _null_ cash_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2493 ( cash_send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "790" _null_ _null_ _null_ _null_ cash_send _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2494 ( macaddr_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 829 "2281" _null_ _null_ _null_ _null_ macaddr_recv _null_ _null_ _null_ )); +DATA(insert OID = 2494 ( macaddr_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 829 "2281" _null_ _null_ _null_ _null_ macaddr_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2495 ( macaddr_send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "829" _null_ _null_ _null_ _null_ macaddr_send _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2496 ( inet_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 869 "2281" _null_ _null_ _null_ _null_ inet_recv _null_ _null_ _null_ )); +DATA(insert OID = 2496 ( inet_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 869 "2281" _null_ _null_ _null_ _null_ inet_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2497 ( inet_send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "869" _null_ _null_ _null_ _null_ inet_send _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2498 ( cidr_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 650 "2281" _null_ _null_ _null_ _null_ cidr_recv _null_ _null_ _null_ )); +DATA(insert OID = 2498 ( cidr_recv PGNSP PGUID 12 1 0 0 f f f t f i 1 0 650 "2281" _null_ _null_ _null_ _null_ cidr_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2499 ( cidr_send PGNSP PGUID 12 1 0 0 f f f t f i 1 0 17 "650" _null_ _null_ _null_ _null_ cidr_send _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2500 ( cstring_recv PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2275 "2281" _null_ _null_ _null_ _null_ cstring_recv _null_ _null_ _null_ )); +DATA(insert OID = 2500 ( cstring_recv PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2275 "2281" _null_ _null_ _null_ _null_ cstring_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2501 ( cstring_send PGNSP PGUID 12 1 0 0 f f f t f s 1 0 17 "2275" _null_ _null_ _null_ _null_ cstring_send _null_ _null_ _null_ )); DESCR("I/O"); -DATA(insert OID = 2502 ( anyarray_recv PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2277 "2281" _null_ _null_ _null_ _null_ anyarray_recv _null_ _null_ _null_ )); +DATA(insert OID = 2502 ( anyarray_recv PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2277 "2281" _null_ _null_ _null_ _null_ anyarray_recv _null_ _null_ _null_ )); DESCR("I/O"); DATA(insert OID = 2503 ( anyarray_send PGNSP PGUID 12 1 0 0 f f f t f s 1 0 17 "2277" _null_ _null_ _null_ _null_ anyarray_send _null_ _null_ _null_ )); DESCR("I/O"); /* System-view support functions with pretty-print option */ -DATA(insert OID = 2504 ( pg_get_ruledef PGNSP PGUID 12 1 0 0 f f f t f s 2 0 25 "26 16" _null_ _null_ _null_ _null_ pg_get_ruledef_ext _null_ _null_ _null_ )); +DATA(insert OID = 2504 ( pg_get_ruledef PGNSP PGUID 12 1 0 0 f f f t f s 2 0 25 "26 16" _null_ _null_ _null_ _null_ pg_get_ruledef_ext _null_ _null_ _null_ )); DESCR("source text of a rule with pretty-print option"); -DATA(insert OID = 2505 ( pg_get_viewdef PGNSP PGUID 12 1 0 0 f f f t f s 2 0 25 "25 16" _null_ _null_ _null_ _null_ pg_get_viewdef_name_ext _null_ _null_ _null_ )); +DATA(insert OID = 2505 ( pg_get_viewdef PGNSP PGUID 12 1 0 0 f f f t f s 2 0 25 "25 16" _null_ _null_ _null_ _null_ pg_get_viewdef_name_ext _null_ _null_ _null_ )); DESCR("select statement of a view with pretty-print option"); -DATA(insert OID = 2506 ( pg_get_viewdef PGNSP PGUID 12 1 0 0 f f f t f s 2 0 25 "26 16" _null_ _null_ _null_ _null_ pg_get_viewdef_ext _null_ _null_ _null_ )); +DATA(insert OID = 2506 ( pg_get_viewdef PGNSP PGUID 12 1 0 0 f f f t f s 2 0 25 "26 16" _null_ _null_ _null_ _null_ pg_get_viewdef_ext _null_ _null_ _null_ )); DESCR("select statement of a view with pretty-print option"); DATA(insert OID = 2507 ( pg_get_indexdef PGNSP PGUID 12 1 0 0 f f f t f s 3 0 25 "26 23 16" _null_ _null_ _null_ _null_ pg_get_indexdef_ext _null_ _null_ _null_ )); DESCR("index description (full create statement or single expression) with pretty-print option"); -DATA(insert OID = 2508 ( pg_get_constraintdef PGNSP PGUID 12 1 0 0 f f f t f s 2 0 25 "26 16" _null_ _null_ _null_ _null_ pg_get_constraintdef_ext _null_ _null_ _null_ )); +DATA(insert OID = 2508 ( pg_get_constraintdef PGNSP PGUID 12 1 0 0 f f f t f s 2 0 25 "26 16" _null_ _null_ _null_ _null_ pg_get_constraintdef_ext _null_ _null_ _null_ )); DESCR("constraint description with pretty-print option"); DATA(insert OID = 2509 ( pg_get_expr PGNSP PGUID 12 1 0 0 f f f t f s 3 0 25 "25 26 16" _null_ _null_ _null_ _null_ pg_get_expr_ext _null_ _null_ _null_ )); DESCR("deparse an encoded expression with pretty-print option"); @@ -4116,7 +4116,7 @@ DATA(insert OID = 2546 ( interval_pl_date PGNSP PGUID 14 1 0 0 f f f t f i 2 0 DATA(insert OID = 2547 ( interval_pl_timetz PGNSP PGUID 14 1 0 0 f f f t f i 2 0 1266 "1186 1266" _null_ _null_ _null_ _null_ "select $2 + $1" _null_ _null_ _null_ )); DATA(insert OID = 2548 ( interval_pl_timestamp PGNSP PGUID 14 1 0 0 f f f t f i 2 0 1114 "1186 1114" _null_ _null_ _null_ _null_ "select $2 + $1" _null_ _null_ _null_ )); DATA(insert OID = 2549 ( interval_pl_timestamptz PGNSP PGUID 14 1 0 0 f f f t f s 2 0 1184 "1186 1184" _null_ _null_ _null_ _null_ "select $2 + $1" _null_ _null_ _null_ )); -DATA(insert OID = 2550 ( integer_pl_date PGNSP PGUID 14 1 0 0 f f f t f i 2 0 1082 "23 1082" _null_ _null_ _null_ _null_ "select $2 + $1" _null_ _null_ _null_ )); +DATA(insert OID = 2550 ( integer_pl_date PGNSP PGUID 14 1 0 0 f f f t f i 2 0 1082 "23 1082" _null_ _null_ _null_ _null_ "select $2 + $1" _null_ _null_ _null_ )); DATA(insert OID = 2556 ( pg_tablespace_databases PGNSP PGUID 12 1 1000 0 f f f t t s 1 0 26 "26" _null_ _null_ _null_ _null_ pg_tablespace_databases _null_ _null_ _null_ )); DESCR("returns database oids in a tablespace"); @@ -4182,7 +4182,7 @@ DATA(insert OID = 2592 ( gist_circle_compress PGNSP PGUID 12 1 0 0 f f f t f i DESCR("GiST support"); /* GIN */ -DATA(insert OID = 2731 ( gingetbitmap PGNSP PGUID 12 1 0 0 f f f t f v 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ gingetbitmap _null_ _null_ _null_ )); +DATA(insert OID = 2731 ( gingetbitmap PGNSP PGUID 12 1 0 0 f f f t f v 2 0 20 "2281 2281" _null_ _null_ _null_ _null_ gingetbitmap _null_ _null_ _null_ )); DESCR("gin(internal)"); DATA(insert OID = 2732 ( gininsert PGNSP PGUID 12 1 0 0 f f f t f v 6 0 16 "2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ gininsert _null_ _null_ _null_ )); DESCR("gin(internal)"); @@ -4190,11 +4190,11 @@ DATA(insert OID = 2733 ( ginbeginscan PGNSP PGUID 12 1 0 0 f f f t f v 3 0 2 DESCR("gin(internal)"); DATA(insert OID = 2734 ( ginrescan PGNSP PGUID 12 1 0 0 f f f t f v 2 0 2278 "2281 2281" _null_ _null_ _null_ _null_ ginrescan _null_ _null_ _null_ )); DESCR("gin(internal)"); -DATA(insert OID = 2735 ( ginendscan PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ ginendscan _null_ _null_ _null_ )); +DATA(insert OID = 2735 ( ginendscan PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ ginendscan _null_ _null_ _null_ )); DESCR("gin(internal)"); -DATA(insert OID = 2736 ( ginmarkpos PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ ginmarkpos _null_ _null_ _null_ )); +DATA(insert OID = 2736 ( ginmarkpos PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ ginmarkpos _null_ _null_ _null_ )); DESCR("gin(internal)"); -DATA(insert OID = 2737 ( ginrestrpos PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ ginrestrpos _null_ _null_ _null_ )); +DATA(insert OID = 2737 ( ginrestrpos PGNSP PGUID 12 1 0 0 f f f t f v 1 0 2278 "2281" _null_ _null_ _null_ _null_ ginrestrpos _null_ _null_ _null_ )); DESCR("gin(internal)"); DATA(insert OID = 2738 ( ginbuild PGNSP PGUID 12 1 0 0 f f f t f v 3 0 2281 "2281 2281 2281" _null_ _null_ _null_ _null_ ginbuild _null_ _null_ _null_ )); DESCR("gin(internal)"); @@ -4202,7 +4202,7 @@ DATA(insert OID = 2739 ( ginbulkdelete PGNSP PGUID 12 1 0 0 f f f t f v 4 0 DESCR("gin(internal)"); DATA(insert OID = 2740 ( ginvacuumcleanup PGNSP PGUID 12 1 0 0 f f f t f v 2 0 2281 "2281 2281" _null_ _null_ _null_ _null_ ginvacuumcleanup _null_ _null_ _null_ )); DESCR("gin(internal)"); -DATA(insert OID = 2741 ( gincostestimate PGNSP PGUID 12 1 0 0 f f f t f v 8 0 2278 "2281 2281 2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ gincostestimate _null_ _null_ _null_ )); +DATA(insert OID = 2741 ( gincostestimate PGNSP PGUID 12 1 0 0 f f f t f v 8 0 2278 "2281 2281 2281 2281 2281 2281 2281 2281" _null_ _null_ _null_ _null_ gincostestimate _null_ _null_ _null_ )); DESCR("gin(internal)"); DATA(insert OID = 2788 ( ginoptions PGNSP PGUID 12 1 0 0 f f f t f s 2 0 17 "1009 16" _null_ _null_ _null_ _null_ ginoptions _null_ _null_ _null_ )); DESCR("gin(internal)"); @@ -4455,9 +4455,9 @@ DATA(insert OID = 3657 ( gin_extract_tsquery PGNSP PGUID 12 1 0 0 f f f t f i 5 DESCR("GIN tsvector support"); DATA(insert OID = 3658 ( gin_tsquery_consistent PGNSP PGUID 12 1 0 0 f f f t f i 6 0 16 "2281 21 3615 23 2281 2281" _null_ _null_ _null_ _null_ gin_tsquery_consistent _null_ _null_ _null_ )); DESCR("GIN tsvector support"); -DATA(insert OID = 3724 ( gin_cmp_tslexeme PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "25 25" _null_ _null_ _null_ _null_ gin_cmp_tslexeme _null_ _null_ _null_ )); +DATA(insert OID = 3724 ( gin_cmp_tslexeme PGNSP PGUID 12 1 0 0 f f f t f i 2 0 23 "25 25" _null_ _null_ _null_ _null_ gin_cmp_tslexeme _null_ _null_ _null_ )); DESCR("GIN tsvector support"); -DATA(insert OID = 2700 ( gin_cmp_prefix PGNSP PGUID 12 1 0 0 f f f t f i 4 0 23 "25 25 21 2281" _null_ _null_ _null_ _null_ gin_cmp_prefix _null_ _null_ _null_ )); +DATA(insert OID = 2700 ( gin_cmp_prefix PGNSP PGUID 12 1 0 0 f f f t f i 4 0 23 "25 25 21 2281" _null_ _null_ _null_ _null_ gin_cmp_prefix _null_ _null_ _null_ )); DESCR("GIN tsvector support"); DATA(insert OID = 3662 ( tsquery_lt PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "3615 3615" _null_ _null_ _null_ _null_ tsquery_lt _null_ _null_ _null_ )); @@ -4723,7 +4723,7 @@ DESCR("fetch the Nth row value"); #define PROARGMODE_IN 'i' #define PROARGMODE_OUT 'o' #define PROARGMODE_INOUT 'b' -#define PROARGMODE_VARIADIC 'v' +#define PROARGMODE_VARIADIC 'v' #define PROARGMODE_TABLE 't' #endif /* PG_PROC_H */ diff --git a/src/include/catalog/pg_proc_fn.h b/src/include/catalog/pg_proc_fn.h index 6a9aa4e35f..0db5e9893c 100644 --- a/src/include/catalog/pg_proc_fn.h +++ b/src/include/catalog/pg_proc_fn.h @@ -1,13 +1,13 @@ /*------------------------------------------------------------------------- * * pg_proc_fn.h - * prototypes for functions in catalog/pg_proc.c + * prototypes for functions in catalog/pg_proc.c * * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_proc_fn.h,v 1.6 2009/01/01 17:23:58 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_proc_fn.h,v 1.7 2009/06/11 14:49:10 momjian Exp $ * *------------------------------------------------------------------------- */ diff --git a/src/include/catalog/pg_shdepend.h b/src/include/catalog/pg_shdepend.h index 97f01df4c1..a13ce8dbaf 100644 --- a/src/include/catalog/pg_shdepend.h +++ b/src/include/catalog/pg_shdepend.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_shdepend.h,v 1.9 2009/01/22 20:16:09 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_shdepend.h,v 1.10 2009/06/11 14:49:10 momjian Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -43,8 +43,8 @@ CATALOG(pg_shdepend,1214) BKI_SHARED_RELATION BKI_WITHOUT_OIDS /* * Identification of the independent (referenced) object. This is always - * a shared object, so we need no database ID field. We don't bother - * with a sub-object ID either. + * a shared object, so we need no database ID field. We don't bother with + * a sub-object ID either. */ Oid refclassid; /* OID of table containing object */ Oid refobjid; /* OID of object itself */ @@ -72,7 +72,7 @@ typedef FormData_pg_shdepend *Form_pg_shdepend; #define Anum_pg_shdepend_classid 2 #define Anum_pg_shdepend_objid 3 #define Anum_pg_shdepend_objsubid 4 -#define Anum_pg_shdepend_refclassid 5 +#define Anum_pg_shdepend_refclassid 5 #define Anum_pg_shdepend_refobjid 6 #define Anum_pg_shdepend_deptype 7 diff --git a/src/include/catalog/pg_statistic.h b/src/include/catalog/pg_statistic.h index 2c5f48ecaf..0e831ef298 100644 --- a/src/include/catalog/pg_statistic.h +++ b/src/include/catalog/pg_statistic.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_statistic.h,v 1.38 2009/01/01 17:23:58 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_statistic.h,v 1.39 2009/06/11 14:49:10 momjian Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -240,7 +240,7 @@ typedef FormData_pg_statistic *Form_pg_statistic; /* * A "most common elements" slot is similar to a "most common values" slot, * except that it stores the most common non-null *elements* of the column - * values. This is useful when the column datatype is an array or some other + * values. This is useful when the column datatype is an array or some other * type with identifiable elements (for instance, tsvector). staop contains * the equality operator appropriate to the element type. stavalues contains * the most common element values, and stanumbers their frequencies. Unlike diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h index a2f781f069..8392bce084 100644 --- a/src/include/catalog/pg_type.h +++ b/src/include/catalog/pg_type.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.204 2009/01/01 17:23:58 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_type.h,v 1.205 2009/06/11 14:49:10 momjian Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -70,12 +70,12 @@ CATALOG(pg_type,1247) BKI_BOOTSTRAP /* * typcategory and typispreferred help the parser distinguish preferred * and non-preferred coercions. The category can be any single ASCII - * character (but not \0). The categories used for built-in types are + * character (but not \0). The categories used for built-in types are * identified by the TYPCATEGORY macros below. */ char typcategory; /* arbitrary type classification */ - bool typispreferred; /* is type "preferred" within its category? */ + bool typispreferred; /* is type "preferred" within its category? */ /* * If typisdefined is false, the entry is only a placeholder (forward @@ -644,7 +644,7 @@ DATA(insert OID = 3500 ( anyenum PGNSP PGUID 4 t p P f t \054 0 0 0 anyenum_in #define TYPCATEGORY_GEOMETRIC 'G' #define TYPCATEGORY_NETWORK 'I' /* think INET */ #define TYPCATEGORY_NUMERIC 'N' -#define TYPCATEGORY_PSEUDOTYPE 'P' +#define TYPCATEGORY_PSEUDOTYPE 'P' #define TYPCATEGORY_STRING 'S' #define TYPCATEGORY_TIMESPAN 'T' #define TYPCATEGORY_USER 'U' diff --git a/src/include/catalog/pg_type_fn.h b/src/include/catalog/pg_type_fn.h index 11409cf349..3705913837 100644 --- a/src/include/catalog/pg_type_fn.h +++ b/src/include/catalog/pg_type_fn.h @@ -1,13 +1,13 @@ /*------------------------------------------------------------------------- * * pg_type_fn.h - * prototypes for functions in catalog/pg_type.c + * prototypes for functions in catalog/pg_type.c * * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_type_fn.h,v 1.4 2009/02/24 01:38:10 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_type_fn.h,v 1.5 2009/06/11 14:49:10 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -17,9 +17,9 @@ #include "nodes/nodes.h" -extern Oid TypeShellMake(const char *typeName, - Oid typeNamespace, - Oid ownerId); +extern Oid TypeShellMake(const char *typeName, + Oid typeNamespace, + Oid ownerId); extern Oid TypeCreate(Oid newTypeOid, const char *typeName, @@ -71,7 +71,7 @@ extern void GenerateTypeDependencies(Oid typeNamespace, bool rebuild); extern void RenameTypeInternal(Oid typeOid, const char *newTypeName, - Oid typeNamespace); + Oid typeNamespace); extern char *makeArrayTypeName(const char *typeName, Oid typeNamespace); diff --git a/src/include/catalog/pg_user_mapping.h b/src/include/catalog/pg_user_mapping.h index 1dae7d6dcb..c8ce4c3046 100644 --- a/src/include/catalog/pg_user_mapping.h +++ b/src/include/catalog/pg_user_mapping.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_user_mapping.h,v 1.2 2009/01/01 17:23:58 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_user_mapping.h,v 1.3 2009/06/11 14:49:10 momjian Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -28,8 +28,9 @@ CATALOG(pg_user_mapping,1418) { - Oid umuser; /* Id of the user, InvalidOid if PUBLIC is wanted */ - Oid umserver; /* server of this mapping */ + Oid umuser; /* Id of the user, InvalidOid if PUBLIC is + * wanted */ + Oid umserver; /* server of this mapping */ /* * VARIABLE LENGTH FIELDS start here. These fields may be NULL, too. diff --git a/src/include/commands/comment.h b/src/include/commands/comment.h index 0e912db9d2..f302bd6755 100644 --- a/src/include/commands/comment.h +++ b/src/include/commands/comment.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/include/commands/comment.h,v 1.23 2009/01/01 17:23:58 momjian Exp $ + * $PostgreSQL: pgsql/src/include/commands/comment.h,v 1.24 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- * diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h index 2903d394ba..e5c61a0dcb 100644 --- a/src/include/commands/explain.h +++ b/src/include/commands/explain.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994-5, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/explain.h,v 1.38 2009/01/02 20:42:00 tgl Exp $ + * $PostgreSQL: pgsql/src/include/commands/explain.h,v 1.39 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -39,11 +39,11 @@ extern void ExplainOneUtility(Node *utilityStmt, ExplainStmt *stmt, TupOutputState *tstate); extern void ExplainOnePlan(PlannedStmt *plannedstmt, ExplainStmt *stmt, - const char *queryString, - ParamListInfo params, - TupOutputState *tstate); + const char *queryString, + ParamListInfo params, + TupOutputState *tstate); extern void ExplainPrintPlan(StringInfo str, QueryDesc *queryDesc, - bool analyze, bool verbose); + bool analyze, bool verbose); #endif /* EXPLAIN_H */ diff --git a/src/include/commands/proclang.h b/src/include/commands/proclang.h index fd97516689..255af9291e 100644 --- a/src/include/commands/proclang.h +++ b/src/include/commands/proclang.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/include/commands/proclang.h,v 1.14 2008/05/17 01:28:24 adunstan Exp $ + * $PostgreSQL: pgsql/src/include/commands/proclang.h,v 1.15 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- * diff --git a/src/include/commands/tablecmds.h b/src/include/commands/tablecmds.h index a81c5f0745..82c9813a7c 100644 --- a/src/include/commands/tablecmds.h +++ b/src/include/commands/tablecmds.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/tablecmds.h,v 1.42 2009/01/01 17:23:58 momjian Exp $ + * $PostgreSQL: pgsql/src/include/commands/tablecmds.h,v 1.43 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -29,7 +29,7 @@ extern void ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing); extern void AlterTableInternal(Oid relid, List *cmds, bool recurse); extern void AlterTableNamespace(RangeVar *relation, const char *newschema, - ObjectType stmttype); + ObjectType stmttype); extern void AlterRelationNamespaceInternal(Relation classRel, Oid relOid, Oid oldNspOid, Oid newNspOid, @@ -46,12 +46,12 @@ extern void renameatt(Oid myrelid, bool recursing); extern void RenameRelation(Oid myrelid, - const char *newrelname, - ObjectType reltype); + const char *newrelname, + ObjectType reltype); extern void RenameRelationInternal(Oid myrelid, - const char *newrelname, - Oid namespaceId); + const char *newrelname, + Oid namespaceId); extern void find_composite_type_dependencies(Oid typeOid, const char *origTblName, diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h index 123159e59a..7e886eede4 100644 --- a/src/include/commands/trigger.h +++ b/src/include/commands/trigger.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/trigger.h,v 1.72 2009/01/22 20:16:09 tgl Exp $ + * $PostgreSQL: pgsql/src/include/commands/trigger.h,v 1.73 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -39,7 +39,7 @@ typedef struct TriggerData } TriggerData; /* - * TriggerEvent bit flags + * TriggerEvent bit flags * * Note that we assume different event types (INSERT/DELETE/UPDATE/TRUNCATE) * can't be OR'd together in a single TriggerEvent. This is unlike the @@ -93,7 +93,7 @@ typedef struct TriggerData #define SESSION_REPLICATION_ROLE_ORIGIN 0 #define SESSION_REPLICATION_ROLE_REPLICA 1 #define SESSION_REPLICATION_ROLE_LOCAL 2 -extern PGDLLIMPORT int SessionReplicationRole; +extern PGDLLIMPORT int SessionReplicationRole; /* * States at which a trigger can be fired. These are the @@ -104,8 +104,8 @@ extern PGDLLIMPORT int SessionReplicationRole; #define TRIGGER_FIRES_ON_REPLICA 'R' #define TRIGGER_DISABLED 'D' -extern Oid CreateTrigger(CreateTrigStmt *stmt, Oid constraintOid, - bool checkPermissions); +extern Oid CreateTrigger(CreateTrigStmt *stmt, Oid constraintOid, + bool checkPermissions); extern void DropTrigger(Oid relid, const char *trigname, DropBehavior behavior, bool missing_ok); @@ -155,9 +155,9 @@ extern void ExecARUpdateTriggers(EState *estate, ItemPointer tupleid, HeapTuple newtuple); extern void ExecBSTruncateTriggers(EState *estate, - ResultRelInfo *relinfo); + ResultRelInfo *relinfo); extern void ExecASTruncateTriggers(EState *estate, - ResultRelInfo *relinfo); + ResultRelInfo *relinfo); extern void AfterTriggerBeginXact(void); extern void AfterTriggerBeginQuery(void); diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h index f5f6cf4aa8..b7dff7b0c4 100644 --- a/src/include/commands/vacuum.h +++ b/src/include/commands/vacuum.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/vacuum.h,v 1.84 2009/01/16 13:27:24 heikki Exp $ + * $PostgreSQL: pgsql/src/include/commands/vacuum.h,v 1.85 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -94,9 +94,9 @@ typedef struct VacAttrStats Datum *stavalues[STATISTIC_NUM_SLOTS]; /* - * These fields describe the stavalues[n] element types. They will - * be initialized to be the same as the column's that's underlying the - * slot, but a custom typanalyze function might want to store an array of + * These fields describe the stavalues[n] element types. They will be + * initialized to be the same as the column's that's underlying the slot, + * but a custom typanalyze function might want to store an array of * something other than the analyzed column's elements. It should then * overwrite these fields. */ diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index 3a4b4c6551..d4dc3672c5 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.154 2009/01/01 17:23:59 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.155 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -66,8 +66,8 @@ extern PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook; /* Hook for plugins to get control in ExecutorRun() */ typedef void (*ExecutorRun_hook_type) (QueryDesc *queryDesc, - ScanDirection direction, - long count); + ScanDirection direction, + long count); extern PGDLLIMPORT ExecutorRun_hook_type ExecutorRun_hook; /* Hook for plugins to get control in ExecutorEnd() */ @@ -150,9 +150,9 @@ extern HeapTuple ExecRemoveJunk(JunkFilter *junkfilter, TupleTableSlot *slot); extern void ExecutorStart(QueryDesc *queryDesc, int eflags); extern void standard_ExecutorStart(QueryDesc *queryDesc, int eflags); extern void ExecutorRun(QueryDesc *queryDesc, - ScanDirection direction, long count); + ScanDirection direction, long count); extern void standard_ExecutorRun(QueryDesc *queryDesc, - ScanDirection direction, long count); + ScanDirection direction, long count); extern void ExecutorEnd(QueryDesc *queryDesc); extern void standard_ExecutorEnd(QueryDesc *queryDesc); extern void ExecutorRewind(QueryDesc *queryDesc); diff --git a/src/include/executor/hashjoin.h b/src/include/executor/hashjoin.h index 5b18282a64..3c73ca84a6 100644 --- a/src/include/executor/hashjoin.h +++ b/src/include/executor/hashjoin.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/hashjoin.h,v 1.50 2009/03/21 00:04:40 tgl Exp $ + * $PostgreSQL: pgsql/src/include/executor/hashjoin.h,v 1.51 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -98,7 +98,7 @@ typedef struct HashSkewBucket } HashSkewBucket; #define SKEW_BUCKET_OVERHEAD MAXALIGN(sizeof(HashSkewBucket)) -#define INVALID_SKEW_BUCKET_NO (-1) +#define INVALID_SKEW_BUCKET_NO (-1) #define SKEW_WORK_MEM_PERCENT 2 #define SKEW_MIN_OUTER_FRACTION 0.01 @@ -116,7 +116,7 @@ typedef struct HashJoinTableData HashSkewBucket **skewBucket; /* hashtable of skew buckets */ int skewBucketLen; /* size of skewBucket array (a power of 2!) */ int nSkewBuckets; /* number of active skew buckets */ - int *skewBucketNums; /* array indexes of active skew buckets */ + int *skewBucketNums; /* array indexes of active skew buckets */ int nbatch; /* number of batches */ int curbatch; /* current batch #; 0 during 1st pass */ @@ -150,7 +150,7 @@ typedef struct HashJoinTableData Size spaceUsed; /* memory space currently used by tuples */ Size spaceAllowed; /* upper limit for space used */ Size spaceUsedSkew; /* skew hash table's current space usage */ - Size spaceAllowedSkew; /* upper limit for skew hashtable */ + Size spaceAllowedSkew; /* upper limit for skew hashtable */ MemoryContext hashCxt; /* context for whole-hash-join storage */ MemoryContext batchCxt; /* context for this-batch-only storage */ diff --git a/src/include/executor/spi.h b/src/include/executor/spi.h index 8b9fe32d7b..5bdde2d524 100644 --- a/src/include/executor/spi.h +++ b/src/include/executor/spi.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/spi.h,v 1.71 2009/01/21 11:02:40 heikki Exp $ + * $PostgreSQL: pgsql/src/include/executor/spi.h,v 1.72 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -81,10 +81,10 @@ extern int SPI_execute_snapshot(SPIPlanPtr plan, Snapshot snapshot, Snapshot crosscheck_snapshot, bool read_only, bool fire_triggers, long tcount); -extern int SPI_execute_with_args(const char *src, - int nargs, Oid *argtypes, - Datum *Values, const char *Nulls, - bool read_only, long tcount); +extern int SPI_execute_with_args(const char *src, + int nargs, Oid *argtypes, + Datum *Values, const char *Nulls, + bool read_only, long tcount); extern SPIPlanPtr SPI_prepare(const char *src, int nargs, Oid *argtypes); extern SPIPlanPtr SPI_prepare_cursor(const char *src, int nargs, Oid *argtypes, int cursorOptions); @@ -118,10 +118,10 @@ extern void SPI_freetuptable(SPITupleTable *tuptable); extern Portal SPI_cursor_open(const char *name, SPIPlanPtr plan, Datum *Values, const char *Nulls, bool read_only); extern Portal SPI_cursor_open_with_args(const char *name, - const char *src, - int nargs, Oid *argtypes, - Datum *Values, const char *Nulls, - bool read_only, int cursorOptions); + const char *src, + int nargs, Oid *argtypes, + Datum *Values, const char *Nulls, + bool read_only, int cursorOptions); extern Portal SPI_cursor_find(const char *name); extern void SPI_cursor_fetch(Portal portal, bool forward, long count); extern void SPI_cursor_move(Portal portal, bool forward, long count); diff --git a/src/include/executor/tstoreReceiver.h b/src/include/executor/tstoreReceiver.h index 6805b6cd04..9f510393f3 100644 --- a/src/include/executor/tstoreReceiver.h +++ b/src/include/executor/tstoreReceiver.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/tstoreReceiver.h,v 1.13 2009/01/01 17:23:59 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/tstoreReceiver.h,v 1.14 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -22,8 +22,8 @@ extern DestReceiver *CreateTuplestoreDestReceiver(void); extern void SetTuplestoreDestReceiverParams(DestReceiver *self, - Tuplestorestate *tStore, - MemoryContext tContext, - bool detoast); + Tuplestorestate *tStore, + MemoryContext tContext, + bool detoast); #endif /* TSTORE_RECEIVER_H */ diff --git a/src/include/executor/tuptable.h b/src/include/executor/tuptable.h index d712106c52..879a310c68 100644 --- a/src/include/executor/tuptable.h +++ b/src/include/executor/tuptable.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/tuptable.h,v 1.41 2009/03/30 04:08:43 tgl Exp $ + * $PostgreSQL: pgsql/src/include/executor/tuptable.h,v 1.42 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -103,7 +103,7 @@ * has only a minimal and not also a regular physical tuple, then tts_tuple * points at tts_minhdr and the fields of that struct are set correctly * for access to the minimal tuple; in particular, tts_minhdr.t_data points - * MINIMAL_TUPLE_OFFSET bytes before tts_mintuple. This allows column + * MINIMAL_TUPLE_OFFSET bytes before tts_mintuple. This allows column * extraction to treat the case identically to regular physical tuples. * * tts_slow/tts_off are saved state for slot_deform_tuple, and should not @@ -114,7 +114,7 @@ typedef struct TupleTableSlot { NodeTag type; /* vestigial ... allows IsA tests */ bool tts_isempty; /* true = slot is empty */ - bool tts_shouldFree; /* should pfree tts_tuple? */ + bool tts_shouldFree; /* should pfree tts_tuple? */ bool tts_shouldFreeMin; /* should pfree tts_mintuple? */ bool tts_slow; /* saved state for slot_deform_tuple */ HeapTuple tts_tuple; /* physical tuple, or NULL if virtual */ diff --git a/src/include/foreign/foreign.h b/src/include/foreign/foreign.h index 91ae3a7ea4..9f3fb20f39 100644 --- a/src/include/foreign/foreign.h +++ b/src/include/foreign/foreign.h @@ -6,7 +6,7 @@ * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/foreign/foreign.h,v 1.4 2009/04/04 21:12:31 tgl Exp $ + * $PostgreSQL: pgsql/src/include/foreign/foreign.h,v 1.5 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -25,7 +25,8 @@ * Generic option types for validation. * NB! Thes are treated as flags, so use only powers of two here. */ -typedef enum { +typedef enum +{ ServerOpt = 1, /* options applicable to SERVER */ UserMappingOpt = 2, /* options for USER MAPPING */ FdwOpt = 4 /* options for FOREIGN DATA WRAPPER */ @@ -33,39 +34,39 @@ typedef enum { typedef struct ForeignDataWrapper { - Oid fdwid; /* FDW Oid */ - Oid owner; /* FDW owner user Oid */ - char *fdwname; /* Name of the FDW */ - Oid fdwvalidator; - List *options; /* fdwoptions as DefElem list */ + Oid fdwid; /* FDW Oid */ + Oid owner; /* FDW owner user Oid */ + char *fdwname; /* Name of the FDW */ + Oid fdwvalidator; + List *options; /* fdwoptions as DefElem list */ } ForeignDataWrapper; typedef struct ForeignServer { - Oid serverid; /* server Oid */ - Oid fdwid; /* foreign-data wrapper */ - Oid owner; /* server owner user Oid */ - char *servername; /* name of the server */ - char *servertype; /* server type, optional */ - char *serverversion; /* server version, optional */ - List *options; /* srvoptions as DefElem list */ + Oid serverid; /* server Oid */ + Oid fdwid; /* foreign-data wrapper */ + Oid owner; /* server owner user Oid */ + char *servername; /* name of the server */ + char *servertype; /* server type, optional */ + char *serverversion; /* server version, optional */ + List *options; /* srvoptions as DefElem list */ } ForeignServer; typedef struct UserMapping { - Oid userid; /* local user Oid */ - Oid serverid; /* server Oid */ - List *options; /* useoptions as DefElem list */ + Oid userid; /* local user Oid */ + Oid serverid; /* server Oid */ + List *options; /* useoptions as DefElem list */ } UserMapping; extern ForeignServer *GetForeignServer(Oid serverid); extern ForeignServer *GetForeignServerByName(const char *name, bool missing_ok); -extern Oid GetForeignServerOidByName(const char *name, bool missing_ok); +extern Oid GetForeignServerOidByName(const char *name, bool missing_ok); extern UserMapping *GetUserMapping(Oid userid, Oid serverid); extern ForeignDataWrapper *GetForeignDataWrapper(Oid fdwid); extern ForeignDataWrapper *GetForeignDataWrapperByName(const char *name, - bool missing_ok); -extern Oid GetForeignDataWrapperOidByName(const char *name, bool missing_ok); + bool missing_ok); +extern Oid GetForeignDataWrapperOidByName(const char *name, bool missing_ok); -#endif /* FOREIGN_H */ +#endif /* FOREIGN_H */ diff --git a/src/include/funcapi.h b/src/include/funcapi.h index 1c2781dc52..1373e4ad24 100644 --- a/src/include/funcapi.h +++ b/src/include/funcapi.h @@ -9,7 +9,7 @@ * * Copyright (c) 2002-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/funcapi.h,v 1.28 2009/01/01 17:23:55 momjian Exp $ + * $PostgreSQL: pgsql/src/include/funcapi.h,v 1.29 2009/06/11 14:49:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -113,7 +113,7 @@ typedef struct FuncCallContext * * tuple_desc is for use when returning tuples (i.e. composite data types) * and is only needed if you are going to build the tuples with - * heap_form_tuple() rather than with BuildTupleFromCStrings(). Note that + * heap_form_tuple() rather than with BuildTupleFromCStrings(). Note that * the TupleDesc pointer stored here should usually have been run through * BlessTupleDesc() first. */ diff --git a/src/include/libpq/hba.h b/src/include/libpq/hba.h index 56f9f4ba53..f626342330 100644 --- a/src/include/libpq/hba.h +++ b/src/include/libpq/hba.h @@ -4,7 +4,7 @@ * Interface to hba.c * * - * $PostgreSQL: pgsql/src/include/libpq/hba.h,v 1.55 2009/01/07 13:09:21 mha Exp $ + * $PostgreSQL: pgsql/src/include/libpq/hba.h,v 1.56 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -38,7 +38,7 @@ typedef enum ConnType ctHostNoSSL } ConnType; -typedef struct +typedef struct { int linenumber; ConnType conntype; @@ -70,9 +70,9 @@ extern void load_role(void); extern int hba_getauthmethod(hbaPort *port); extern bool read_pg_database_line(FILE *fp, char *dbname, Oid *dboid, Oid *dbtablespace, TransactionId *dbfrozenxid); -extern int check_usermap(const char *usermap_name, - const char *pg_role, const char *auth_user, - bool case_sensitive); +extern int check_usermap(const char *usermap_name, + const char *pg_role, const char *auth_user, + bool case_sensitive); extern bool pg_isblank(const char c); #endif /* HBA_H */ diff --git a/src/include/libpq/libpq-be.h b/src/include/libpq/libpq-be.h index 1e74ddfd95..539826d655 100644 --- a/src/include/libpq/libpq-be.h +++ b/src/include/libpq/libpq-be.h @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.70 2009/04/19 22:37:13 tgl Exp $ + * $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.71 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -61,7 +61,7 @@ typedef struct { void *value; int length; -} gss_buffer_desc; +} gss_buffer_desc; #endif #endif /* ENABLE_SSPI */ @@ -89,7 +89,7 @@ typedef struct gss_ctx_id_t ctx; /* GSSAPI connection context */ gss_name_t name; /* GSSAPI client name */ #endif -} pg_gssinfo; +} pg_gssinfo; #endif /* @@ -124,7 +124,7 @@ typedef struct Port /* * Information that needs to be held during the authentication cycle. */ - HbaLine *hba; + HbaLine *hba; char md5Salt[4]; /* Password salt */ /* diff --git a/src/include/mb/pg_wchar.h b/src/include/mb/pg_wchar.h index 194ade2728..e9faff0013 100644 --- a/src/include/mb/pg_wchar.h +++ b/src/include/mb/pg_wchar.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/mb/pg_wchar.h,v 1.90 2009/04/24 08:43:51 mha Exp $ + * $PostgreSQL: pgsql/src/include/mb/pg_wchar.h,v 1.91 2009/06/11 14:49:11 momjian Exp $ * * NOTES * This is used both by the backend and by libpq, but should not be @@ -383,8 +383,8 @@ extern int pg_mic_mblen(const unsigned char *mbstr); extern int pg_mbstrlen(const char *mbstr); extern int pg_mbstrlen_with_len(const char *mbstr, int len); extern int pg_mbcliplen(const char *mbstr, int len, int limit); -extern int pg_encoding_mbcliplen(int encoding, const char *mbstr, - int len, int limit); +extern int pg_encoding_mbcliplen(int encoding, const char *mbstr, + int len, int limit); extern int pg_mbcharcliplen(const char *mbstr, int len, int imit); extern int pg_encoding_max_length(int encoding); extern int pg_database_encoding_max_length(void); @@ -434,10 +434,10 @@ extern int pg_verify_mbstr_len(int encoding, const char *mbstr, int len, bool noError); extern void check_encoding_conversion_args(int src_encoding, - int dest_encoding, - int len, - int expected_src_encoding, - int expected_dest_encoding); + int dest_encoding, + int len, + int expected_src_encoding, + int expected_dest_encoding); extern void report_invalid_encoding(int encoding, const char *mbstr, int len); extern void report_untranslatable_char(int src_encoding, int dest_encoding, diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index 51649380d5..e4c5d66475 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -13,7 +13,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.210 2009/05/05 19:59:00 tgl Exp $ + * $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.211 2009/06/11 14:49:08 momjian Exp $ * * NOTES * some of the information in this file should be moved to other files. @@ -192,13 +192,13 @@ extern PGDLLIMPORT Oid MyDatabaseTableSpace; extern int DateStyle; extern int DateOrder; - + /* * IntervalStyles - * INTSTYLE_POSTGRES Like Postgres < 8.4 when DateStyle = 'iso' - * INTSTYLE_POSTGRES_VERBOSE Like Postgres < 8.4 when DateStyle != 'iso' - * INTSTYLE_SQL_STANDARD SQL standard interval literals - * INTSTYLE_ISO_8601 ISO-8601-basic formatted intervals + * INTSTYLE_POSTGRES Like Postgres < 8.4 when DateStyle = 'iso' + * INTSTYLE_POSTGRES_VERBOSE Like Postgres < 8.4 when DateStyle != 'iso' + * INTSTYLE_SQL_STANDARD SQL standard interval literals + * INTSTYLE_ISO_8601 ISO-8601-basic formatted intervals */ #define INTSTYLE_POSTGRES 0 #define INTSTYLE_POSTGRES_VERBOSE 1 diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index ad80018bfb..b74db12afc 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.204 2009/04/08 21:51:38 petere Exp $ + * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.205 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -18,8 +18,8 @@ #include "access/heapam.h" #include "access/skey.h" #include "nodes/params.h" -#include "nodes/plannodes.h" -#include "nodes/tidbitmap.h" +#include "nodes/plannodes.h" +#include "nodes/tidbitmap.h" #include "utils/hsearch.h" #include "utils/rel.h" #include "utils/snapshot.h" @@ -120,8 +120,8 @@ typedef struct ExprContext ParamListInfo ecxt_param_list_info; /* for other param types */ /* - * Values to substitute for Aggref nodes in the expressions of an Agg node, - * or for WindowFunc nodes within a WindowAgg node. + * Values to substitute for Aggref nodes in the expressions of an Agg + * node, or for WindowFunc nodes within a WindowAgg node. */ Datum *ecxt_aggvalues; /* precomputed values for aggs/windowfuncs */ bool *ecxt_aggnulls; /* null flags for aggs/windowfuncs */ @@ -383,8 +383,8 @@ typedef struct EState /* - * es_rowMarks is a list of these structs. See RowMarkClause for details - * about rti and prti. toidAttno is not used in a "plain" rowmark. + * es_rowMarks is a list of these structs. See RowMarkClause for details + * about rti and prti. toidAttno is not used in a "plain" rowmark. */ typedef struct ExecRowMark { @@ -578,19 +578,20 @@ typedef struct FuncExprState FmgrInfo func; /* - * For a set-returning function (SRF) that returns a tuplestore, we - * keep the tuplestore here and dole out the result rows one at a time. - * The slot holds the row currently being returned. + * For a set-returning function (SRF) that returns a tuplestore, we keep + * the tuplestore here and dole out the result rows one at a time. The + * slot holds the row currently being returned. */ Tuplestorestate *funcResultStore; TupleTableSlot *funcResultSlot; /* * In some cases we need to compute a tuple descriptor for the function's - * output. If so, it's stored here. + * output. If so, it's stored here. */ TupleDesc funcResultDesc; - bool funcReturnsTuple; /* valid when funcResultDesc isn't NULL */ + bool funcReturnsTuple; /* valid when funcResultDesc isn't + * NULL */ /* * We need to store argument values across calls when evaluating a SRF @@ -949,8 +950,8 @@ typedef struct PlanState TupleTableSlot *ps_ResultTupleSlot; /* slot for my result tuples */ ExprContext *ps_ExprContext; /* node's expression-evaluation context */ ProjectionInfo *ps_ProjInfo; /* info for doing tuple projection */ - bool ps_TupFromTlist; /* state flag for processing set-valued - * functions in targetlist */ + bool ps_TupFromTlist;/* state flag for processing set-valued + * functions in targetlist */ } PlanState; /* ---------------- @@ -1018,7 +1019,7 @@ typedef struct RecursiveUnionState FmgrInfo *hashfunctions; /* per-grouping-field hash fns */ MemoryContext tempContext; /* short-term context for comparisons */ TupleHashTable hashtable; /* hash table for tuples already seen */ - MemoryContext tableContext; /* memory context containing hash table */ + MemoryContext tableContext; /* memory context containing hash table */ } RecursiveUnionState; /* ---------------- @@ -1166,7 +1167,7 @@ typedef struct BitmapIndexScanState * tbmres current-page data * prefetch_iterator iterator for prefetching ahead of current page * prefetch_pages # pages prefetch iterator is ahead of current - * prefetch_target target prefetch distance + * prefetch_target target prefetch distance * ---------------- */ typedef struct BitmapHeapScanState @@ -1283,7 +1284,7 @@ typedef struct CteScanState /* Link to the "leader" CteScanState (possibly this same node) */ struct CteScanState *leader; /* The remaining fields are only valid in the "leader" CteScanState */ - Tuplestorestate *cte_table; /* rows already read from the CTE query */ + Tuplestorestate *cte_table; /* rows already read from the CTE query */ bool eof_cte; /* reached end of CTE query? */ } CteScanState; @@ -1291,7 +1292,7 @@ typedef struct CteScanState * WorkTableScanState information * * WorkTableScan nodes are used to scan the work table created by - * a RecursiveUnion node. We locate the RecursiveUnion node + * a RecursiveUnion node. We locate the RecursiveUnion node * during executor startup. * ---------------- */ @@ -1526,35 +1527,36 @@ typedef struct WindowStatePerAggData *WindowStatePerAgg; typedef struct WindowAggState { - ScanState ss; /* its first field is NodeTag */ + ScanState ss; /* its first field is NodeTag */ /* these fields are filled in by ExecInitExpr: */ - List *funcs; /* all WindowFunc nodes in targetlist */ - int numfuncs; /* total number of window functions */ - int numaggs; /* number that are plain aggregates */ + List *funcs; /* all WindowFunc nodes in targetlist */ + int numfuncs; /* total number of window functions */ + int numaggs; /* number that are plain aggregates */ - WindowStatePerFunc perfunc; /* per-window-function information */ - WindowStatePerAgg peragg; /* per-plain-aggregate information */ + WindowStatePerFunc perfunc; /* per-window-function information */ + WindowStatePerAgg peragg; /* per-plain-aggregate information */ FmgrInfo *partEqfunctions; /* equality funcs for partition columns */ - FmgrInfo *ordEqfunctions; /* equality funcs for ordering columns */ - Tuplestorestate *buffer; /* stores rows of current partition */ - int current_ptr; /* read pointer # for current */ - int agg_ptr; /* read pointer # for aggregates */ - int64 spooled_rows; /* total # of rows in buffer */ - int64 currentpos; /* position of current row in partition */ - int64 frametailpos; /* current frame tail position */ - int64 aggregatedupto; /* rows before this one are aggregated */ - - MemoryContext wincontext; /* context for partition-lifespan data */ - ExprContext *tmpcontext; /* short-term evaluation context */ - - bool all_done; /* true if the scan is finished */ - bool partition_spooled; /* true if all tuples in current partition - * have been spooled into tuplestore */ - bool more_partitions; /* true if there's more partitions after - * this one */ - bool frametail_valid; /* true if frametailpos is known up to date - * for current row */ + FmgrInfo *ordEqfunctions; /* equality funcs for ordering columns */ + Tuplestorestate *buffer; /* stores rows of current partition */ + int current_ptr; /* read pointer # for current */ + int agg_ptr; /* read pointer # for aggregates */ + int64 spooled_rows; /* total # of rows in buffer */ + int64 currentpos; /* position of current row in partition */ + int64 frametailpos; /* current frame tail position */ + int64 aggregatedupto; /* rows before this one are aggregated */ + + MemoryContext wincontext; /* context for partition-lifespan data */ + ExprContext *tmpcontext; /* short-term evaluation context */ + + bool all_done; /* true if the scan is finished */ + bool partition_spooled; /* true if all tuples in current + * partition have been spooled into + * tuplestore */ + bool more_partitions;/* true if there's more partitions after this + * one */ + bool frametail_valid;/* true if frametailpos is known up to date + * for current row */ TupleTableSlot *first_part_slot; /* first tuple of current or next * partition */ @@ -1620,7 +1622,7 @@ typedef struct SetOpState HeapTuple grp_firstTuple; /* copy of first tuple of current group */ /* these fields are used in SETOP_HASHED mode: */ TupleHashTable hashtable; /* hash table with one entry per group */ - MemoryContext tableContext; /* memory context containing hash table */ + MemoryContext tableContext; /* memory context containing hash table */ bool table_filled; /* hash table filled yet? */ TupleHashIterator hashiter; /* for iterating through hash table */ } SetOpState; diff --git a/src/include/nodes/makefuncs.h b/src/include/nodes/makefuncs.h index 8959f74f01..c8f3e42c2f 100644 --- a/src/include/nodes/makefuncs.h +++ b/src/include/nodes/makefuncs.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/makefuncs.h,v 1.67 2009/04/04 21:12:31 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/makefuncs.h,v 1.68 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -67,6 +67,6 @@ extern FuncExpr *makeFuncExpr(Oid funcid, Oid rettype, extern DefElem *makeDefElem(char *name, Node *arg); extern DefElem *makeDefElemExtended(char *namespace, char *name, Node *arg, - DefElemAction defaction); + DefElemAction defaction); #endif /* MAKEFUNC_H */ diff --git a/src/include/nodes/nodeFuncs.h b/src/include/nodes/nodeFuncs.h index 425522ab61..bae5d9107a 100644 --- a/src/include/nodes/nodeFuncs.h +++ b/src/include/nodes/nodeFuncs.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/nodeFuncs.h,v 1.30 2009/01/01 17:24:00 momjian Exp $ + * $PostgreSQL: pgsql/src/include/nodes/nodeFuncs.h,v 1.31 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -53,6 +53,6 @@ extern Node *query_or_expression_tree_mutator(Node *node, Node *(*mutator) (), void *context, int flags); extern bool raw_expression_tree_walker(Node *node, bool (*walker) (), - void *context); + void *context); #endif /* NODEFUNCS_H */ diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index d5d22dbdc2..f255c44d1c 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.222 2009/04/04 21:12:31 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.223 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -425,7 +425,6 @@ typedef struct Node _result->type = (tag); \ _result; \ }) - #else /* @@ -443,7 +442,6 @@ extern PGDLLIMPORT Node *newNodeMacroHolder; newNodeMacroHolder->type = (tag), \ newNodeMacroHolder \ ) - #endif /* __GNUC__ */ @@ -523,8 +521,8 @@ typedef enum CmdType typedef enum JoinType { /* - * The canonical kinds of joins according to the SQL JOIN syntax. - * Only these codes can appear in parser output (e.g., JoinExpr nodes). + * The canonical kinds of joins according to the SQL JOIN syntax. Only + * these codes can appear in parser output (e.g., JoinExpr nodes). */ JOIN_INNER, /* matching tuple pairs only */ JOIN_LEFT, /* pairs + unmatched LHS tuples */ @@ -532,13 +530,13 @@ typedef enum JoinType JOIN_RIGHT, /* pairs + unmatched RHS tuples */ /* - * Semijoins and anti-semijoins (as defined in relational theory) do - * not appear in the SQL JOIN syntax, but there are standard idioms for - * representing them (e.g., using EXISTS). The planner recognizes these + * Semijoins and anti-semijoins (as defined in relational theory) do not + * appear in the SQL JOIN syntax, but there are standard idioms for + * representing them (e.g., using EXISTS). The planner recognizes these * cases and converts them to joins. So the planner and executor must * support these codes. NOTE: in JOIN_SEMI output, it is unspecified - * which matching RHS row is joined to. In JOIN_ANTI output, the row - * is guaranteed to be null-extended. + * which matching RHS row is joined to. In JOIN_ANTI output, the row is + * guaranteed to be null-extended. */ JOIN_SEMI, /* 1 copy of each LHS row that has match(es) */ JOIN_ANTI, /* 1 copy of each LHS row that has no match */ @@ -558,7 +556,7 @@ typedef enum JoinType /* * OUTER joins are those for which pushed-down quals must behave differently * from the join's own quals. This is in fact everything except INNER and - * SEMI joins. However, this macro must also exclude the JOIN_UNIQUE symbols + * SEMI joins. However, this macro must also exclude the JOIN_UNIQUE symbols * since those are temporary proxies for what will eventually be an INNER * join. * diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 32fc643450..54f1007818 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -13,7 +13,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.393 2009/04/04 21:12:31 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.394 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -67,7 +67,8 @@ typedef uint32 AclMode; /* a bitmask of privilege bits */ #define ACL_REFERENCES (1<<5) #define ACL_TRIGGER (1<<6) #define ACL_EXECUTE (1<<7) /* for functions */ -#define ACL_USAGE (1<<8) /* for languages, namespaces, FDWs, and servers */ +#define ACL_USAGE (1<<8) /* for languages, namespaces, FDWs, and + * servers */ #define ACL_CREATE (1<<9) /* for namespaces and databases */ #define ACL_CREATE_TEMP (1<<10) /* for databases */ #define ACL_CONNECT (1<<11) /* for databases */ @@ -113,7 +114,7 @@ typedef struct Query IntoClause *intoClause; /* target for SELECT INTO / CREATE TABLE AS */ bool hasAggs; /* has aggregates in tlist or havingQual */ - bool hasWindowFuncs; /* has window functions in tlist */ + bool hasWindowFuncs; /* has window functions in tlist */ bool hasSubLinks; /* has subquery SubLink */ bool hasDistinctOn; /* distinctClause is from DISTINCT ON */ bool hasRecursive; /* WITH RECURSIVE was specified */ @@ -184,7 +185,7 @@ typedef struct TypeName /* * ColumnRef - specifies a reference to a column, or possibly a whole tuple * - * The "fields" list must be nonempty. It can contain string Value nodes + * The "fields" list must be nonempty. It can contain string Value nodes * (representing names) and A_Star nodes (representing occurrence of a '*'). * Currently, A_Star must appear only as the last list element --- the grammar * is responsible for enforcing this! @@ -384,12 +385,12 @@ typedef struct SortBy typedef struct WindowDef { NodeTag type; - char *name; /* window's own name */ - char *refname; /* referenced window name, if any */ + char *name; /* window's own name */ + char *refname; /* referenced window name, if any */ List *partitionClause; /* PARTITION BY expression list */ - List *orderClause; /* ORDER BY (list of SortBy) */ - int frameOptions; /* frame_clause options, see below */ - int location; /* parse location, or -1 if none/unknown */ + List *orderClause; /* ORDER BY (list of SortBy) */ + int frameOptions; /* frame_clause options, see below */ + int location; /* parse location, or -1 if none/unknown */ } WindowDef; /* @@ -400,16 +401,16 @@ typedef struct WindowDef * the convenience of gram.y, even though some of them are useless/invalid. * We will need more bits (and fields) to cover the full SQL:2008 option set. */ -#define FRAMEOPTION_NONDEFAULT 0x00001 /* any specified? */ -#define FRAMEOPTION_RANGE 0x00002 /* RANGE behavior */ -#define FRAMEOPTION_ROWS 0x00004 /* ROWS behavior */ -#define FRAMEOPTION_BETWEEN 0x00008 /* BETWEEN given? */ -#define FRAMEOPTION_START_UNBOUNDED_PRECEDING 0x00010 /* start is U. P. */ -#define FRAMEOPTION_END_UNBOUNDED_PRECEDING 0x00020 /* (disallowed) */ -#define FRAMEOPTION_START_UNBOUNDED_FOLLOWING 0x00040 /* (disallowed) */ -#define FRAMEOPTION_END_UNBOUNDED_FOLLOWING 0x00080 /* end is U. F. */ -#define FRAMEOPTION_START_CURRENT_ROW 0x00100 /* start is C. R. */ -#define FRAMEOPTION_END_CURRENT_ROW 0x00200 /* end is C. R. */ +#define FRAMEOPTION_NONDEFAULT 0x00001 /* any specified? */ +#define FRAMEOPTION_RANGE 0x00002 /* RANGE behavior */ +#define FRAMEOPTION_ROWS 0x00004 /* ROWS behavior */ +#define FRAMEOPTION_BETWEEN 0x00008 /* BETWEEN given? */ +#define FRAMEOPTION_START_UNBOUNDED_PRECEDING 0x00010 /* start is U. P. */ +#define FRAMEOPTION_END_UNBOUNDED_PRECEDING 0x00020 /* (disallowed) */ +#define FRAMEOPTION_START_UNBOUNDED_FOLLOWING 0x00040 /* (disallowed) */ +#define FRAMEOPTION_END_UNBOUNDED_FOLLOWING 0x00080 /* end is U. F. */ +#define FRAMEOPTION_START_CURRENT_ROW 0x00100 /* start is C. R. */ +#define FRAMEOPTION_END_CURRENT_ROW 0x00200 /* end is C. R. */ #define FRAMEOPTION_DEFAULTS \ (FRAMEOPTION_RANGE | FRAMEOPTION_START_UNBOUNDED_PRECEDING | \ @@ -505,7 +506,7 @@ typedef struct IndexElem /* * DefElem - a generic "name = value" option definition * - * In some contexts the name can be qualified. Also, certain SQL commands + * In some contexts the name can be qualified. Also, certain SQL commands * allow a SET/ADD/DROP action to be attached to option settings, so it's * convenient to carry a field for that too. (Note: currently, it is our * practice that the grammar allows namespace and action only in statements @@ -699,7 +700,7 @@ typedef struct RangeTblEntry */ char *ctename; /* name of the WITH list item */ Index ctelevelsup; /* number of query levels up */ - bool self_reference; /* is this a recursive self-reference? */ + bool self_reference; /* is this a recursive self-reference? */ List *ctecoltypes; /* OID list of column type OIDs */ List *ctecoltypmods; /* integer list of column typmods */ @@ -724,7 +725,7 @@ typedef struct RangeTblEntry * You might think that ORDER BY is only interested in defining ordering, * and GROUP/DISTINCT are only interested in defining equality. However, * one way to implement grouping is to sort and then apply a "uniq"-like - * filter. So it's also interesting to keep track of possible sort operators + * filter. So it's also interesting to keep track of possible sort operators * for GROUP/DISTINCT, and in particular to try to sort for the grouping * in a way that will also yield a requested ORDER BY ordering. So we need * to be able to compare ORDER BY and GROUP/DISTINCT lists, which motivates @@ -742,10 +743,10 @@ typedef struct RangeTblEntry * here, but it's cheap to get it along with the sortop, and requiring it * to be valid eases comparisons to grouping items.) * - * In a grouping item, eqop must be valid. If the eqop is a btree equality + * In a grouping item, eqop must be valid. If the eqop is a btree equality * operator, then sortop should be set to a compatible ordering operator. * We prefer to set eqop/sortop/nulls_first to match any ORDER BY item that - * the query presents for the same tlist item. If there is none, we just + * the query presents for the same tlist item. If there is none, we just * use the default ordering op for the datatype. * * If the tlist item's type has a hash opclass but no btree opclass, then @@ -766,9 +767,9 @@ typedef struct SortGroupClause { NodeTag type; Index tleSortGroupRef; /* reference into targetlist */ - Oid eqop; /* the equality operator ('=' op) */ - Oid sortop; /* the ordering operator ('<' op), or 0 */ - bool nulls_first; /* do NULLs come before normal values? */ + Oid eqop; /* the equality operator ('=' op) */ + Oid sortop; /* the ordering operator ('<' op), or 0 */ + bool nulls_first; /* do NULLs come before normal values? */ } SortGroupClause; /* @@ -788,13 +789,13 @@ typedef struct SortGroupClause typedef struct WindowClause { NodeTag type; - char *name; /* window name (NULL in an OVER clause) */ - char *refname; /* referenced window name, if any */ + char *name; /* window name (NULL in an OVER clause) */ + char *refname; /* referenced window name, if any */ List *partitionClause; /* PARTITION BY list */ - List *orderClause; /* ORDER BY list */ - int frameOptions; /* frame_clause options, see WindowDef */ - Index winref; /* ID referenced by window functions */ - bool copiedOrder; /* did we copy orderClause from refname? */ + List *orderClause; /* ORDER BY list */ + int frameOptions; /* frame_clause options, see WindowDef */ + Index winref; /* ID referenced by window functions */ + bool copiedOrder; /* did we copy orderClause from refname? */ } WindowClause; /* @@ -822,7 +823,7 @@ typedef struct RowMarkClause /* * WithClause - - * representation of WITH clause + * representation of WITH clause * * Note: WithClause does not propagate into the Query representation; * but CommonTableExpr does. @@ -837,7 +838,7 @@ typedef struct WithClause /* * CommonTableExpr - - * representation of WITH list element + * representation of WITH list element * * We don't currently support the SEARCH or CYCLE clause. */ @@ -982,7 +983,7 @@ typedef struct SelectStmt * range table. Its setOperations field shows the tree of set operations, * with leaf SelectStmt nodes replaced by RangeTblRef nodes, and internal * nodes replaced by SetOperationStmt nodes. Information about the output - * column types is added, too. (Note that the child nodes do not necessarily + * column types is added, too. (Note that the child nodes do not necessarily * produce these types directly, but we've checked that their output types * can be coerced to the output column type.) Also, if it's not UNION ALL, * information about the types' sort/group semantics is provided in the form @@ -1241,7 +1242,7 @@ typedef struct AccessPriv * * Note: because of the parsing ambiguity with the GRANT <privileges> * statement, granted_roles is a list of AccessPriv; the execution code - * should complain if any column lists appear. grantee_roles is a list + * should complain if any column lists appear. grantee_roles is a list * of role names, as Value strings. * ---------------------- */ @@ -2177,7 +2178,7 @@ typedef struct VacuumStmt bool analyze; /* do ANALYZE step */ bool verbose; /* print progress info */ int freeze_min_age; /* min freeze age, or -1 to use default */ - int freeze_table_age; /* age at which to scan whole table */ + int freeze_table_age; /* age at which to scan whole table */ RangeVar *relation; /* single table to process, or NULL */ List *va_cols; /* list of column names, or NIL for all */ } VacuumStmt; diff --git a/src/include/nodes/pg_list.h b/src/include/nodes/pg_list.h index 092c671ee2..5af8a0c5b3 100644 --- a/src/include/nodes/pg_list.h +++ b/src/include/nodes/pg_list.h @@ -30,7 +30,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/pg_list.h,v 1.60 2009/01/01 17:24:00 momjian Exp $ + * $PostgreSQL: pgsql/src/include/nodes/pg_list.h,v 1.61 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -219,6 +219,7 @@ extern List *list_union_int(List *list1, List *list2); extern List *list_union_oid(List *list1, List *list2); extern List *list_intersection(List *list1, List *list2); + /* currently, there's no need for list_intersection_int etc */ extern List *list_difference(List *list1, List *list2); diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h index 9caf0895e4..44f14140f4 100644 --- a/src/include/nodes/plannodes.h +++ b/src/include/nodes/plannodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.109 2009/03/21 00:04:40 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.110 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -636,7 +636,7 @@ typedef struct Limit * * We track the objects on which a PlannedStmt depends in two ways: * relations are recorded as a simple list of OIDs, and everything else - * is represented as a list of PlanInvalItems. A PlanInvalItem is designed + * is represented as a list of PlanInvalItems. A PlanInvalItem is designed * to be used with the syscache invalidation mechanism, so it identifies a * system catalog entry by cache ID and tuple TID. */ diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 7fc7c00d63..a41b0e2f7d 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -10,7 +10,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.148 2009/04/05 19:59:40 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.149 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -370,7 +370,7 @@ typedef struct ScalarArrayOpExpr * * Notice the arguments are given as a List. For NOT, of course the list * must always have exactly one element. For AND and OR, the executor can - * handle any number of arguments. The parser generally treats AND and OR + * handle any number of arguments. The parser generally treats AND and OR * as binary and so it typically only produces two-element lists, but the * optimizer will flatten trees of AND and OR nodes to produce longer lists * when possible. There are also a few special cases where more arguments @@ -506,7 +506,7 @@ typedef struct SubPlan char *plan_name; /* A name assigned during planning */ /* Extra data useful for determining subplan's output type: */ Oid firstColType; /* Type of first column of subplan result */ - int32 firstColTypmod; /* Typmod of first column of subplan result */ + int32 firstColTypmod; /* Typmod of first column of subplan result */ /* Information about execution strategy: */ bool useHashTable; /* TRUE to store subselect output in a hash * table (implies we are doing "IN") */ @@ -1045,9 +1045,9 @@ typedef struct CurrentOfExpr * risks confusing ExecGetJunkAttribute! * * ressortgroupref is used in the representation of ORDER BY, GROUP BY, and - * DISTINCT items. Targetlist entries with ressortgroupref=0 are not + * DISTINCT items. Targetlist entries with ressortgroupref=0 are not * sort/group items. If ressortgroupref>0, then this item is an ORDER BY, - * GROUP BY, and/or DISTINCT target value. No two entries in a targetlist + * GROUP BY, and/or DISTINCT target value. No two entries in a targetlist * may have the same nonzero ressortgroupref --- but there is no particular * meaning to the nonzero values, except as tags. (For example, one must * not assume that lower ressortgroupref means a more significant sort key.) diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index 6a72504a2f..7eb15dbeec 100644 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.172 2009/04/16 20:42:16 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.173 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -106,7 +106,7 @@ typedef struct PlannerInfo Index query_level; /* 1 at the outermost Query */ - struct PlannerInfo *parent_root; /* NULL at outermost Query */ + struct PlannerInfo *parent_root; /* NULL at outermost Query */ /* * simple_rel_array holds pointers to "base rels" and "other rels" (see @@ -161,19 +161,19 @@ typedef struct PlannerInfo List *full_join_clauses; /* list of RestrictInfos for * mergejoinable full join clauses */ - List *join_info_list; /* list of SpecialJoinInfos */ + List *join_info_list; /* list of SpecialJoinInfos */ List *append_rel_list; /* list of AppendRelInfos */ - List *placeholder_list; /* list of PlaceHolderInfos */ + List *placeholder_list; /* list of PlaceHolderInfos */ List *query_pathkeys; /* desired pathkeys for query_planner(), and * actual pathkeys afterwards */ - List *group_pathkeys; /* groupClause pathkeys, if any */ + List *group_pathkeys; /* groupClause pathkeys, if any */ List *window_pathkeys; /* pathkeys of bottom window, if any */ - List *distinct_pathkeys; /* distinctClause pathkeys, if any */ - List *sort_pathkeys; /* sortClause pathkeys, if any */ + List *distinct_pathkeys; /* distinctClause pathkeys, if any */ + List *sort_pathkeys; /* sortClause pathkeys, if any */ List *initial_rels; /* RelOptInfos we are now trying to join */ @@ -190,7 +190,7 @@ typedef struct PlannerInfo bool hasRecursion; /* true if planning a recursive WITH item */ /* These fields are used only when hasRecursion is true: */ - int wt_param_id; /* PARAM_EXEC ID for the work table */ + int wt_param_id; /* PARAM_EXEC ID for the work table */ struct Plan *non_recursive_plan; /* plan for non-recursive term */ } PlannerInfo; @@ -442,7 +442,7 @@ typedef struct IndexOptInfo bool amoptionalkey; /* can query omit key for the first column? */ bool amsearchnulls; /* can AM search for NULL index entries? */ bool amhasgettuple; /* does AM have amgettuple interface? */ - bool amhasgetbitmap; /* does AM have amgetbitmap interface? */ + bool amhasgetbitmap; /* does AM have amgetbitmap interface? */ } IndexOptInfo; @@ -845,7 +845,7 @@ typedef struct HashPath { JoinPath jpath; List *path_hashclauses; /* join clauses used for hashing */ - int num_batches; /* number of batches expected */ + int num_batches; /* number of batches expected */ } HashPath; /* @@ -916,7 +916,7 @@ typedef struct HashPath * if we decide that it can be pushed down into the nullable side of the join. * In that case it acts as a plain filter qual for wherever it gets evaluated. * (In short, is_pushed_down is only false for non-degenerate outer join - * conditions. Possibly we should rename it to reflect that meaning?) + * conditions. Possibly we should rename it to reflect that meaning?) * * RestrictInfo nodes also contain an outerjoin_delayed flag, which is true * if the clause's applicability must be delayed due to any outer joins @@ -926,7 +926,7 @@ typedef struct HashPath * forced null by some outer join below the clause. outerjoin_delayed = true * is subtly different from nullable_relids != NULL: a clause might reference * some nullable rels and yet not be outerjoin_delayed because it also - * references all the other rels of the outer join(s). A clause that is not + * references all the other rels of the outer join(s). A clause that is not * outerjoin_delayed can be enforced anywhere it is computable. * * In general, the referenced clause might be arbitrarily complex. The @@ -977,7 +977,7 @@ typedef struct RestrictInfo bool is_pushed_down; /* TRUE if clause was pushed down in level */ - bool outerjoin_delayed; /* TRUE if delayed by lower outer join */ + bool outerjoin_delayed; /* TRUE if delayed by lower outer join */ bool can_join; /* see comment above */ @@ -1005,10 +1005,10 @@ typedef struct RestrictInfo /* cache space for cost and selectivity */ QualCost eval_cost; /* eval cost of clause; -1 if not yet set */ Selectivity norm_selec; /* selectivity for "normal" (JOIN_INNER) - * semantics; -1 if not yet set; >1 means - * a redundant clause */ - Selectivity outer_selec; /* selectivity for outer join semantics; - * -1 if not yet set */ + * semantics; -1 if not yet set; >1 means a + * redundant clause */ + Selectivity outer_selec; /* selectivity for outer join semantics; -1 if + * not yet set */ /* valid if clause is mergejoinable, else NIL */ List *mergeopfamilies; /* opfamilies containing clause operator */ @@ -1089,8 +1089,8 @@ typedef struct InnerIndexscanInfo /* * Placeholder node for an expression to be evaluated below the top level - * of a plan tree. This is used during planning to represent the contained - * expression. At the end of the planning process it is replaced by either + * of a plan tree. This is used during planning to represent the contained + * expression. At the end of the planning process it is replaced by either * the contained expression or a Var referring to a lower-level evaluation of * the contained expression. Typically the evaluation occurs below an outer * join, and Var references above the outer join might thereby yield NULL @@ -1116,7 +1116,7 @@ typedef struct PlaceHolderVar * One-sided outer joins constrain the order of joining partially but not * completely. We flatten such joins into the planner's top-level list of * relations to join, but record information about each outer join in a - * SpecialJoinInfo struct. These structs are kept in the PlannerInfo node's + * SpecialJoinInfo struct. These structs are kept in the PlannerInfo node's * join_info_list. * * Similarly, semijoins and antijoins created by flattening IN (subselect) @@ -1241,7 +1241,7 @@ typedef struct AppendRelInfo * used to translate Vars referencing the parent rel into references to * the child. A list element is NULL if it corresponds to a dropped * column of the parent (this is only possible for inheritance cases, not - * UNION ALL). The list elements are always simple Vars for inheritance + * UNION ALL). The list elements are always simple Vars for inheritance * cases, but can be arbitrary expressions in UNION ALL cases. * * Notice we only store entries for user columns (attno > 0). Whole-row @@ -1265,7 +1265,7 @@ typedef struct AppendRelInfo * For each distinct placeholder expression generated during planning, we * store a PlaceHolderInfo node in the PlannerInfo node's placeholder_list. * This stores info that is needed centrally rather than in each copy of the - * PlaceHolderVar. The phid fields identify which PlaceHolderInfo goes with + * PlaceHolderVar. The phid fields identify which PlaceHolderInfo goes with * each PlaceHolderVar. Note that phid is unique throughout a planner run, * not just within a query level --- this is so that we need not reassign ID's * when pulling a subquery into its parent. diff --git a/src/include/nodes/tidbitmap.h b/src/include/nodes/tidbitmap.h index 97e1d4c9c4..38c0f65824 100644 --- a/src/include/nodes/tidbitmap.h +++ b/src/include/nodes/tidbitmap.h @@ -15,7 +15,7 @@ * * Copyright (c) 2003-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/nodes/tidbitmap.h,v 1.10 2009/03/24 20:17:18 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/tidbitmap.h,v 1.11 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -50,8 +50,8 @@ extern TIDBitmap *tbm_create(long maxbytes); extern void tbm_free(TIDBitmap *tbm); extern void tbm_add_tuples(TIDBitmap *tbm, - const ItemPointer tids, int ntids, - bool recheck); + const ItemPointer tids, int ntids, + bool recheck); extern void tbm_add_page(TIDBitmap *tbm, BlockNumber pageno); extern void tbm_union(TIDBitmap *a, const TIDBitmap *b); diff --git a/src/include/optimizer/clauses.h b/src/include/optimizer/clauses.h index 0b845b1de1..cb42bd4a95 100644 --- a/src/include/optimizer/clauses.h +++ b/src/include/optimizer/clauses.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/clauses.h,v 1.97 2009/01/01 17:24:00 momjian Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/clauses.h,v 1.98 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -29,7 +29,7 @@ typedef struct typedef struct { - int numWindowFuncs; /* total number of WindowFuncs found */ + int numWindowFuncs; /* total number of WindowFuncs found */ Index maxWinRef; /* windowFuncs[] is indexed 0 .. maxWinRef */ List **windowFuncs; /* lists of WindowFuncs for each winref */ } WindowFuncLists; @@ -89,6 +89,6 @@ extern Node *eval_const_expressions(PlannerInfo *root, Node *node); extern Node *estimate_expression_value(PlannerInfo *root, Node *node); extern Query *inline_set_returning_function(PlannerInfo *root, - RangeTblEntry *rte); + RangeTblEntry *rte); #endif /* CLAUSES_H */ diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h index 27600fa1ac..343662f6b8 100644 --- a/src/include/optimizer/cost.h +++ b/src/include/optimizer/cost.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/cost.h,v 1.96 2009/01/07 22:40:49 tgl Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/cost.h,v 1.97 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -31,8 +31,8 @@ typedef enum { - CONSTRAINT_EXCLUSION_OFF, /* do not use c_e */ - CONSTRAINT_EXCLUSION_ON, /* apply c_e to all rels */ + CONSTRAINT_EXCLUSION_OFF, /* do not use c_e */ + CONSTRAINT_EXCLUSION_ON, /* apply c_e to all rels */ CONSTRAINT_EXCLUSION_PARTITION /* apply c_e to otherrels only */ } ConstraintExclusionType; @@ -101,11 +101,11 @@ extern void cost_group(Path *path, PlannerInfo *root, Cost input_startup_cost, Cost input_total_cost, double input_tuples); extern void cost_nestloop(NestPath *path, PlannerInfo *root, - SpecialJoinInfo *sjinfo); + SpecialJoinInfo *sjinfo); extern void cost_mergejoin(MergePath *path, PlannerInfo *root, - SpecialJoinInfo *sjinfo); + SpecialJoinInfo *sjinfo); extern void cost_hashjoin(HashPath *path, PlannerInfo *root, - SpecialJoinInfo *sjinfo); + SpecialJoinInfo *sjinfo); extern void cost_subplan(PlannerInfo *root, SubPlan *subplan, Plan *plan); extern void cost_qual_eval(QualCost *cost, List *quals, PlannerInfo *root); extern void cost_qual_eval_node(QualCost *cost, Node *qual, PlannerInfo *root); @@ -118,7 +118,7 @@ extern void set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel, extern void set_function_size_estimates(PlannerInfo *root, RelOptInfo *rel); extern void set_values_size_estimates(PlannerInfo *root, RelOptInfo *rel); extern void set_cte_size_estimates(PlannerInfo *root, RelOptInfo *rel, - Plan *cteplan); + Plan *cteplan); /* * prototypes for clausesel.c diff --git a/src/include/optimizer/paths.h b/src/include/optimizer/paths.h index 6f72efb740..cbc8214e9e 100644 --- a/src/include/optimizer/paths.h +++ b/src/include/optimizer/paths.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/paths.h,v 1.106 2009/01/01 17:24:00 momjian Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/paths.h,v 1.107 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -127,8 +127,8 @@ extern void add_child_rel_equivalences(PlannerInfo *root, RelOptInfo *parent_rel, RelOptInfo *child_rel); extern void mutate_eclass_expressions(PlannerInfo *root, - Node *(*mutator) (), - void *context); + Node *(*mutator) (), + void *context); extern List *find_eclass_clauses_for_index_join(PlannerInfo *root, RelOptInfo *rel, Relids outer_relids); diff --git a/src/include/optimizer/placeholder.h b/src/include/optimizer/placeholder.h index cfe6a29de2..33f9a21399 100644 --- a/src/include/optimizer/placeholder.h +++ b/src/include/optimizer/placeholder.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/placeholder.h,v 1.2 2009/01/01 17:24:00 momjian Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/placeholder.h,v 1.3 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -18,11 +18,11 @@ extern PlaceHolderVar *make_placeholder_expr(PlannerInfo *root, Expr *expr, - Relids phrels); + Relids phrels); extern PlaceHolderInfo *find_placeholder_info(PlannerInfo *root, - PlaceHolderVar *phv); + PlaceHolderVar *phv); extern void fix_placeholder_eval_levels(PlannerInfo *root); extern void add_placeholders_to_joinrel(PlannerInfo *root, - RelOptInfo *joinrel); + RelOptInfo *joinrel); #endif /* PLACEHOLDER_H */ diff --git a/src/include/optimizer/plancat.h b/src/include/optimizer/plancat.h index e2d2b00d05..c829ac1891 100644 --- a/src/include/optimizer/plancat.h +++ b/src/include/optimizer/plancat.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/plancat.h,v 1.53 2009/05/12 00:56:05 tgl Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/plancat.h,v 1.54 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -29,7 +29,7 @@ extern void get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent, RelOptInfo *rel); extern void estimate_rel_size(Relation rel, int32 *attr_widths, - BlockNumber *pages, double *tuples); + BlockNumber *pages, double *tuples); extern bool relation_excluded_by_constraints(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte); diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h index 7dbea70e8d..3ffd80003a 100644 --- a/src/include/optimizer/planmain.h +++ b/src/include/optimizer/planmain.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/planmain.h,v 1.117 2009/01/01 17:24:00 momjian Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/planmain.h,v 1.118 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -43,8 +43,8 @@ extern SubqueryScan *make_subqueryscan(List *qptlist, List *qpqual, Index scanrelid, Plan *subplan, List *subrtable); extern Append *make_append(List *appendplans, bool isTarget, List *tlist); extern RecursiveUnion *make_recursive_union(List *tlist, - Plan *lefttree, Plan *righttree, int wtParam, - List *distinctList, long numGroups); + Plan *lefttree, Plan *righttree, int wtParam, + List *distinctList, long numGroups); extern Sort *make_sort_from_pathkeys(PlannerInfo *root, Plan *lefttree, List *pathkeys, double limit_tuples); extern Sort *make_sort_from_sortclauses(PlannerInfo *root, List *sortcls, @@ -116,7 +116,7 @@ extern void set_opfuncid(OpExpr *opexpr); extern void set_sa_opfuncid(ScalarArrayOpExpr *opexpr); extern void record_plan_function_dependency(PlannerGlobal *glob, Oid funcid); extern void extract_query_dependencies(List *queries, - List **relationOids, - List **invalItems); + List **relationOids, + List **invalItems); #endif /* PLANMAIN_H */ diff --git a/src/include/optimizer/subselect.h b/src/include/optimizer/subselect.h index a318853596..dcae8031c3 100644 --- a/src/include/optimizer/subselect.h +++ b/src/include/optimizer/subselect.h @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/subselect.h,v 1.36 2009/02/25 03:30:38 tgl Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/subselect.h,v 1.37 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -17,16 +17,16 @@ extern void SS_process_ctes(PlannerInfo *root); extern JoinExpr *convert_ANY_sublink_to_join(PlannerInfo *root, - SubLink *sublink, - Relids available_rels); + SubLink *sublink, + Relids available_rels); extern JoinExpr *convert_EXISTS_sublink_to_join(PlannerInfo *root, - SubLink *sublink, - bool under_not, - Relids available_rels); + SubLink *sublink, + bool under_not, + Relids available_rels); extern Node *SS_replace_correlation_vars(PlannerInfo *root, Node *expr); extern Node *SS_process_sublinks(PlannerInfo *root, Node *expr, bool isQual); extern void SS_finalize_plan(PlannerInfo *root, Plan *plan, - bool attach_initplans); + bool attach_initplans); extern Param *SS_make_initplan_from_plan(PlannerInfo *root, Plan *plan, Oid resulttype, int32 resulttypmod); extern int SS_assign_worktable_param(PlannerInfo *root); diff --git a/src/include/parser/gramparse.h b/src/include/parser/gramparse.h index 719696ee75..86719855be 100644 --- a/src/include/parser/gramparse.h +++ b/src/include/parser/gramparse.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/parser/gramparse.h,v 1.43 2009/01/01 17:24:00 momjian Exp $ + * $PostgreSQL: pgsql/src/include/parser/gramparse.h,v 1.44 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -35,7 +35,7 @@ typedef enum } BackslashQuoteType; /* GUC variables in scan.l (every one of these is a bad idea :-() */ -extern int backslash_quote; +extern int backslash_quote; extern bool escape_string_warning; extern bool standard_conforming_strings; diff --git a/src/include/parser/parse_agg.h b/src/include/parser/parse_agg.h index f1685a5080..05ec677cb9 100644 --- a/src/include/parser/parse_agg.h +++ b/src/include/parser/parse_agg.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/parser/parse_agg.h,v 1.38 2009/01/01 17:24:00 momjian Exp $ + * $PostgreSQL: pgsql/src/include/parser/parse_agg.h,v 1.39 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ extern void transformAggregateCall(ParseState *pstate, Aggref *agg); extern void transformWindowFuncCall(ParseState *pstate, WindowFunc *wfunc, - WindowDef *windef); + WindowDef *windef); extern void parseCheckAggregates(ParseState *pstate, Query *qry); extern void parseCheckWindowFuncs(ParseState *pstate, Query *qry); diff --git a/src/include/parser/parse_clause.h b/src/include/parser/parse_clause.h index 2f132f3848..c642761cb8 100644 --- a/src/include/parser/parse_clause.h +++ b/src/include/parser/parse_clause.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/parser/parse_clause.h,v 1.54 2009/01/01 17:24:00 momjian Exp $ + * $PostgreSQL: pgsql/src/include/parser/parse_clause.h,v 1.55 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -33,13 +33,13 @@ extern List *transformSortClause(ParseState *pstate, List *orderlist, List **targetlist, bool resolveUnknown); extern List *transformWindowDefinitions(ParseState *pstate, - List *windowdefs, - List **targetlist); + List *windowdefs, + List **targetlist); extern List *transformDistinctClause(ParseState *pstate, List **targetlist, List *sortClause); extern List *transformDistinctOnClause(ParseState *pstate, List *distinctlist, - List **targetlist, List *sortClause); + List **targetlist, List *sortClause); extern Index assignSortGroupRef(TargetEntry *tle, List *tlist); extern bool targetIsInSortList(TargetEntry *tle, Oid sortop, List *sortList); diff --git a/src/include/parser/parse_coerce.h b/src/include/parser/parse_coerce.h index 2b310811c5..c9f83e138f 100644 --- a/src/include/parser/parse_coerce.h +++ b/src/include/parser/parse_coerce.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/parser/parse_coerce.h,v 1.78 2009/01/01 17:24:00 momjian Exp $ + * $PostgreSQL: pgsql/src/include/parser/parse_coerce.h,v 1.79 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -58,12 +58,12 @@ extern Node *coerce_to_specific_type(ParseState *pstate, Node *node, Oid targetTypeId, const char *constructName); -extern int parser_coercion_errposition(ParseState *pstate, - int coerce_location, - Node *input_expr); +extern int parser_coercion_errposition(ParseState *pstate, + int coerce_location, + Node *input_expr); -extern Oid select_common_type(ParseState *pstate, List *exprs, - const char *context, Node **which_expr); +extern Oid select_common_type(ParseState *pstate, List *exprs, + const char *context, Node **which_expr); extern Node *coerce_to_common_type(ParseState *pstate, Node *node, Oid targetTypeId, const char *context); diff --git a/src/include/parser/parse_node.h b/src/include/parser/parse_node.h index 5e49b1a3dd..78b43d915a 100644 --- a/src/include/parser/parse_node.h +++ b/src/include/parser/parse_node.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/parser/parse_node.h,v 1.61 2009/01/22 20:16:09 tgl Exp $ + * $PostgreSQL: pgsql/src/include/parser/parse_node.h,v 1.62 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -59,7 +59,7 @@ * to make an RTE before you can access a CTE. * * p_future_ctes: list of CommonTableExprs (WITH items) that are not yet - * visible due to scope rules. This is used to help improve error messages. + * visible due to scope rules. This is used to help improve error messages. * * p_windowdefs: list of WindowDefs representing WINDOW and OVER clauses. * We collect these while transforming expressions and then transform them @@ -122,7 +122,7 @@ extern void setup_parser_errposition_callback(ParseCallbackState *pcbstate, extern void cancel_parser_errposition_callback(ParseCallbackState *pcbstate); extern Var *make_var(ParseState *pstate, RangeTblEntry *rte, int attrno, - int location); + int location); extern Oid transformArrayType(Oid arrayType); extern ArrayRef *transformArraySubscripts(ParseState *pstate, Node *arrayBase, diff --git a/src/include/parser/parse_relation.h b/src/include/parser/parse_relation.h index cb133fced6..ec0fb09d60 100644 --- a/src/include/parser/parse_relation.h +++ b/src/include/parser/parse_relation.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/parser/parse_relation.h,v 1.63 2009/01/22 20:16:09 tgl Exp $ + * $PostgreSQL: pgsql/src/include/parser/parse_relation.h,v 1.64 2009/06/11 14:49:11 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -24,8 +24,8 @@ extern RangeTblEntry *refnameRangeTblEntry(ParseState *pstate, int location, int *sublevels_up); extern CommonTableExpr *scanNameSpaceForCTE(ParseState *pstate, - const char *refname, - Index *ctelevelsup); + const char *refname, + Index *ctelevelsup); extern void checkNameSpaceConflicts(ParseState *pstate, List *namespace1, List *namespace2); extern int RTERangeTablePosn(ParseState *pstate, @@ -35,7 +35,7 @@ extern RangeTblEntry *GetRTEByRangeTablePosn(ParseState *pstate, int varno, int sublevels_up); extern CommonTableExpr *GetCTEForRTE(ParseState *pstate, RangeTblEntry *rte, - int rtelevelsup); + int rtelevelsup); extern Node *scanRTEForColumn(ParseState *pstate, RangeTblEntry *rte, char *colname, int location); extern Node *colNameToVar(ParseState *pstate, char *colname, bool localonly, @@ -47,9 +47,9 @@ extern Node *qualifiedNameToVar(ParseState *pstate, bool implicitRTEOK, int location); extern void markVarForSelectPriv(ParseState *pstate, Var *var, - RangeTblEntry *rte); + RangeTblEntry *rte); extern Relation parserOpenTable(ParseState *pstate, const RangeVar *relation, - int lockmode); + int lockmode); extern RangeTblEntry *addRangeTableEntry(ParseState *pstate, RangeVar *relation, Alias *alias, diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h index 57bcec768f..3a93328d86 100644 --- a/src/include/pg_config_manual.h +++ b/src/include/pg_config_manual.h @@ -6,7 +6,7 @@ * for developers. If you edit any of these, be sure to do a *full* * rebuild (and an initdb if noted). * - * $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.38 2009/02/26 16:02:39 petere Exp $ + * $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.39 2009/06/11 14:49:08 momjian Exp $ *------------------------------------------------------------------------ */ @@ -188,7 +188,7 @@ /* * Define this to cause palloc()'d memory to be filled with random data, to * facilitate catching code that depends on the contents of uninitialized - * memory. Caution: this is horrendously expensive. + * memory. Caution: this is horrendously expensive. */ /* #define RANDOMIZE_ALLOCATED_MEMORY */ diff --git a/src/include/pgstat.h b/src/include/pgstat.h index 169821b79e..7fa25175f4 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -5,7 +5,7 @@ * * Copyright (c) 2001-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/pgstat.h,v 1.82 2009/01/04 22:19:59 tgl Exp $ + * $PostgreSQL: pgsql/src/include/pgstat.h,v 1.83 2009/06/11 14:49:08 momjian Exp $ * ---------- */ #ifndef PGSTAT_H @@ -182,8 +182,8 @@ typedef struct PgStat_MsgDummy typedef struct PgStat_MsgInquiry { - PgStat_MsgHdr m_hdr; - TimestampTz inquiry_time; /* minimum acceptable file timestamp */ + PgStat_MsgHdr m_hdr; + TimestampTz inquiry_time; /* minimum acceptable file timestamp */ } PgStat_MsgInquiry; @@ -369,7 +369,7 @@ typedef struct PgStat_FunctionEntry * usage statistics. * ---------- */ -#define PGSTAT_NUM_FUNCENTRIES \ +#define PGSTAT_NUM_FUNCENTRIES \ ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \ / sizeof(PgStat_FunctionEntry)) @@ -450,8 +450,8 @@ typedef struct PgStat_StatDBEntry TimestampTz last_autovac_time; /* - * tables and functions must be last in the struct, because we don't - * write the pointers out to the stats file. + * tables and functions must be last in the struct, because we don't write + * the pointers out to the stats file. */ HTAB *tables; HTAB *functions; @@ -510,7 +510,7 @@ typedef struct PgStat_StatFuncEntry */ typedef struct PgStat_GlobalStats { - TimestampTz stats_timestamp; /* time of stats file update */ + TimestampTz stats_timestamp; /* time of stats file update */ PgStat_Counter timed_checkpoints; PgStat_Counter requested_checkpoints; PgStat_Counter buf_written_checkpoints; @@ -577,11 +577,11 @@ typedef struct PgStat_FunctionCallUsage /* NULL means we are not tracking the current function call */ PgStat_FunctionCounts *fs; /* Total time previously charged to function, as of function start */ - instr_time save_f_time; + instr_time save_f_time; /* Backend-wide total time as of function start */ - instr_time save_total; + instr_time save_total; /* system clock as of function start */ - instr_time f_start; + instr_time f_start; } PgStat_FunctionCallUsage; @@ -592,7 +592,7 @@ typedef struct PgStat_FunctionCallUsage extern bool pgstat_track_activities; extern bool pgstat_track_counts; extern int pgstat_track_functions; -extern PGDLLIMPORT int pgstat_track_activity_query_size; +extern PGDLLIMPORT int pgstat_track_activity_query_size; extern char *pgstat_stat_tmpname; extern char *pgstat_stat_filename; @@ -692,9 +692,9 @@ extern void pgstat_count_heap_delete(Relation rel); extern void pgstat_update_heap_dead_tuples(Relation rel, int delta); extern void pgstat_init_function_usage(FunctionCallInfoData *fcinfo, - PgStat_FunctionCallUsage *fcu); + PgStat_FunctionCallUsage *fcu); extern void pgstat_end_function_usage(PgStat_FunctionCallUsage *fcu, - bool finalize); + bool finalize); extern void AtEOXact_PgStat(bool isCommit); extern void AtEOSubXact_PgStat(bool isCommit, int nestDepth); diff --git a/src/include/port.h b/src/include/port.h index ff139468be..7eaf844189 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/port.h,v 1.124 2009/01/07 03:39:33 momjian Exp $ + * $PostgreSQL: pgsql/src/include/port.h,v 1.125 2009/06/11 14:49:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -281,7 +281,7 @@ extern void copydir(char *fromdir, char *todir, bool recurse); extern bool rmtree(const char *path, bool rmtopdir); -/* +/* * stat() is not guaranteed to set the st_size field on win32, so we * redefine it to our own implementation that is. * @@ -293,7 +293,8 @@ extern bool rmtree(const char *path, bool rmtopdir); */ #if defined(WIN32) && !defined(__CYGWIN__) && !defined(UNSAFE_STAT_OK) #include <sys/stat.h> -extern int pgwin32_safestat(const char *path, struct stat *buf); +extern int pgwin32_safestat(const char *path, struct stat * buf); + #define stat(a,b) pgwin32_safestat(a,b) #endif diff --git a/src/include/port/aix.h b/src/include/port/aix.h index 8ee5c22b37..67f300a72d 100644 --- a/src/include/port/aix.h +++ b/src/include/port/aix.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/include/port/aix.h,v 1.12 2008/05/17 01:28:24 adunstan Exp $ + * $PostgreSQL: pgsql/src/include/port/aix.h,v 1.13 2009/06/11 14:49:11 momjian Exp $ */ #define CLASS_CONFLICT #define DISABLE_XOPEN_NLS diff --git a/src/include/port/bsdi.h b/src/include/port/bsdi.h index 03a269ae13..4c4a7af9ae 100644 --- a/src/include/port/bsdi.h +++ b/src/include/port/bsdi.h @@ -1,4 +1,3 @@ /* - * $PostgreSQL: pgsql/src/include/port/bsdi.h,v 1.14 2008/05/17 01:28:24 adunstan Exp $ + * $PostgreSQL: pgsql/src/include/port/bsdi.h,v 1.15 2009/06/11 14:49:11 momjian Exp $ */ - diff --git a/src/include/port/sco.h b/src/include/port/sco.h index 0b237e0822..5de37178b8 100644 --- a/src/include/port/sco.h +++ b/src/include/port/sco.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/include/port/sco.h,v 1.18 2008/05/17 01:28:24 adunstan Exp $ + * $PostgreSQL: pgsql/src/include/port/sco.h,v 1.19 2009/06/11 14:49:11 momjian Exp $ * * see src/backend/libpq/pqcomm.c */ #define SCO_ACCEPT_BUG diff --git a/src/include/port/sunos4.h b/src/include/port/sunos4.h index 19eb6c0629..5241bc0a29 100644 --- a/src/include/port/sunos4.h +++ b/src/include/port/sunos4.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/include/port/sunos4.h,v 1.11 2008/12/11 09:17:07 petere Exp $ + * $PostgreSQL: pgsql/src/include/port/sunos4.h,v 1.12 2009/06/11 14:49:11 momjian Exp $ * * sprintf() returns char *, not int, on SunOS 4.1.x */ #define SPRINTF_CHAR diff --git a/src/include/port/ultrix4.h b/src/include/port/ultrix4.h index 2da383fcb1..92a50909e6 100644 --- a/src/include/port/ultrix4.h +++ b/src/include/port/ultrix4.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/include/port/ultrix4.h,v 1.12 2008/05/17 01:28:24 adunstan Exp $ + * $PostgreSQL: pgsql/src/include/port/ultrix4.h,v 1.13 2009/06/11 14:49:11 momjian Exp $ */ #define NOFIXADE #define NEED_STRDUP diff --git a/src/include/port/univel.h b/src/include/port/univel.h index 10309bba46..74eafd978f 100644 --- a/src/include/port/univel.h +++ b/src/include/port/univel.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/include/port/univel.h,v 1.24 2008/05/17 01:28:24 adunstan Exp $ + * $PostgreSQL: pgsql/src/include/port/univel.h,v 1.25 2009/06/11 14:49:12 momjian Exp $ * *************************************** * Define this if you are compiling with diff --git a/src/include/port/unixware.h b/src/include/port/unixware.h index a8002a0dcb..a63169910b 100644 --- a/src/include/port/unixware.h +++ b/src/include/port/unixware.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/include/port/unixware.h,v 1.18 2008/05/17 01:28:24 adunstan Exp $ + * $PostgreSQL: pgsql/src/include/port/unixware.h,v 1.19 2009/06/11 14:49:12 momjian Exp $ * * see src/backend/libpq/pqcomm.c */ #define SCO_ACCEPT_BUG diff --git a/src/include/port/win32.h b/src/include/port/win32.h index d3a4a08d6b..9ace851ebb 100644 --- a/src/include/port/win32.h +++ b/src/include/port/win32.h @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.87 2009/04/19 22:37:13 tgl Exp $ */ +/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.88 2009/06/11 14:49:12 momjian Exp $ */ #if defined(_MSC_VER) || defined(__BORLANDC__) #define WIN32_ONLY_COMPILER @@ -292,14 +292,16 @@ extern int pgwin32_is_service(void); extern void _dosmaperr(unsigned long); /* in port/win32env.c */ -extern int pgwin32_putenv(const char *); +extern int pgwin32_putenv(const char *); extern void pgwin32_unsetenv(const char *); + #define putenv(x) pgwin32_putenv(x) #define unsetenv(x) pgwin32_unsetenv(x) /* Things that exist in MingW headers, but need to be added to MSVC & BCC */ #ifdef WIN32_ONLY_COMPILER typedef long ssize_t; + #ifndef __BORLANDC__ typedef unsigned short mode_t; #endif @@ -346,11 +348,10 @@ typedef unsigned short mode_t; #ifndef O_RANDOM #define O_RANDOM 0x0010 /* File access is primarily random */ #define O_SEQUENTIAL 0x0020 /* File access is primarily sequential */ -#define O_TEMPORARY 0x0040 /* Temporary file bit */ +#define O_TEMPORARY 0x0040 /* Temporary file bit */ #define O_SHORT_LIVED 0x1000 /* Temporary storage file, try not to flush */ #define _O_SHORT_LIVED O_SHORT_LIVED -#endif /* ifndef O_RANDOM */ - -#endif /* __BORLANDC__ */ +#endif /* ifndef O_RANDOM */ +#endif /* __BORLANDC__ */ #endif diff --git a/src/include/port/win32/pwd.h b/src/include/port/win32/pwd.h index 8af52ef490..a386c459f0 100644 --- a/src/include/port/win32/pwd.h +++ b/src/include/port/win32/pwd.h @@ -1,4 +1,3 @@ /* - * $PostgreSQL: pgsql/src/include/port/win32/pwd.h,v 1.3 2008/05/17 01:28:25 adunstan Exp $ + * $PostgreSQL: pgsql/src/include/port/win32/pwd.h,v 1.4 2009/06/11 14:49:12 momjian Exp $ */ - diff --git a/src/include/port/win32/sys/wait.h b/src/include/port/win32/sys/wait.h index 20835d89ca..d41a67aa10 100644 --- a/src/include/port/win32/sys/wait.h +++ b/src/include/port/win32/sys/wait.h @@ -1,4 +1,3 @@ /* - * $PostgreSQL: pgsql/src/include/port/win32/sys/wait.h,v 1.3 2008/05/17 01:28:25 adunstan Exp $ + * $PostgreSQL: pgsql/src/include/port/win32/sys/wait.h,v 1.4 2009/06/11 14:49:12 momjian Exp $ */ - diff --git a/src/include/portability/instr_time.h b/src/include/portability/instr_time.h index 0022025974..2d48d866fc 100644 --- a/src/include/portability/instr_time.h +++ b/src/include/portability/instr_time.h @@ -10,8 +10,8 @@ * high-precision-timing APIs on yet other platforms. * * The basic data type is instr_time, which all callers should treat as an - * opaque typedef. instr_time can store either an absolute time (of - * unspecified reference time) or an interval. The operations provided + * opaque typedef. instr_time can store either an absolute time (of + * unspecified reference time) or an interval. The operations provided * for it are: * * INSTR_TIME_IS_ZERO(t) is t equal to zero? @@ -45,7 +45,7 @@ * * Copyright (c) 2001-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/portability/instr_time.h,v 1.3 2009/01/01 17:24:01 momjian Exp $ + * $PostgreSQL: pgsql/src/include/portability/instr_time.h,v 1.4 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -113,8 +113,7 @@ typedef struct timeval instr_time; #define INSTR_TIME_GET_MICROSEC(t) \ (((uint64) (t).tv_sec * (uint64) 1000000) + (uint64) (t).tv_usec) - -#else /* WIN32 */ +#else /* WIN32 */ typedef LARGE_INTEGER instr_time; @@ -150,7 +149,6 @@ GetTimerFrequency(void) QueryPerformanceFrequency(&f); return (double) f.QuadPart; } - #endif /* WIN32 */ #endif /* INSTR_TIME_H */ diff --git a/src/include/postmaster/bgwriter.h b/src/include/postmaster/bgwriter.h index fc9a75f3a2..674eb029ba 100644 --- a/src/include/postmaster/bgwriter.h +++ b/src/include/postmaster/bgwriter.h @@ -5,7 +5,7 @@ * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/postmaster/bgwriter.h,v 1.13 2009/01/01 17:24:01 momjian Exp $ + * $PostgreSQL: pgsql/src/include/postmaster/bgwriter.h,v 1.14 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -28,7 +28,7 @@ extern void RequestCheckpoint(int flags); extern void CheckpointWriteDelay(int flags, double progress); extern bool ForwardFsyncRequest(RelFileNode rnode, ForkNumber forknum, - BlockNumber segno); + BlockNumber segno); extern void AbsorbFsyncRequests(void); extern Size BgWriterShmemSize(void); diff --git a/src/include/regex/regex.h b/src/include/regex/regex.h index be5d7e6ee1..abd90bc07c 100644 --- a/src/include/regex/regex.h +++ b/src/include/regex/regex.h @@ -29,7 +29,7 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $PostgreSQL: pgsql/src/include/regex/regex.h,v 1.30 2008/04/02 14:42:56 mha Exp $ + * $PostgreSQL: pgsql/src/include/regex/regex.h,v 1.31 2009/06/11 14:49:12 momjian Exp $ */ /* @@ -151,7 +151,7 @@ typedef struct #define REG_INVARG 16 /* invalid argument to regex function */ #define REG_MIXED 17 /* character widths of regex and string differ */ #define REG_BADOPT 18 /* invalid embedded option */ -#define REG_ETOOBIG 19 /* nfa has too many states */ +#define REG_ETOOBIG 19 /* nfa has too many states */ /* two specials for debugging and testing */ #define REG_ATOI 101 /* convert error-code name to number */ #define REG_ITOA 102 /* convert error-code number to name */ @@ -169,6 +169,6 @@ extern size_t pg_regerror(int, const regex_t *, char *, size_t); /* * guc configuration variables */ -extern int regex_flavor; +extern int regex_flavor; #endif /* _REGEX_H_ */ diff --git a/src/include/rewrite/rewriteManip.h b/src/include/rewrite/rewriteManip.h index 3b0c668410..51993f3a78 100644 --- a/src/include/rewrite/rewriteManip.h +++ b/src/include/rewrite/rewriteManip.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/rewrite/rewriteManip.h,v 1.49 2009/01/01 17:24:01 momjian Exp $ + * $PostgreSQL: pgsql/src/include/rewrite/rewriteManip.h,v 1.50 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -23,7 +23,7 @@ extern void ChangeVarNodes(Node *node, int old_varno, int new_varno, extern void IncrementVarSublevelsUp(Node *node, int delta_sublevels_up, int min_sublevels_up); extern void IncrementVarSublevelsUp_rtable(List *rtable, - int delta_sublevels_up, int min_sublevels_up); + int delta_sublevels_up, int min_sublevels_up); extern bool rangeTableEntry_used(Node *node, int rt_index, int sublevels_up); diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h index 12512d7428..7084343037 100644 --- a/src/include/storage/buf_internals.h +++ b/src/include/storage/buf_internals.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/buf_internals.h,v 1.101 2009/01/12 05:10:45 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/buf_internals.h,v 1.102 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -209,7 +209,7 @@ extern void BufTableDelete(BufferTag *tagPtr, uint32 hashcode); /* localbuf.c */ extern void LocalPrefetchBuffer(SMgrRelation smgr, ForkNumber forkNum, - BlockNumber blockNum); + BlockNumber blockNum); extern BufferDesc *LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum, bool *foundPtr); extern void MarkLocalBufferDirty(Buffer buffer); diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h index 0ee09ced6d..af3562a79d 100644 --- a/src/include/storage/bufmgr.h +++ b/src/include/storage/bufmgr.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/bufmgr.h,v 1.120 2009/01/12 05:10:45 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/bufmgr.h,v 1.121 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -35,9 +35,10 @@ typedef enum BufferAccessStrategyType /* Possible modes for ReadBufferExtended() */ typedef enum { - RBM_NORMAL, /* Normal read */ - RBM_ZERO, /* Don't read from disk, caller will initialize */ - RBM_ZERO_ON_ERROR /* Read, but return an all-zeros page on error */ + RBM_NORMAL, /* Normal read */ + RBM_ZERO, /* Don't read from disk, caller will + * initialize */ + RBM_ZERO_ON_ERROR /* Read, but return an all-zeros page on error */ } ReadBufferMode; /* in globals.c ... this duplicates miscadmin.h */ @@ -154,14 +155,14 @@ extern PGDLLIMPORT int32 *LocalRefCount; * prototypes for functions in bufmgr.c */ extern void PrefetchBuffer(Relation reln, ForkNumber forkNum, - BlockNumber blockNum); + BlockNumber blockNum); extern Buffer ReadBuffer(Relation reln, BlockNumber blockNum); extern Buffer ReadBufferExtended(Relation reln, ForkNumber forkNum, - BlockNumber blockNum, ReadBufferMode mode, - BufferAccessStrategy strategy); + BlockNumber blockNum, ReadBufferMode mode, + BufferAccessStrategy strategy); extern Buffer ReadBufferWithoutRelcache(RelFileNode rnode, bool isTemp, - ForkNumber forkNum, BlockNumber blockNum, - ReadBufferMode mode, BufferAccessStrategy strategy); + ForkNumber forkNum, BlockNumber blockNum, + ReadBufferMode mode, BufferAccessStrategy strategy); extern void ReleaseBuffer(Buffer buffer); extern void UnlockReleaseBuffer(Buffer buffer); extern void MarkBufferDirty(Buffer buffer); @@ -189,8 +190,8 @@ extern void DropDatabaseBuffers(Oid dbid); extern void PrintPinnedBufs(void); #endif extern Size BufferShmemSize(void); -extern void BufferGetTag(Buffer buffer, RelFileNode *rnode, - ForkNumber *forknum, BlockNumber *blknum); +extern void BufferGetTag(Buffer buffer, RelFileNode *rnode, + ForkNumber *forknum, BlockNumber *blknum); extern void SetBufferCommitInfoNeedsSave(Buffer buffer); diff --git a/src/include/storage/freespace.h b/src/include/storage/freespace.h index 83f3726d29..885002a7b8 100644 --- a/src/include/storage/freespace.h +++ b/src/include/storage/freespace.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/freespace.h,v 1.33 2009/01/01 17:24:01 momjian Exp $ + * $PostgreSQL: pgsql/src/include/storage/freespace.h,v 1.34 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -27,9 +27,9 @@ extern BlockNumber RecordAndGetPageWithFreeSpace(Relation rel, Size oldSpaceAvail, Size spaceNeeded); extern void RecordPageWithFreeSpace(Relation rel, BlockNumber heapBlk, - Size spaceAvail); + Size spaceAvail); extern void XLogRecordPageWithFreeSpace(RelFileNode rnode, BlockNumber heapBlk, - Size spaceAvail); + Size spaceAvail); extern void FreeSpaceMapTruncateRel(Relation rel, BlockNumber nblocks); extern void FreeSpaceMapVacuum(Relation rel); diff --git a/src/include/storage/fsm_internals.h b/src/include/storage/fsm_internals.h index 9444a5af13..70031a4e91 100644 --- a/src/include/storage/fsm_internals.h +++ b/src/include/storage/fsm_internals.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/fsm_internals.h,v 1.2 2009/01/01 17:24:01 momjian Exp $ + * $PostgreSQL: pgsql/src/include/storage/fsm_internals.h,v 1.3 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -25,22 +25,22 @@ typedef struct { /* - * fsm_search_avail() tries to spread the load of multiple backends - * by returning different pages to different backends in a round-robin - * fashion. fp_next_slot points to the next slot to be returned - * (assuming there's enough space on it for the request). It's defined - * as an int, because it's updated without an exclusive lock. uint16 - * would be more appropriate, but int is more likely to be atomically + * fsm_search_avail() tries to spread the load of multiple backends by + * returning different pages to different backends in a round-robin + * fashion. fp_next_slot points to the next slot to be returned (assuming + * there's enough space on it for the request). It's defined as an int, + * because it's updated without an exclusive lock. uint16 would be more + * appropriate, but int is more likely to be atomically * fetchable/storable. */ - int fp_next_slot; + int fp_next_slot; /* * fp_nodes contains the binary tree, stored in array. The first * NonLeafNodesPerPage elements are upper nodes, and the following * LeafNodesPerPage elements are leaf nodes. Unused nodes are zero. */ - uint8 fp_nodes[1]; + uint8 fp_nodes[1]; } FSMPageData; typedef FSMPageData *FSMPage; @@ -63,7 +63,7 @@ typedef FSMPageData *FSMPage; /* Prototypes for functions in fsmpage.c */ extern int fsm_search_avail(Buffer buf, uint8 min_cat, bool advancenext, - bool exclusive_lock_held); + bool exclusive_lock_held); extern uint8 fsm_get_avail(Page page, int slot); extern uint8 fsm_get_max_avail(Page page); extern bool fsm_set_avail(Page page, int slot, uint8 value); diff --git a/src/include/storage/ipc.h b/src/include/storage/ipc.h index bcab86d8aa..b76c033d48 100644 --- a/src/include/storage/ipc.h +++ b/src/include/storage/ipc.h @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/ipc.h,v 1.77 2009/01/03 17:08:39 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/ipc.h,v 1.78 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -44,12 +44,12 @@ typedef void (*shmem_startup_hook_type) (void); * Note: the macro arguments are multiply evaluated, so avoid side-effects. *---------- */ -#define PG_ENSURE_ERROR_CLEANUP(cleanup_function, arg) \ +#define PG_ENSURE_ERROR_CLEANUP(cleanup_function, arg) \ do { \ on_shmem_exit(cleanup_function, arg); \ PG_TRY() -#define PG_END_ENSURE_ERROR_CLEANUP(cleanup_function, arg) \ +#define PG_END_ENSURE_ERROR_CLEANUP(cleanup_function, arg) \ cancel_shmem_exit(cleanup_function, arg); \ PG_CATCH(); \ { \ diff --git a/src/include/storage/lmgr.h b/src/include/storage/lmgr.h index 738e0079d9..29212fd6d6 100644 --- a/src/include/storage/lmgr.h +++ b/src/include/storage/lmgr.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/lmgr.h,v 1.64 2009/01/01 17:24:01 momjian Exp $ + * $PostgreSQL: pgsql/src/include/storage/lmgr.h,v 1.65 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -74,9 +74,9 @@ extern void UnlockSharedObject(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode); extern void LockSharedObjectForSession(Oid classid, Oid objid, uint16 objsubid, - LOCKMODE lockmode); + LOCKMODE lockmode); extern void UnlockSharedObjectForSession(Oid classid, Oid objid, uint16 objsubid, - LOCKMODE lockmode); + LOCKMODE lockmode); /* Describe a locktag for error messages */ extern void DescribeLockTag(StringInfo buf, const LOCKTAG *tag); diff --git a/src/include/storage/pmsignal.h b/src/include/storage/pmsignal.h index ebfc1b8aa6..db47cd69f5 100644 --- a/src/include/storage/pmsignal.h +++ b/src/include/storage/pmsignal.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/pmsignal.h,v 1.24 2009/05/05 19:59:00 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/pmsignal.h,v 1.25 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -23,7 +23,8 @@ typedef enum { PMSIGNAL_RECOVERY_STARTED, /* recovery has started */ - PMSIGNAL_RECOVERY_CONSISTENT, /* recovery has reached consistent state */ + PMSIGNAL_RECOVERY_CONSISTENT, /* recovery has reached consistent + * state */ PMSIGNAL_PASSWORD_CHANGE, /* pg_auth file has changed */ PMSIGNAL_WAKEN_ARCHIVER, /* send a NOTIFY signal to xlog archiver */ PMSIGNAL_ROTATE_LOGFILE, /* send SIGUSR1 to syslogger to rotate logfile */ diff --git a/src/include/storage/procarray.h b/src/include/storage/procarray.h index bd49e09652..fab84ee1a0 100644 --- a/src/include/storage/procarray.h +++ b/src/include/storage/procarray.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/procarray.h,v 1.25 2009/04/04 17:40:36 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/procarray.h,v 1.26 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -46,7 +46,7 @@ extern int CountActiveBackends(void); extern int CountDBBackends(Oid databaseid); extern int CountUserBackends(Oid roleid); extern bool CountOtherDBBackends(Oid databaseId, - int *nbackends, int *nprepared); + int *nbackends, int *nprepared); extern void XidCacheRemoveRunningXids(TransactionId xid, int nxids, const TransactionId *xids, diff --git a/src/include/storage/relfilenode.h b/src/include/storage/relfilenode.h index 089189f4f8..9f77ef9470 100644 --- a/src/include/storage/relfilenode.h +++ b/src/include/storage/relfilenode.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/relfilenode.h,v 1.22 2009/01/01 17:24:01 momjian Exp $ + * $PostgreSQL: pgsql/src/include/storage/relfilenode.h,v 1.23 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -26,6 +26,7 @@ typedef enum ForkNumber MAIN_FORKNUM = 0, FSM_FORKNUM, VISIBILITYMAP_FORKNUM + /* * NOTE: if you add a new fork, change MAX_FORKNUM below and update the * forkNames array in catalog.c diff --git a/src/include/storage/shmem.h b/src/include/storage/shmem.h index ad9f21582e..53f8c2e063 100644 --- a/src/include/storage/shmem.h +++ b/src/include/storage/shmem.h @@ -14,7 +14,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/shmem.h,v 1.55 2009/01/01 17:24:01 momjian Exp $ + * $PostgreSQL: pgsql/src/include/storage/shmem.h,v 1.56 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -56,8 +56,8 @@ extern void RequestAddinShmemSpace(Size size); typedef struct { char key[SHMEM_INDEX_KEYSIZE]; /* string name */ - void *location; /* location in shared mem */ - Size size; /* # bytes allocated for the structure */ + void *location; /* location in shared mem */ + Size size; /* # bytes allocated for the structure */ } ShmemIndexEnt; /* diff --git a/src/include/storage/sinval.h b/src/include/storage/sinval.h index 5f2d4a0629..f332ec285e 100644 --- a/src/include/storage/sinval.h +++ b/src/include/storage/sinval.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/sinval.h,v 1.51 2009/01/01 17:24:01 momjian Exp $ + * $PostgreSQL: pgsql/src/include/storage/sinval.h,v 1.52 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -84,7 +84,7 @@ typedef union extern void SendSharedInvalidMessages(const SharedInvalidationMessage *msgs, - int n); + int n); extern void ReceiveSharedInvalidMessages( void (*invalFunction) (SharedInvalidationMessage *msg), void (*resetFunction) (void)); diff --git a/src/include/storage/sinvaladt.h b/src/include/storage/sinvaladt.h index 62dbddef9f..87a8c6d3a1 100644 --- a/src/include/storage/sinvaladt.h +++ b/src/include/storage/sinvaladt.h @@ -8,14 +8,14 @@ * must be delivered to all already-running backends before it can be * forgotten. (If we run out of space, we instead deliver a "RESET" * message to backends that have fallen too far behind.) - * + * * The struct type SharedInvalidationMessage, defining the contents of * a single message, is defined in sinval.h. * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/sinvaladt.h,v 1.50 2009/01/01 17:24:01 momjian Exp $ + * $PostgreSQL: pgsql/src/include/storage/sinvaladt.h,v 1.51 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -33,7 +33,7 @@ extern void SharedInvalBackendInit(void); extern bool BackendIdIsActive(int backendID); extern void SIInsertDataEntries(const SharedInvalidationMessage *data, int n); -extern int SIGetDataEntries(SharedInvalidationMessage *data, int datasize); +extern int SIGetDataEntries(SharedInvalidationMessage *data, int datasize); extern void SICleanupQueue(bool callerHasWriteLock, int minFree); extern LocalTransactionId GetNextLocalTransactionId(void); diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h index e753af76dd..1b4b06ac96 100644 --- a/src/include/storage/smgr.h +++ b/src/include/storage/smgr.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.66 2009/01/12 05:10:45 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.67 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -67,18 +67,18 @@ extern void smgrcloseall(void); extern void smgrclosenode(RelFileNode rnode); extern void smgrcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo); extern void smgrdounlink(SMgrRelation reln, ForkNumber forknum, - bool isTemp, bool isRedo); -extern void smgrextend(SMgrRelation reln, ForkNumber forknum, - BlockNumber blocknum, char *buffer, bool isTemp); + bool isTemp, bool isRedo); +extern void smgrextend(SMgrRelation reln, ForkNumber forknum, + BlockNumber blocknum, char *buffer, bool isTemp); extern void smgrprefetch(SMgrRelation reln, ForkNumber forknum, - BlockNumber blocknum); + BlockNumber blocknum); extern void smgrread(SMgrRelation reln, ForkNumber forknum, - BlockNumber blocknum, char *buffer); + BlockNumber blocknum, char *buffer); extern void smgrwrite(SMgrRelation reln, ForkNumber forknum, - BlockNumber blocknum, char *buffer, bool isTemp); + BlockNumber blocknum, char *buffer, bool isTemp); extern BlockNumber smgrnblocks(SMgrRelation reln, ForkNumber forknum); extern void smgrtruncate(SMgrRelation reln, ForkNumber forknum, - BlockNumber nblocks, bool isTemp); + BlockNumber nblocks, bool isTemp); extern void smgrimmedsync(SMgrRelation reln, ForkNumber forknum); extern void smgrpreckpt(void); extern void smgrsync(void); @@ -94,23 +94,23 @@ extern void mdcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo); extern bool mdexists(SMgrRelation reln, ForkNumber forknum); extern void mdunlink(RelFileNode rnode, ForkNumber forknum, bool isRedo); extern void mdextend(SMgrRelation reln, ForkNumber forknum, - BlockNumber blocknum, char *buffer, bool isTemp); + BlockNumber blocknum, char *buffer, bool isTemp); extern void mdprefetch(SMgrRelation reln, ForkNumber forknum, - BlockNumber blocknum); + BlockNumber blocknum); extern void mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, - char *buffer); + char *buffer); extern void mdwrite(SMgrRelation reln, ForkNumber forknum, - BlockNumber blocknum, char *buffer, bool isTemp); + BlockNumber blocknum, char *buffer, bool isTemp); extern BlockNumber mdnblocks(SMgrRelation reln, ForkNumber forknum); extern void mdtruncate(SMgrRelation reln, ForkNumber forknum, - BlockNumber nblocks, bool isTemp); + BlockNumber nblocks, bool isTemp); extern void mdimmedsync(SMgrRelation reln, ForkNumber forknum); extern void mdpreckpt(void); extern void mdsync(void); extern void mdpostckpt(void); extern void RememberFsyncRequest(RelFileNode rnode, ForkNumber forknum, - BlockNumber segno); + BlockNumber segno); extern void ForgetRelationFsyncRequests(RelFileNode rnode, ForkNumber forknum); extern void ForgetDatabaseFsyncRequests(Oid dbid); diff --git a/src/include/tcop/dest.h b/src/include/tcop/dest.h index 40437e1eaa..202f0df459 100644 --- a/src/include/tcop/dest.h +++ b/src/include/tcop/dest.h @@ -36,7 +36,7 @@ * destroyed by calling its rDestroy method. * * In some cases, receiver objects require additional parameters that must - * be passed to them after calling CreateDestReceiver. Since the set of + * be passed to them after calling CreateDestReceiver. Since the set of * parameters varies for different receiver types, this is not handled by * this module, but by direct calls from the calling code to receiver type * specific functions. @@ -60,7 +60,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/tcop/dest.h,v 1.57 2009/01/01 17:24:01 momjian Exp $ + * $PostgreSQL: pgsql/src/include/tcop/dest.h,v 1.58 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ diff --git a/src/include/tcop/tcopprot.h b/src/include/tcop/tcopprot.h index 144fad0cd8..3368e6539c 100644 --- a/src/include/tcop/tcopprot.h +++ b/src/include/tcop/tcopprot.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/tcop/tcopprot.h,v 1.97 2009/01/01 17:24:01 momjian Exp $ + * $PostgreSQL: pgsql/src/include/tcop/tcopprot.h,v 1.98 2009/06/11 14:49:12 momjian Exp $ * * OLD COMMENTS * This file was created so that other c files could get the two @@ -42,7 +42,7 @@ typedef enum LOGSTMT_ALL /* log all statements */ } LogStmtLevel; -extern int log_statement; +extern int log_statement; extern List *pg_parse_and_rewrite(const char *query_string, Oid *paramTypes, int numParams); diff --git a/src/include/tsearch/ts_locale.h b/src/include/tsearch/ts_locale.h index d657d03de3..8d8dfef1d8 100644 --- a/src/include/tsearch/ts_locale.h +++ b/src/include/tsearch/ts_locale.h @@ -5,7 +5,7 @@ * * Copyright (c) 1998-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/tsearch/ts_locale.h,v 1.9 2009/01/01 17:24:01 momjian Exp $ + * $PostgreSQL: pgsql/src/include/tsearch/ts_locale.h,v 1.10 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -67,7 +67,7 @@ extern char *lowerstr(const char *str); extern char *lowerstr_with_len(const char *str, int len); extern bool tsearch_readline_begin(tsearch_readline_state *stp, - const char *filename); + const char *filename); extern char *tsearch_readline(tsearch_readline_state *stp); extern void tsearch_readline_end(tsearch_readline_state *stp); diff --git a/src/include/tsearch/ts_public.h b/src/include/tsearch/ts_public.h index 0bcc2be00e..253fa1451c 100644 --- a/src/include/tsearch/ts_public.h +++ b/src/include/tsearch/ts_public.h @@ -6,7 +6,7 @@ * * Copyright (c) 1998-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/tsearch/ts_public.h,v 1.13 2009/01/15 16:33:59 teodor Exp $ + * $PostgreSQL: pgsql/src/include/tsearch/ts_public.h,v 1.14 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -56,7 +56,7 @@ typedef struct char *fragdelim; int2 startsellen; int2 stopsellen; - int2 fragdelimlen; + int2 fragdelimlen; } HeadlineParsedText; /* diff --git a/src/include/tsearch/ts_utils.h b/src/include/tsearch/ts_utils.h index 55a4d334de..566227ef6f 100644 --- a/src/include/tsearch/ts_utils.h +++ b/src/include/tsearch/ts_utils.h @@ -5,7 +5,7 @@ * * Copyright (c) 1998-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/tsearch/ts_utils.h,v 1.16 2009/01/01 17:24:01 momjian Exp $ + * $PostgreSQL: pgsql/src/include/tsearch/ts_utils.h,v 1.17 2009/06/11 14:49:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -45,7 +45,7 @@ typedef void (*PushFunction) (Datum opaque, TSQueryParserState state, int2 tokenweights, /* bitmap as described * in QueryOperand * struct */ - bool prefix); + bool prefix); extern TSQuery parse_tsquery(char *buf, PushFunction pushval, @@ -75,7 +75,7 @@ typedef struct */ uint16 *apos; } pos; - uint16 flags; /* currently, only TSL_PREFIX */ + uint16 flags; /* currently, only TSL_PREFIX */ char *word; uint32 alen; } ParsedWord; diff --git a/src/include/utils/acl.h b/src/include/utils/acl.h index fed2de5b74..5c38822d5d 100644 --- a/src/include/utils/acl.h +++ b/src/include/utils/acl.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/acl.h,v 1.107 2009/01/22 20:16:09 tgl Exp $ + * $PostgreSQL: pgsql/src/include/utils/acl.h,v 1.108 2009/06/11 14:49:13 momjian Exp $ * * NOTES * An ACL array is simply an array of AclItems, representing the union @@ -264,7 +264,7 @@ extern void ExecuteGrantStmt(GrantStmt *stmt); extern void ExecGrantStmt_oids(InternalGrant *istmt); extern AclMode pg_attribute_aclmask(Oid table_oid, AttrNumber attnum, - Oid roleid, AclMode mask, AclMaskHow how); + Oid roleid, AclMode mask, AclMaskHow how); extern AclMode pg_class_aclmask(Oid table_oid, Oid roleid, AclMode mask, AclMaskHow how); extern AclMode pg_database_aclmask(Oid db_oid, Oid roleid, @@ -278,14 +278,14 @@ extern AclMode pg_namespace_aclmask(Oid nsp_oid, Oid roleid, extern AclMode pg_tablespace_aclmask(Oid spc_oid, Oid roleid, AclMode mask, AclMaskHow how); extern AclMode pg_foreign_data_wrapper_aclmask(Oid fdw_oid, Oid roleid, - AclMode mask, AclMaskHow how); + AclMode mask, AclMaskHow how); extern AclMode pg_foreign_server_aclmask(Oid srv_oid, Oid roleid, - AclMode mask, AclMaskHow how); + AclMode mask, AclMaskHow how); extern AclResult pg_attribute_aclcheck(Oid table_oid, AttrNumber attnum, - Oid roleid, AclMode mode); + Oid roleid, AclMode mode); extern AclResult pg_attribute_aclcheck_all(Oid table_oid, Oid roleid, - AclMode mode, AclMaskHow how); + AclMode mode, AclMaskHow how); extern AclResult pg_class_aclcheck(Oid table_oid, Oid roleid, AclMode mode); extern AclResult pg_database_aclcheck(Oid db_oid, Oid roleid, AclMode mode); extern AclResult pg_proc_aclcheck(Oid proc_oid, Oid roleid, AclMode mode); @@ -299,7 +299,7 @@ extern void aclcheck_error(AclResult aclerr, AclObjectKind objectkind, const char *objectname); extern void aclcheck_error_col(AclResult aclerr, AclObjectKind objectkind, - const char *objectname, const char *colname); + const char *objectname, const char *colname); /* ownercheck routines just return true (owner) or false (not) */ extern bool pg_class_ownercheck(Oid class_oid, Oid roleid); diff --git a/src/include/utils/cash.h b/src/include/utils/cash.h index a195d998d5..5f6fcdfc0d 100644 --- a/src/include/utils/cash.h +++ b/src/include/utils/cash.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/include/utils/cash.h,v 1.26 2008/05/17 01:28:25 adunstan Exp $ + * $PostgreSQL: pgsql/src/include/utils/cash.h,v 1.27 2009/06/11 14:49:13 momjian Exp $ * * * cash.h diff --git a/src/include/utils/date.h b/src/include/utils/date.h index eee40654ac..874b6017e5 100644 --- a/src/include/utils/date.h +++ b/src/include/utils/date.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/date.h,v 1.42 2009/01/01 17:24:02 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/date.h,v 1.43 2009/06/11 14:49:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -64,8 +64,7 @@ typedef struct #define DateADTGetDatum(X) Int32GetDatum(X) #define TimeADTGetDatum(X) Int64GetDatum(X) #define TimeTzADTPGetDatum(X) PointerGetDatum(X) - -#else /* !HAVE_INT64_TIMESTAMP */ +#else /* !HAVE_INT64_TIMESTAMP */ #define MAX_TIME_PRECISION 10 @@ -80,7 +79,6 @@ typedef struct #define DateADTGetDatum(X) Int32GetDatum(X) #define TimeADTGetDatum(X) Float8GetDatum(X) #define TimeTzADTPGetDatum(X) PointerGetDatum(X) - #endif /* HAVE_INT64_TIMESTAMP */ #define PG_GETARG_DATEADT(n) DatumGetDateADT(PG_GETARG_DATUM(n)) diff --git a/src/include/utils/datetime.h b/src/include/utils/datetime.h index 0b757021de..1ba60b2dc3 100644 --- a/src/include/utils/datetime.h +++ b/src/include/utils/datetime.h @@ -9,7 +9,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/datetime.h,v 1.74 2009/06/01 16:55:11 tgl Exp $ + * $PostgreSQL: pgsql/src/include/utils/datetime.h,v 1.75 2009/06/11 14:49:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -297,7 +297,7 @@ extern int DecodeTimeOnly(char **field, int *ftype, extern int DecodeInterval(char **field, int *ftype, int nf, int range, int *dtype, struct pg_tm * tm, fsec_t *fsec); extern int DecodeISO8601Interval(char *str, - int *dtype, struct pg_tm * tm, fsec_t *fsec); + int *dtype, struct pg_tm * tm, fsec_t *fsec); extern void DateTimeParseError(int dterr, const char *str, const char *datatype); diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h index 81ddb9fc37..b6fc5e6771 100644 --- a/src/include/utils/elog.h +++ b/src/include/utils/elog.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.100 2009/06/04 18:33:07 tgl Exp $ + * $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.101 2009/06/11 14:49:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -28,13 +28,13 @@ #define COMMERROR 16 /* Client communication problems; same as LOG * for server reporting, but never sent to * client. */ -#define INFO 17 /* Messages specifically requested by user - * (eg VACUUM VERBOSE output); always sent to +#define INFO 17 /* Messages specifically requested by user (eg + * VACUUM VERBOSE output); always sent to * client regardless of client_min_messages, * but by default not sent to server log. */ #define NOTICE 18 /* Helpful messages to users about query - * operation; sent to client and server log - * by default. */ + * operation; sent to client and server log by + * default. */ #define WARNING 19 /* Warnings. NOTICE is for expected messages * like implicit sequence creation by SERIAL. * WARNING is for unexpected messages. */ @@ -134,7 +134,7 @@ __attribute__((format(printf, 1, 2))); extern int errmsg_plural(const char *fmt_singular, const char *fmt_plural, - unsigned long n, ...) + unsigned long n,...) /* This extension allows gcc to check the format string for consistency with the supplied arguments. */ __attribute__((format(printf, 1, 4))) @@ -154,7 +154,7 @@ __attribute__((format(printf, 1, 2))); extern int errdetail_plural(const char *fmt_singular, const char *fmt_plural, - unsigned long n, ...) + unsigned long n,...) /* This extension allows gcc to check the format string for consistency with the supplied arguments. */ __attribute__((format(printf, 1, 4))) diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h index cded751f92..0705ae05de 100644 --- a/src/include/utils/guc.h +++ b/src/include/utils/guc.h @@ -7,7 +7,7 @@ * Copyright (c) 2000-2009, PostgreSQL Global Development Group * Written by Peter Eisentraut <peter_e@gmx.net>. * - * $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.101 2009/03/09 14:34:35 petere Exp $ + * $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.102 2009/06/11 14:49:13 momjian Exp $ *-------------------------------------------------------------------- */ #ifndef GUC_H @@ -99,7 +99,7 @@ typedef enum struct config_enum_entry { const char *name; - int val; + int val; bool hidden; }; @@ -232,16 +232,16 @@ extern void DefineCustomStringVariable( GucShowHook show_hook); extern void DefineCustomEnumVariable( - const char *name, - const char *short_desc, - const char *long_desc, - int *valueAddr, - int bootValue, - const struct config_enum_entry *options, - GucContext context, - int flags, - GucEnumAssignHook assign_hook, - GucShowHook show_hook); + const char *name, + const char *short_desc, + const char *long_desc, + int *valueAddr, + int bootValue, + const struct config_enum_entry * options, + GucContext context, + int flags, + GucEnumAssignHook assign_hook, + GucShowHook show_hook); extern void EmitWarningsOnPlaceholders(const char *className); @@ -258,7 +258,7 @@ extern void AtEOXact_GUC(bool isCommit, int nestLevel); extern void BeginReportingGUCOptions(void); extern void ParseLongOption(const char *string, char **name, char **value); extern bool parse_int(const char *value, int *result, int flags, - const char **hintmsg); + const char **hintmsg); extern bool parse_real(const char *value, double *result); extern bool set_config_option(const char *name, const char *value, GucContext context, GucSource source, @@ -306,6 +306,6 @@ extern const char *assign_search_path(const char *newval, /* in access/transam/xlog.c */ extern bool assign_xlog_sync_method(int newval, - bool doit, GucSource source); + bool doit, GucSource source); #endif /* GUC_H */ diff --git a/src/include/utils/guc_tables.h b/src/include/utils/guc_tables.h index 43ab249fa4..b50944a547 100644 --- a/src/include/utils/guc_tables.h +++ b/src/include/utils/guc_tables.h @@ -7,7 +7,7 @@ * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/utils/guc_tables.h,v 1.45 2009/01/01 17:24:02 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/guc_tables.h,v 1.46 2009/06/11 14:49:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -125,7 +125,8 @@ struct config_generic GucSource reset_source; /* source of the reset_value */ GucSource source; /* source of the current actual value */ GucStack *stack; /* stacked prior values */ - char *sourcefile; /* file this settings is from (NULL if not file) */ + char *sourcefile; /* file this settings is from (NULL if not + * file) */ int sourceline; /* line in source file */ }; @@ -218,9 +219,9 @@ extern struct config_generic **get_guc_variables(void); extern void build_guc_variables(void); /* search in enum options */ -extern const char *config_enum_lookup_by_value(struct config_enum *record, int val); -extern bool config_enum_lookup_by_name(struct config_enum *record, - const char *value, int *retval); +extern const char *config_enum_lookup_by_value(struct config_enum * record, int val); +extern bool config_enum_lookup_by_name(struct config_enum * record, + const char *value, int *retval); #endif /* GUC_TABLES_H */ diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h index b98ff592a8..4428b22d59 100644 --- a/src/include/utils/lsyscache.h +++ b/src/include/utils/lsyscache.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/lsyscache.h,v 1.127 2009/01/01 17:24:02 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/lsyscache.h,v 1.128 2009/06/11 14:49:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -111,8 +111,8 @@ extern char get_typtype(Oid typid); extern bool type_is_rowtype(Oid typid); extern bool type_is_enum(Oid typid); extern void get_type_category_preferred(Oid typid, - char *typcategory, - bool *typispreferred); + char *typcategory, + bool *typispreferred); extern Oid get_typ_typrelid(Oid typid); extern Oid get_element_type(Oid typid); extern Oid get_array_type(Oid typid); diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index 8c849e3ad6..ca9913bda3 100644 --- a/src/include/utils/rel.h +++ b/src/include/utils/rel.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/rel.h,v 1.113 2009/03/31 22:12:48 tgl Exp $ + * $PostgreSQL: pgsql/src/include/utils/rel.h,v 1.114 2009/06/11 14:49:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -127,7 +127,7 @@ typedef struct RelationData * InvalidBlockNumber */ int rd_refcnt; /* reference count */ bool rd_istemp; /* rel is a temporary relation */ - bool rd_islocaltemp; /* rel is a temp rel of this session */ + bool rd_islocaltemp; /* rel is a temp rel of this session */ bool rd_isnailed; /* rel is nailed in cache */ bool rd_isvalid; /* relcache entry is valid */ char rd_indexvalid; /* state of rd_indexlist: 0 = not valid, 1 = @@ -200,8 +200,8 @@ typedef struct RelationData * sizes of the free space and visibility map forks, or InvalidBlockNumber * if not known yet */ - BlockNumber rd_fsm_nblocks; - BlockNumber rd_vm_nblocks; + BlockNumber rd_fsm_nblocks; + BlockNumber rd_vm_nblocks; /* use "struct" here to avoid needing to include pgstat.h: */ struct PgStat_TableStatus *pgstat_info; /* statistics collection area */ @@ -218,23 +218,23 @@ typedef struct RelationData /* autovacuum-related reloptions. */ typedef struct AutoVacOpts { - bool enabled; - int vacuum_threshold; - int analyze_threshold; - int vacuum_cost_delay; - int vacuum_cost_limit; - int freeze_min_age; - int freeze_max_age; - int freeze_table_age; - float8 vacuum_scale_factor; - float8 analyze_scale_factor; + bool enabled; + int vacuum_threshold; + int analyze_threshold; + int vacuum_cost_delay; + int vacuum_cost_limit; + int freeze_min_age; + int freeze_max_age; + int freeze_table_age; + float8 vacuum_scale_factor; + float8 analyze_scale_factor; } AutoVacOpts; typedef struct StdRdOptions { int32 vl_len_; /* varlena header (do not touch directly!) */ int fillfactor; /* page fill factor in percent (0..100) */ - AutoVacOpts autovacuum; /* autovacuum-related options */ + AutoVacOpts autovacuum; /* autovacuum-related options */ } StdRdOptions; #define HEAP_MIN_FILLFACTOR 10 diff --git a/src/include/utils/selfuncs.h b/src/include/utils/selfuncs.h index f9e63d1f62..534fd8ec61 100644 --- a/src/include/utils/selfuncs.h +++ b/src/include/utils/selfuncs.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/selfuncs.h,v 1.48 2009/01/01 17:24:02 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/selfuncs.h,v 1.49 2009/06/11 14:49:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -100,14 +100,14 @@ typedef enum /* Hooks for plugins to get control when we ask for stats */ typedef bool (*get_relation_stats_hook_type) (PlannerInfo *root, - RangeTblEntry *rte, - AttrNumber attnum, - VariableStatData *vardata); + RangeTblEntry *rte, + AttrNumber attnum, + VariableStatData *vardata); extern PGDLLIMPORT get_relation_stats_hook_type get_relation_stats_hook; typedef bool (*get_index_stats_hook_type) (PlannerInfo *root, - Oid indexOid, - AttrNumber indexattnum, - VariableStatData *vardata); + Oid indexOid, + AttrNumber indexattnum, + VariableStatData *vardata); extern PGDLLIMPORT get_index_stats_hook_type get_index_stats_hook; extern void examine_variable(PlannerInfo *root, Node *node, int varRelid, diff --git a/src/include/utils/snapmgr.h b/src/include/utils/snapmgr.h index e4d57079ab..979a52c622 100644 --- a/src/include/utils/snapmgr.h +++ b/src/include/utils/snapmgr.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/snapmgr.h,v 1.4 2009/01/01 17:24:02 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/snapmgr.h,v 1.5 2009/06/11 14:49:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -43,4 +43,4 @@ extern void AtSubAbort_Snapshot(int level); extern void AtEarlyCommit_Snapshot(void); extern void AtEOXact_Snapshot(bool isCommit); -#endif /* SNAPMGR_H */ +#endif /* SNAPMGR_H */ diff --git a/src/include/utils/snapshot.h b/src/include/utils/snapshot.h index 4b16b2c241..e5003b669a 100644 --- a/src/include/utils/snapshot.h +++ b/src/include/utils/snapshot.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/snapshot.h,v 1.4 2009/01/01 17:24:02 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/snapshot.h,v 1.5 2009/06/11 14:49:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -28,7 +28,7 @@ typedef struct SnapshotData *Snapshot; * function. */ typedef bool (*SnapshotSatisfiesFunc) (HeapTupleHeader tuple, - Snapshot snapshot, Buffer buffer); + Snapshot snapshot, Buffer buffer); typedef struct SnapshotData { @@ -75,4 +75,4 @@ typedef enum HeapTupleBeingUpdated } HTSU_Result; -#endif /* SNAPSHOT_H */ +#endif /* SNAPSHOT_H */ diff --git a/src/include/utils/timestamp.h b/src/include/utils/timestamp.h index 844a6f583b..291de5cdea 100644 --- a/src/include/utils/timestamp.h +++ b/src/include/utils/timestamp.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/timestamp.h,v 1.79 2009/01/01 17:24:02 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/timestamp.h,v 1.80 2009/06/11 14:49:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -47,14 +47,12 @@ typedef int64 Timestamp; typedef int64 TimestampTz; typedef int64 TimeOffset; typedef int32 fsec_t; /* fractional seconds (in microseconds) */ - #else typedef double Timestamp; typedef double TimestampTz; typedef double TimeOffset; typedef double fsec_t; /* fractional seconds (in seconds) */ - #endif typedef struct @@ -127,8 +125,7 @@ typedef struct #define DT_NOBEGIN (-INT64CONST(0x7fffffffffffffff) - 1) #define DT_NOEND (INT64CONST(0x7fffffffffffffff)) - -#else /* !HAVE_INT64_TIMESTAMP */ +#else /* !HAVE_INT64_TIMESTAMP */ #define DatumGetTimestamp(X) ((Timestamp) DatumGetFloat8(X)) #define DatumGetTimestampTz(X) ((TimestampTz) DatumGetFloat8(X)) @@ -153,7 +150,6 @@ typedef struct #define DT_NOBEGIN (-DBL_MAX) #define DT_NOEND (DBL_MAX) #endif - #endif /* HAVE_INT64_TIMESTAMP */ @@ -195,6 +191,7 @@ typedef struct /* Set at postmaster start */ extern TimestampTz PgStartTime; + /* Set at configuration reload */ extern TimestampTz PgReloadTime; diff --git a/src/include/utils/tuplesort.h b/src/include/utils/tuplesort.h index 9530ce078c..e351536d47 100644 --- a/src/include/utils/tuplesort.h +++ b/src/include/utils/tuplesort.h @@ -13,7 +13,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/tuplesort.h,v 1.32 2009/01/01 17:24:02 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/tuplesort.h,v 1.33 2009/06/11 14:49:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -59,8 +59,8 @@ extern Tuplesortstate *tuplesort_begin_index_btree(Relation indexRel, bool enforceUnique, int workMem, bool randomAccess); extern Tuplesortstate *tuplesort_begin_index_hash(Relation indexRel, - uint32 hash_mask, - int workMem, bool randomAccess); + uint32 hash_mask, + int workMem, bool randomAccess); extern Tuplesortstate *tuplesort_begin_datum(Oid datumType, Oid sortOperator, bool nullsFirstFlag, int workMem, bool randomAccess); diff --git a/src/include/utils/tuplestore.h b/src/include/utils/tuplestore.h index 2883ae75a4..b1a5e5ce26 100644 --- a/src/include/utils/tuplestore.h +++ b/src/include/utils/tuplestore.h @@ -24,7 +24,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/tuplestore.h,v 1.29 2009/03/27 18:30:21 tgl Exp $ + * $PostgreSQL: pgsql/src/include/utils/tuplestore.h,v 1.30 2009/06/11 14:49:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -54,7 +54,7 @@ extern void tuplestore_puttupleslot(Tuplestorestate *state, TupleTableSlot *slot); extern void tuplestore_puttuple(Tuplestorestate *state, HeapTuple tuple); extern void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, - Datum *values, bool *isnull); + Datum *values, bool *isnull); /* tuplestore_donestoring() used to be required, but is no longer used */ #define tuplestore_donestoring(state) ((void) 0) @@ -64,7 +64,7 @@ extern int tuplestore_alloc_read_pointer(Tuplestorestate *state, int eflags); extern void tuplestore_select_read_pointer(Tuplestorestate *state, int ptr); extern void tuplestore_copy_read_pointer(Tuplestorestate *state, - int srcptr, int destptr); + int srcptr, int destptr); extern void tuplestore_trim(Tuplestorestate *state); diff --git a/src/include/utils/xml.h b/src/include/utils/xml.h index af953f2b35..b7d631c031 100644 --- a/src/include/utils/xml.h +++ b/src/include/utils/xml.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/xml.h,v 1.27 2009/06/09 22:00:57 petere Exp $ + * $PostgreSQL: pgsql/src/include/utils/xml.h,v 1.28 2009/06/11 14:49:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -81,8 +81,8 @@ typedef enum XMLBINARY_HEX } XmlBinaryType; -extern int xmlbinary; /* XmlBinaryType, but int for guc enum */ +extern int xmlbinary; /* XmlBinaryType, but int for guc enum */ -extern int xmloption; /* XmlOptionType, but int for guc enum */ +extern int xmloption; /* XmlOptionType, but int for guc enum */ #endif /* XML_H */ diff --git a/src/include/windowapi.h b/src/include/windowapi.h index 8cc90bff8b..54a9ac336d 100644 --- a/src/include/windowapi.h +++ b/src/include/windowapi.h @@ -21,7 +21,7 @@ * * Portions Copyright (c) 2000-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/include/windowapi.h,v 1.2 2009/01/01 17:23:55 momjian Exp $ + * $PostgreSQL: pgsql/src/include/windowapi.h,v 1.3 2009/06/11 14:49:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -51,14 +51,14 @@ extern void WinSetMarkPosition(WindowObject winobj, int64 markpos); extern bool WinRowsArePeers(WindowObject winobj, int64 pos1, int64 pos2); extern Datum WinGetFuncArgInPartition(WindowObject winobj, int argno, - int relpos, int seektype, bool set_mark, - bool *isnull, bool *isout); + int relpos, int seektype, bool set_mark, + bool *isnull, bool *isout); extern Datum WinGetFuncArgInFrame(WindowObject winobj, int argno, - int relpos, int seektype, bool set_mark, - bool *isnull, bool *isout); + int relpos, int seektype, bool set_mark, + bool *isnull, bool *isout); extern Datum WinGetFuncArgCurrent(WindowObject winobj, int argno, - bool *isnull); + bool *isnull); #endif /* WINDOWAPI_H */ diff --git a/src/interfaces/ecpg/compatlib/informix.c b/src/interfaces/ecpg/compatlib/informix.c index 9940c4195b..1118d588dc 100644 --- a/src/interfaces/ecpg/compatlib/informix.c +++ b/src/interfaces/ecpg/compatlib/informix.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.58 2009/05/20 16:49:23 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.59 2009/06/11 14:49:13 momjian Exp $ */ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" @@ -151,7 +151,7 @@ static char * ecpg_strndup(const char *str, size_t len) { int real_len = strlen(str); - int use_len = (real_len > len) ? (int)len : real_len; + int use_len = (real_len > len) ? (int) len : real_len; char *new = malloc(use_len + 1); diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c index d73199971e..425da775a0 100644 --- a/src/interfaces/ecpg/ecpglib/connect.c +++ b/src/interfaces/ecpg/ecpglib/connect.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.53 2009/01/15 11:52:55 petere Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.54 2009/06/11 14:49:13 momjian Exp $ */ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" @@ -270,7 +270,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p struct sqlca_t *sqlca = ECPGget_sqlca(); enum COMPAT_MODE compat = c; struct connection *this; - int i; + int i; char *dbname = name ? ecpg_strdup(name, lineno) : NULL, *host = NULL, *tmp, @@ -477,29 +477,31 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p options ? "with options " : "", options ? options : "", user ? "for user " : "", user ? user : ""); - connect_string = ecpg_alloc( strlen_or_null(host) - + strlen_or_null(port) - + strlen_or_null(options) - + strlen_or_null(realname) - + strlen_or_null(user) - + strlen_or_null(passwd) - + sizeof(" host = port = dbname = user = password ="), lineno); + connect_string = ecpg_alloc(strlen_or_null(host) + + strlen_or_null(port) + + strlen_or_null(options) + + strlen_or_null(realname) + + strlen_or_null(user) + + strlen_or_null(passwd) + + sizeof(" host = port = dbname = user = password ="), lineno); - if (options) /* replace '&' if tehre are any */ + if (options) /* replace '&' if tehre are any */ for (i = 0; options[i]; i++) if (options[i] == '&') options[i] = ' '; - sprintf(connect_string,"%s%s %s%s %s%s %s%s %s%s %s", - realname ? "dbname=" : "", realname ? realname : "", - host ? "host=" : "", host ? host : "", - port ? "port=" : "", port ? port : "", - user ? "user=" : "", user ? user : "", - passwd ? "password=" : "", passwd ? passwd : "", - options ? options : ""); - - /* this is deprecated - * this->connection = PQsetdbLogin(host, port, options, NULL, realname, user, passwd);*/ + sprintf(connect_string, "%s%s %s%s %s%s %s%s %s%s %s", + realname ? "dbname=" : "", realname ? realname : "", + host ? "host=" : "", host ? host : "", + port ? "port=" : "", port ? port : "", + user ? "user=" : "", user ? user : "", + passwd ? "password=" : "", passwd ? passwd : "", + options ? options : ""); + + /* + * this is deprecated this->connection = PQsetdbLogin(host, port, options, + * NULL, realname, user, passwd); + */ this->connection = PQconnectdb(connect_string); ecpg_free(connect_string); @@ -589,12 +591,14 @@ ECPGdisconnect(int lineno, const char *connection_name) return true; } -PGconn* ECPGget_PGconn(const char *connection_name) +PGconn * +ECPGget_PGconn(const char *connection_name) { - struct connection * con; + struct connection *con; - con=ecpg_get_connection(connection_name); - if (con==NULL) return NULL; + con = ecpg_get_connection(connection_name); + if (con == NULL) + return NULL; return con->connection; } diff --git a/src/interfaces/ecpg/ecpglib/descriptor.c b/src/interfaces/ecpg/ecpglib/descriptor.c index 0331d12c8d..1a0640663a 100644 --- a/src/interfaces/ecpg/ecpglib/descriptor.c +++ b/src/interfaces/ecpg/ecpglib/descriptor.c @@ -1,6 +1,6 @@ /* dynamic SQL support routines * - * $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.31 2009/01/15 11:52:55 petere Exp $ + * $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.32 2009/06/11 14:49:13 momjian Exp $ */ #define POSTGRES_ECPG_INTERNAL @@ -529,7 +529,7 @@ ECPGset_desc(int lineno, const char *desc_name, int index,...) for (;;) { enum ECPGdtype itemtype; - char *tobeinserted = NULL; + char *tobeinserted = NULL; itemtype = va_arg(args, enum ECPGdtype); diff --git a/src/interfaces/ecpg/ecpglib/error.c b/src/interfaces/ecpg/ecpglib/error.c index e2c37d7687..8affc5ca67 100644 --- a/src/interfaces/ecpg/ecpglib/error.c +++ b/src/interfaces/ecpg/ecpglib/error.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/error.c,v 1.22 2009/01/16 09:15:03 petere Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/error.c,v 1.23 2009/06/11 14:49:13 momjian Exp $ */ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" @@ -21,183 +21,261 @@ ecpg_raise(int line, int code, const char *sqlstate, const char *str) { case ECPG_NOT_FOUND: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ ecpg_gettext("no data found on line %d"), line); break; case ECPG_OUT_OF_MEMORY: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ ecpg_gettext("out of memory on line %d"), line); break; case ECPG_UNSUPPORTED: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ - ecpg_gettext("unsupported type \"%s\" on line %d"), str, line); + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ + ecpg_gettext("unsupported type \"%s\" on line %d"), str, line); break; case ECPG_TOO_MANY_ARGUMENTS: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ ecpg_gettext("too many arguments on line %d"), line); break; case ECPG_TOO_FEW_ARGUMENTS: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ ecpg_gettext("too few arguments on line %d"), line); break; case ECPG_INT_FORMAT: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ ecpg_gettext("invalid input syntax for type int: \"%s\", on line %d"), str, line); break; case ECPG_UINT_FORMAT: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ ecpg_gettext("invalid input syntax for type unsigned int: \"%s\", on line %d"), str, line); break; case ECPG_FLOAT_FORMAT: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ ecpg_gettext("invalid input syntax for floating-point type: \"%s\", on line %d"), str, line); break; case ECPG_CONVERT_BOOL: if (str) snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ ecpg_gettext("invalid syntax for type boolean: \"%s\", on line %d"), str, line); else snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ ecpg_gettext("could not convert boolean value: size mismatch, on line %d"), line); break; case ECPG_EMPTY: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ ecpg_gettext("empty query on line %d"), line); break; case ECPG_MISSING_INDICATOR: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ - ecpg_gettext("null value without indicator on line %d"), line); + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ + ecpg_gettext("null value without indicator on line %d"), line); break; case ECPG_NO_ARRAY: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ ecpg_gettext("variable does not have an array type on line %d"), line); break; case ECPG_DATA_NOT_ARRAY: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ ecpg_gettext("data read from server is not an array on line %d"), line); break; case ECPG_ARRAY_INSERT: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ - ecpg_gettext("inserting an array of variables is not supported on line %d"), line); + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ + ecpg_gettext("inserting an array of variables is not supported on line %d"), line); break; case ECPG_NO_CONN: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ - ecpg_gettext("connection \"%s\" does not exist on line %d"), str, line); + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ + ecpg_gettext("connection \"%s\" does not exist on line %d"), str, line); break; case ECPG_NOT_CONN: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ - ecpg_gettext("not connected to connection \"%s\" on line %d"), str, line); + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ + ecpg_gettext("not connected to connection \"%s\" on line %d"), str, line); break; case ECPG_INVALID_STMT: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ - ecpg_gettext("invalid statement name \"%s\" on line %d"), str, line); + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ + ecpg_gettext("invalid statement name \"%s\" on line %d"), str, line); break; case ECPG_UNKNOWN_DESCRIPTOR: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ - ecpg_gettext("descriptor \"%s\" not found on line %d"), str, line); + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ + ecpg_gettext("descriptor \"%s\" not found on line %d"), str, line); break; case ECPG_INVALID_DESCRIPTOR_INDEX: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ - ecpg_gettext("descriptor index out of range on line %d"), line); + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ + ecpg_gettext("descriptor index out of range on line %d"), line); break; case ECPG_UNKNOWN_DESCRIPTOR_ITEM: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ - ecpg_gettext("unrecognized descriptor item \"%s\" on line %d"), str, line); + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ + ecpg_gettext("unrecognized descriptor item \"%s\" on line %d"), str, line); break; case ECPG_VAR_NOT_NUMERIC: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ - ecpg_gettext("variable does not have a numeric type on line %d"), line); + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ + ecpg_gettext("variable does not have a numeric type on line %d"), line); break; case ECPG_VAR_NOT_CHAR: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ - ecpg_gettext("variable does not have a character type on line %d"), line); + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ + ecpg_gettext("variable does not have a character type on line %d"), line); break; case ECPG_TRANS: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ - ecpg_gettext("error in transaction processing on line %d"), line); + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ + ecpg_gettext("error in transaction processing on line %d"), line); break; case ECPG_CONNECT: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ - ecpg_gettext("could not connect to database \"%s\" on line %d"), str, line); + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ + ecpg_gettext("could not connect to database \"%s\" on line %d"), str, line); break; default: snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), - /* translator: this string will be truncated at 149 - characters expanded. */ - ecpg_gettext("SQL error %d on line %d"), code, line); + + /* + * translator: this string will be truncated at 149 characters + * expanded. + */ + ecpg_gettext("SQL error %d on line %d"), code, line); break; } diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c index 80fa2f5505..96aa96c464 100644 --- a/src/interfaces/ecpg/ecpglib/execute.c +++ b/src/interfaces/ecpg/ecpglib/execute.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.84 2009/05/20 16:49:23 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.85 2009/06/11 14:49:13 momjian Exp $ */ /* * The aim is to get a simpler inteface to the database routines. @@ -128,9 +128,9 @@ next_insert(char *text, int pos, bool questionmarks) int i; for (i = p + 1; isdigit((unsigned char) text[i]); i++) - /* empty loop body */ ; + /* empty loop body */ ; if (!isalpha((unsigned char) text[i]) && - isascii((unsigned char) text[i]) && text[i] != '_') + isascii((unsigned char) text[i]) &&text[i] != '_') /* not dollar delimited quote */ return p; } @@ -353,7 +353,7 @@ ecpg_store_result(const PGresult *results, int act_field, { int len = 0; - if (!PQfformat(results, act_field)) + if (!PQfformat(results, act_field)) { switch (var->type) { @@ -364,7 +364,7 @@ ecpg_store_result(const PGresult *results, int act_field, /* special mode for handling char**foo=0 */ for (act_tuple = 0; act_tuple < ntuples; act_tuple++) len += strlen(PQgetvalue(results, act_tuple, act_field)) + 1; - len *= var->offset; /* should be 1, but YMNK */ + len *= var->offset; /* should be 1, but YMNK */ len += (ntuples + 1) * sizeof(char *); } else @@ -759,7 +759,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari case ECPGt_unsigned_char: { /* set slen to string length if type is char * */ - int slen = (var->varcharsize == 0) ? strlen((char *) var->value) : (unsigned int)var->varcharsize; + int slen = (var->varcharsize == 0) ? strlen((char *) var->value) : (unsigned int) var->varcharsize; if (!(newcopy = ecpg_alloc(slen + 1, lineno))) return false; @@ -1061,7 +1061,7 @@ free_params(const char **paramValues, int nParams, bool print, int lineno) static bool insert_tobeinserted(int position, int ph_len, struct statement * stmt, char *tobeinserted) { - char *newcopy; + char *newcopy; if (!(newcopy = (char *) ecpg_alloc(strlen(stmt->command) + strlen(tobeinserted) @@ -1075,8 +1075,8 @@ insert_tobeinserted(int position, int ph_len, struct statement * stmt, char *tob strcpy(newcopy + position - 1, tobeinserted); /* - * The strange thing in the second argument is the rest of the - * string from the old string + * The strange thing in the second argument is the rest of the string from + * the old string */ strcat(newcopy, stmt->command @@ -1113,7 +1113,7 @@ ecpg_execute(struct statement * stmt) var = stmt->inlist; while (var) { - char *tobeinserted; + char *tobeinserted; int counter = 1; tobeinserted = NULL; @@ -1183,24 +1183,24 @@ ecpg_execute(struct statement * stmt) if ((position = next_insert(stmt->command, position, stmt->questionmarks) + 1) == 0) { /* - * We have an argument but we dont have the matched up - * placeholder in the string + * We have an argument but we dont have the matched up placeholder + * in the string */ ecpg_raise(stmt->lineno, ECPG_TOO_MANY_ARGUMENTS, - ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS, + ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS, NULL); free_params(paramValues, nParams, false, stmt->lineno); return false; } - /* + /* * if var->type=ECPGt_char_variable we have a dynamic cursor we have * to simulate a dynamic cursor because there is no backend * functionality for it */ if (var->type == ECPGt_char_variable) { - int ph_len = (stmt->command[position] == '?') ? strlen("?") : strlen("$1"); + int ph_len = (stmt->command[position] == '?') ? strlen("?") : strlen("$1"); if (!insert_tobeinserted(position, ph_len, stmt, tobeinserted)) { @@ -1209,11 +1209,13 @@ ecpg_execute(struct statement * stmt) } tobeinserted = NULL; } + /* * if the placeholder is '$0' we have to replace it on the client side - * this is for places we want to support variables at that are not supported in the backend + * this is for places we want to support variables at that are not + * supported in the backend */ - else if (stmt->command[position] == '0' ) + else if (stmt->command[position] == '0') { if (!insert_tobeinserted(position, 2, stmt, tobeinserted)) { @@ -1345,7 +1347,7 @@ ecpg_execute(struct statement * stmt) desc->result = results; clear_result = false; ecpg_log("ecpg_execute on line %d: putting result (%d tuples) into descriptor %s\n", - stmt->lineno, PQntuples(results), (const char *) var->pointer); + stmt->lineno, PQntuples(results), (const char *) var->pointer); } var = var->next; } diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c index 47c343f7d4..d7a80d5f25 100644 --- a/src/interfaces/ecpg/ecpglib/misc.c +++ b/src/interfaces/ecpg/ecpglib/misc.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.48 2009/01/15 11:52:55 petere Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.49 2009/06/11 14:49:13 momjian Exp $ */ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" @@ -241,10 +241,10 @@ void ecpg_log(const char *format,...) { va_list ap; - struct sqlca_t *sqlca = ECPGget_sqlca(); + struct sqlca_t *sqlca = ECPGget_sqlca(); const char *intl_format; int bufsize; - char *fmt; + char *fmt; if (!simple_debug) return; @@ -253,8 +253,8 @@ ecpg_log(const char *format,...) intl_format = ecpg_gettext(format); /* - * Insert PID into the format, unless ecpg_internal_regression_mode is - * set (regression tests want unchanging output). + * Insert PID into the format, unless ecpg_internal_regression_mode is set + * (regression tests want unchanging output). */ bufsize = strlen(intl_format) + 100; fmt = (char *) malloc(bufsize); @@ -426,11 +426,11 @@ win32_pthread_mutex(volatile pthread_mutex_t *mutex) { if (mutex->handle == NULL) { - while (InterlockedExchange((LONG *) & mutex->initlock, 1) == 1) + while (InterlockedExchange((LONG *) &mutex->initlock, 1) == 1) Sleep(0); if (mutex->handle == NULL) mutex->handle = CreateMutex(NULL, FALSE, NULL); - InterlockedExchange((LONG *) & mutex->initlock, 0); + InterlockedExchange((LONG *) &mutex->initlock, 0); } } @@ -451,7 +451,6 @@ win32_pthread_once(volatile pthread_once_t *once, void (*fn) (void)) } } #endif /* ENABLE_THREAD_SAFETY */ - #endif /* WIN32 */ #ifdef ENABLE_NLS diff --git a/src/interfaces/ecpg/ecpglib/prepare.c b/src/interfaces/ecpg/ecpglib/prepare.c index 637d77b206..70d150ee39 100644 --- a/src/interfaces/ecpg/ecpglib/prepare.c +++ b/src/interfaces/ecpg/ecpglib/prepare.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.30 2009/05/20 16:13:18 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.31 2009/06/11 14:49:13 momjian Exp $ */ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" @@ -382,7 +382,8 @@ ecpg_freeStmtCacheEntry(int lineno, int compat, int entNo) /* entry # to free * { stmtCacheEntry *entry; struct connection *con; - struct prepared_statement *this, *prev; + struct prepared_statement *this, + *prev; entry = &stmtCacheEntries[entNo]; if (!entry->stmtID[0]) /* return if the entry isn't in use */ @@ -390,7 +391,7 @@ ecpg_freeStmtCacheEntry(int lineno, int compat, int entNo) /* entry # to free * con = ecpg_get_connection(entry->connection); - /* free the 'prepared_statement' list entry */ + /* free the 'prepared_statement' list entry */ this = find_prepared_statement(entry->stmtID, con, &prev); if (this && !deallocate_one(lineno, compat, con, prev, this)) return (-1); @@ -415,7 +416,7 @@ static int AddStmtToCache(int lineno, /* line # of statement */ char *stmtID, /* statement ID */ const char *connection, /* connection */ - int compat, /* compatibility level */ + int compat, /* compatibility level */ const char *ecpgQuery) /* query */ { int ix, diff --git a/src/interfaces/ecpg/include/datetime.h b/src/interfaces/ecpg/include/datetime.h index acdcf23ed4..a2f1b0d11c 100644 --- a/src/interfaces/ecpg/include/datetime.h +++ b/src/interfaces/ecpg/include/datetime.h @@ -1,13 +1,14 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/datetime.h,v 1.16 2008/02/17 18:14:29 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/datetime.h,v 1.17 2009/06/11 14:49:13 momjian Exp $ */ #ifndef _ECPG_DATETIME_H #define _ECPG_DATETIME_H #include <ecpg_informix.h> -#ifndef _ECPGLIB_H /* source created by ecpg which defines these symbols */ +#ifndef _ECPGLIB_H /* source created by ecpg which defines these + * symbols */ typedef timestamp dtime_t; typedef interval intrvl_t; -#endif /* ndef _ECPGLIB_H */ +#endif /* ndef _ECPGLIB_H */ #endif /* ndef _ECPG_DATETIME_H */ diff --git a/src/interfaces/ecpg/include/decimal.h b/src/interfaces/ecpg/include/decimal.h index b3f5ca3d07..5b923a0084 100644 --- a/src/interfaces/ecpg/include/decimal.h +++ b/src/interfaces/ecpg/include/decimal.h @@ -1,12 +1,13 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/decimal.h,v 1.18 2008/02/17 18:14:29 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/decimal.h,v 1.19 2009/06/11 14:49:13 momjian Exp $ */ #ifndef _ECPG_DECIMAL_H #define _ECPG_DECIMAL_H #include <ecpg_informix.h> -#ifndef _ECPGLIB_H /* source created by ecpg which defines this symbol */ -typedef decimal dec_t; -#endif /* ndef _ECPGLIB_H */ +#ifndef _ECPGLIB_H /* source created by ecpg which defines this + * symbol */ +typedef decimal dec_t; +#endif /* ndef _ECPGLIB_H */ #endif /* ndef _ECPG_DECIMAL_H */ diff --git a/src/interfaces/ecpg/include/ecpglib.h b/src/interfaces/ecpg/include/ecpglib.h index 5830df8bdc..eb7c5f8637 100644 --- a/src/interfaces/ecpg/include/ecpglib.h +++ b/src/interfaces/ecpg/include/ecpglib.h @@ -1,7 +1,7 @@ /* * this is a small part of c.h since we don't want to leak all postgres * definitions into ecpg programs - * $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpglib.h,v 1.78 2009/05/20 16:13:18 meskes Exp $ + * $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpglib.h,v 1.79 2009/06/11 14:49:13 momjian Exp $ */ #ifndef _ECPGLIB_H @@ -17,7 +17,7 @@ extern char * ecpg_gettext(const char *msgid) __attribute__((format_arg(1))); #else -#define ecpg_gettext(x) (x) +#define ecpg_gettext(x) (x) #endif #ifndef __cplusplus @@ -57,11 +57,11 @@ bool ECPGdisconnect(int, const char *); bool ECPGprepare(int, const char *, const bool, const char *, const char *); bool ECPGdeallocate(int, int, const char *, const char *); bool ECPGdeallocate_all(int, int, const char *); -char *ECPGprepared_statement(const char *, const char *, int); -PGconn *ECPGget_PGconn(const char *); +char *ECPGprepared_statement(const char *, const char *, int); +PGconn *ECPGget_PGconn(const char *); -char *ECPGerrmsg(void); +char *ECPGerrmsg(void); /* print an error message */ void sqlprint(void); @@ -69,7 +69,7 @@ void sqlprint(void); /* define this for simplicity as well as compatibility */ #define SQLCODE sqlca.sqlcode -#define SQLSTATE sqlca.sqlstate +#define SQLSTATE sqlca.sqlstate /* dynamic SQL */ @@ -77,13 +77,13 @@ bool ECPGdo_descriptor(int, const char *, const char *, const char *); bool ECPGdeallocate_desc(int, const char *); bool ECPGallocate_desc(int, const char *); bool ECPGget_desc_header(int, const char *, int *); -bool ECPGget_desc(int, const char *, int, ...); +bool ECPGget_desc(int, const char *, int,...); bool ECPGset_desc_header(int, const char *, int); -bool ECPGset_desc(int, const char *, int, ...); +bool ECPGset_desc(int, const char *, int,...); void ECPGset_noind_null(enum ECPGttype, void *); bool ECPGis_noind_null(enum ECPGttype, void *); -bool ECPGdescribe(int, bool, const char *, ...); +bool ECPGdescribe(int, bool, const char *,...); /* dynamic result allocation */ void ECPGfree_auto_mem(void); diff --git a/src/interfaces/ecpg/include/sqlda.h b/src/interfaces/ecpg/include/sqlda.h index 314b161b56..75e2ff8553 100644 --- a/src/interfaces/ecpg/include/sqlda.h +++ b/src/interfaces/ecpg/include/sqlda.h @@ -1,4 +1,3 @@ /* - * $PostgreSQL: pgsql/src/interfaces/ecpg/include/sqlda.h,v 1.3 2008/05/17 01:28:25 adunstan Exp $ + * $PostgreSQL: pgsql/src/interfaces/ecpg/include/sqlda.h,v 1.4 2009/06/11 14:49:13 momjian Exp $ */ - diff --git a/src/interfaces/ecpg/include/sqltypes.h b/src/interfaces/ecpg/include/sqltypes.h index dc4738da85..ff693a494f 100644 --- a/src/interfaces/ecpg/include/sqltypes.h +++ b/src/interfaces/ecpg/include/sqltypes.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/interfaces/ecpg/include/sqltypes.h,v 1.8 2008/05/17 01:28:25 adunstan Exp $ + * $PostgreSQL: pgsql/src/interfaces/ecpg/include/sqltypes.h,v 1.9 2009/06/11 14:49:13 momjian Exp $ */ #ifndef ECPG_SQLTYPES_H #define ECPG_SQLTYPES_H diff --git a/src/interfaces/ecpg/pgtypeslib/datetime.c b/src/interfaces/ecpg/pgtypeslib/datetime.c index 364aa0055c..08efe98446 100644 --- a/src/interfaces/ecpg/pgtypeslib/datetime.c +++ b/src/interfaces/ecpg/pgtypeslib/datetime.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/datetime.c,v 1.37 2009/05/20 16:49:23 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/datetime.c,v 1.38 2009/06/11 14:49:13 momjian Exp $ */ #include "postgres_fe.h" @@ -347,7 +347,7 @@ PGTYPESdate_defmt_asc(date * d, char *fmt, char *str) char *fmt_ystart, *fmt_mstart, *fmt_dstart; - unsigned int i; + unsigned int i; int reading_digit; int token_count; char *str_copy; diff --git a/src/interfaces/ecpg/pgtypeslib/dt.h b/src/interfaces/ecpg/pgtypeslib/dt.h index 388c67253e..764529d3a7 100644 --- a/src/interfaces/ecpg/pgtypeslib/dt.h +++ b/src/interfaces/ecpg/pgtypeslib/dt.h @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt.h,v 1.43 2009/05/26 01:39:49 tgl Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt.h,v 1.44 2009/06/11 14:49:13 momjian Exp $ */ #ifndef DT_H #define DT_H @@ -25,10 +25,10 @@ typedef double fsec_t; #define USE_SQL_DATES 2 #define USE_GERMAN_DATES 3 -#define INTSTYLE_POSTGRES 0 -#define INTSTYLE_POSTGRES_VERBOSE 1 -#define INTSTYLE_SQL_STANDARD 2 -#define INTSTYLE_ISO_8601 3 +#define INTSTYLE_POSTGRES 0 +#define INTSTYLE_POSTGRES_VERBOSE 1 +#define INTSTYLE_SQL_STANDARD 2 +#define INTSTYLE_ISO_8601 3 #define INTERVAL_FULL_RANGE (0x7FFF) #define INTERVAL_MASK(b) (1 << (b)) @@ -188,7 +188,7 @@ typedef double fsec_t; */ /* Copy&pasted these values from src/include/utils/datetime.h */ #define DTK_M(t) (0x01 << (t)) -#define DTK_ALL_SECS_M (DTK_M(SECOND) | DTK_M(MILLISECOND) | DTK_M(MICROSECOND)) +#define DTK_ALL_SECS_M (DTK_M(SECOND) | DTK_M(MILLISECOND) | DTK_M(MICROSECOND)) #define DTK_DATE_M (DTK_M(YEAR) | DTK_M(MONTH) | DTK_M(DAY)) #define DTK_TIME_M (DTK_M(HOUR) | DTK_M(MINUTE) | DTK_M(SECOND)) @@ -340,7 +340,7 @@ int tm2timestamp(struct tm *, fsec_t, int *, timestamp *); int DecodeUnits(int field, char *lowtoken, int *val); bool CheckDateTokenTables(void); int EncodeDateOnly(struct tm *, int, char *, bool); -int GetEpochTime(struct tm *); +int GetEpochTime(struct tm *); int ParseDateTime(char *, char *, char **, int *, int *, char **); int DecodeDateTime(char **, int *, int, int *, struct tm *, fsec_t *, bool); void j2date(int, int *, int *, int *); diff --git a/src/interfaces/ecpg/pgtypeslib/dt_common.c b/src/interfaces/ecpg/pgtypeslib/dt_common.c index e706fa6a49..9fb6357dda 100644 --- a/src/interfaces/ecpg/pgtypeslib/dt_common.c +++ b/src/interfaces/ecpg/pgtypeslib/dt_common.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt_common.c,v 1.50 2009/05/20 16:49:23 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt_common.c,v 1.51 2009/06/11 14:49:13 momjian Exp $ */ #include "postgres_fe.h" @@ -1132,7 +1132,7 @@ dt2time(double jd, int *hour, int *min, int *sec, fsec_t *fsec) */ static int DecodeNumberField(int len, char *str, int fmask, - int *tmask, struct tm * tm, fsec_t *fsec, int *is2digits) + int *tmask, struct tm * tm, fsec_t *fsec, int *is2digits) { char *cp; @@ -1640,7 +1640,7 @@ DecodePosixTimezone(char *str, int *tzp) */ int ParseDateTime(char *timestr, char *lowstr, - char **field, int *ftype, int *numfields, char **endstr) + char **field, int *ftype, int *numfields, char **endstr) { int nf = 0; char *lp = lowstr; @@ -1928,7 +1928,7 @@ DecodeDateTime(char **field, int *ftype, int nf, * time */ if ((ftype[i] = DecodeNumberField(strlen(field[i]), field[i], fmask, - &tmask, tm, fsec, &is2digits)) < 0) + &tmask, tm, fsec, &is2digits)) < 0) return -1; /* @@ -2116,7 +2116,7 @@ DecodeDateTime(char **field, int *ftype, int nf, case DTK_TIME: /* previous field was "t" for ISO time */ if ((ftype[i] = DecodeNumberField(strlen(field[i]), field[i], (fmask | DTK_DATE_M), - &tmask, tm, fsec, &is2digits)) < 0) + &tmask, tm, fsec, &is2digits)) < 0) return -1; if (tmask != DTK_TIME_M) @@ -2154,13 +2154,13 @@ DecodeDateTime(char **field, int *ftype, int nf, * Example: 20011223 or 040506 */ if ((ftype[i] = DecodeNumberField(flen, field[i], fmask, - &tmask, tm, fsec, &is2digits)) < 0) + &tmask, tm, fsec, &is2digits)) < 0) return -1; } else if (flen > 4) { if ((ftype[i] = DecodeNumberField(flen, field[i], fmask, - &tmask, tm, fsec, &is2digits)) < 0) + &tmask, tm, fsec, &is2digits)) < 0) return -1; } /* otherwise it is a single date/time field... */ @@ -2580,10 +2580,10 @@ PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp * d, int scan_type; char *pstr, - *pfmt, - *tmp; - int err = 1; - unsigned int j; + *pfmt, + *tmp; + int err = 1; + unsigned int j; struct tm tm; pfmt = fmt; diff --git a/src/interfaces/ecpg/pgtypeslib/interval.c b/src/interfaces/ecpg/pgtypeslib/interval.c index 2ab84a38e0..47470233f8 100644 --- a/src/interfaces/ecpg/pgtypeslib/interval.c +++ b/src/interfaces/ecpg/pgtypeslib/interval.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/interval.c,v 1.40 2009/05/20 16:13:18 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/interval.c,v 1.41 2009/06/11 14:49:13 momjian Exp $ */ #include "postgres_fe.h" #include <time.h> @@ -18,7 +18,7 @@ static int strtoi(const char *nptr, char **endptr, int base) { - long val; + long val; val = strtol(nptr, endptr, base); #ifdef HAVE_LONG_INT_64 @@ -28,42 +28,42 @@ strtoi(const char *nptr, char **endptr, int base) return (int) val; } -/* copy&pasted from .../src/backend/utils/adt/datetime.c +/* copy&pasted from .../src/backend/utils/adt/datetime.c * and changesd struct pg_tm to struct tm */ static void -AdjustFractSeconds(double frac, struct /*pg_*/tm * tm, fsec_t *fsec, int scale) +AdjustFractSeconds(double frac, struct /* pg_ */ tm * tm, fsec_t *fsec, int scale) { - int sec; + int sec; if (frac == 0) return; - frac *= scale; - sec = (int) frac; + frac *= scale; + sec = (int) frac; tm->tm_sec += sec; - frac -= sec; + frac -= sec; #ifdef HAVE_INT64_TIMESTAMP - *fsec += rint(frac * 1000000); + *fsec += rint(frac * 1000000); #else - *fsec += frac; + *fsec += frac; #endif } -/* copy&pasted from .../src/backend/utils/adt/datetime.c +/* copy&pasted from .../src/backend/utils/adt/datetime.c * and changesd struct pg_tm to struct tm */ static void -AdjustFractDays(double frac, struct /*pg_*/tm * tm, fsec_t *fsec, int scale) +AdjustFractDays(double frac, struct /* pg_ */ tm * tm, fsec_t *fsec, int scale) { - int extra_days; + int extra_days; if (frac == 0) return; - frac *= scale; - extra_days = (int) frac; + frac *= scale; + extra_days = (int) frac; tm->tm_mday += extra_days; - frac -= extra_days; + frac -= extra_days; AdjustFractSeconds(frac, tm, fsec, SECS_PER_DAY); } @@ -103,33 +103,33 @@ ISO8601IntegerWidth(char *fieldstart) } -/* copy&pasted from .../src/backend/utils/adt/datetime.c +/* copy&pasted from .../src/backend/utils/adt/datetime.c * and changesd struct pg_tm to struct tm */ -static inline void -ClearPgTm(struct /*pg_*/tm *tm, fsec_t *fsec) +static inline void +ClearPgTm(struct /* pg_ */ tm * tm, fsec_t *fsec) { tm->tm_year = 0; - tm->tm_mon = 0; + tm->tm_mon = 0; tm->tm_mday = 0; tm->tm_hour = 0; - tm->tm_min = 0; - tm->tm_sec = 0; - *fsec = 0; + tm->tm_min = 0; + tm->tm_sec = 0; + *fsec = 0; } -/* copy&pasted from .../src/backend/utils/adt/datetime.c - * +/* copy&pasted from .../src/backend/utils/adt/datetime.c + * * * changesd struct pg_tm to struct tm - * + * * * Made the function static */ static int DecodeISO8601Interval(char *str, - int *dtype, struct /*pg_*/tm * tm, fsec_t *fsec) + int *dtype, struct /* pg_ */ tm * tm, fsec_t *fsec) { - bool datepart = true; - bool havefield = false; + bool datepart = true; + bool havefield = false; *dtype = DTK_DELTA; ClearPgTm(tm, fsec); @@ -140,13 +140,13 @@ DecodeISO8601Interval(char *str, str++; while (*str) { - char *fieldstart; - int val; - double fval; - char unit; - int dterr; + char *fieldstart; + int val; + double fval; + char unit; + int dterr; - if (*str == 'T') /* T indicates the beginning of the time part */ + if (*str == 'T') /* T indicates the beginning of the time part */ { datepart = false; havefield = false; @@ -160,14 +160,14 @@ DecodeISO8601Interval(char *str, return dterr; /* - * Note: we could step off the end of the string here. Code below + * Note: we could step off the end of the string here. Code below * *must* exit the loop if unit == '\0'. */ unit = *str++; if (datepart) { - switch (unit) /* before T: Y M W D */ + switch (unit) /* before T: Y M W D */ { case 'Y': tm->tm_year += val; @@ -185,12 +185,12 @@ DecodeISO8601Interval(char *str, tm->tm_mday += val; AdjustFractSeconds(fval, tm, fsec, SECS_PER_DAY); break; - case 'T': /* ISO 8601 4.4.3.3 Alternative Format / Basic */ + case 'T': /* ISO 8601 4.4.3.3 Alternative Format / Basic */ case '\0': if (ISO8601IntegerWidth(fieldstart) == 8 && !havefield) { tm->tm_year += val / 10000; - tm->tm_mon += (val / 100) % 100; + tm->tm_mon += (val / 100) % 100; tm->tm_mday += val % 100; AdjustFractSeconds(fval, tm, fsec, SECS_PER_DAY); if (unit == '\0') @@ -200,12 +200,13 @@ DecodeISO8601Interval(char *str, continue; } /* Else fall through to extended alternative format */ - case '-': /* ISO 8601 4.4.3.3 Alternative Format, Extended */ + case '-': /* ISO 8601 4.4.3.3 Alternative Format, + * Extended */ if (havefield) return DTERR_BAD_FORMAT; tm->tm_year += val; - tm->tm_mon += (fval * 12); + tm->tm_mon += (fval * 12); if (unit == '\0') return 0; if (unit == 'T') @@ -218,7 +219,7 @@ DecodeISO8601Interval(char *str, dterr = ParseISO8601Number(str, &str, &val, &fval); if (dterr) return dterr; - tm->tm_mon += val; + tm->tm_mon += val; AdjustFractDays(fval, tm, fsec, DAYS_PER_MONTH); if (*str == '\0') return 0; @@ -231,7 +232,7 @@ DecodeISO8601Interval(char *str, if (*str != '-') return DTERR_BAD_FORMAT; str++; - + dterr = ParseISO8601Number(str, &str, &val, &fval); if (dterr) return dterr; @@ -253,7 +254,7 @@ DecodeISO8601Interval(char *str, } else { - switch (unit) /* after T: H M S */ + switch (unit) /* after T: H M S */ { case 'H': tm->tm_hour += val; @@ -267,17 +268,18 @@ DecodeISO8601Interval(char *str, tm->tm_sec += val; AdjustFractSeconds(fval, tm, fsec, 1); break; - case '\0': /* ISO 8601 4.4.3.3 Alternative Format */ - if (ISO8601IntegerWidth(fieldstart) == 6 && !havefield) + case '\0': /* ISO 8601 4.4.3.3 Alternative Format */ + if (ISO8601IntegerWidth(fieldstart) == 6 && !havefield) { tm->tm_hour += val / 10000; - tm->tm_min += (val / 100) % 100; - tm->tm_sec += val % 100; + tm->tm_min += (val / 100) % 100; + tm->tm_sec += val % 100; AdjustFractSeconds(fval, tm, fsec, 1); return 0; } /* Else fall through to extended alternative format */ - case ':': /* ISO 8601 4.4.3.3 Alternative Format, Extended */ + case ':': /* ISO 8601 4.4.3.3 Alternative Format, + * Extended */ if (havefield) return DTERR_BAD_FORMAT; @@ -285,22 +287,22 @@ DecodeISO8601Interval(char *str, AdjustFractSeconds(fval, tm, fsec, SECS_PER_HOUR); if (unit == '\0') return 0; - + dterr = ParseISO8601Number(str, &str, &val, &fval); if (dterr) return dterr; - tm->tm_min += val; + tm->tm_min += val; AdjustFractSeconds(fval, tm, fsec, SECS_PER_MINUTE); if (*str == '\0') return 0; if (*str != ':') return DTERR_BAD_FORMAT; str++; - + dterr = ParseISO8601Number(str, &str, &val, &fval); if (dterr) return dterr; - tm->tm_sec += val; + tm->tm_sec += val; AdjustFractSeconds(fval, tm, fsec, 1); if (*str == '\0') return 0; @@ -323,25 +325,25 @@ DecodeISO8601Interval(char *str, /* copy&pasted from .../src/backend/utils/adt/datetime.c * with 3 exceptions * - * * changesd struct pg_tm to struct tm + * * changesd struct pg_tm to struct tm * - * * ECPG code called this without a 'range' parameter - * removed 'int range' from the argument list and - * places where DecodeTime is called; and added - * int range = INTERVAL_FULL_RANGE; + * * ECPG code called this without a 'range' parameter + * removed 'int range' from the argument list and + * places where DecodeTime is called; and added + * int range = INTERVAL_FULL_RANGE; * - * * ECPG semes not to have a global IntervalStyle - * so added - * int IntervalStyle = INTSTYLE_POSTGRES; + * * ECPG semes not to have a global IntervalStyle + * so added + * int IntervalStyle = INTSTYLE_POSTGRES; * - * * Assert wasn't available so removed it. + * * Assert wasn't available so removed it. */ int -DecodeInterval(char **field, int *ftype, int nf, /*int range,*/ - int *dtype, struct /*pg_*/tm * tm, fsec_t *fsec) +DecodeInterval(char **field, int *ftype, int nf, /* int range, */ + int *dtype, struct /* pg_ */ tm * tm, fsec_t *fsec) { - int IntervalStyle = INTSTYLE_POSTGRES_VERBOSE; - int range = INTERVAL_FULL_RANGE; + int IntervalStyle = INTSTYLE_POSTGRES_VERBOSE; + int range = INTERVAL_FULL_RANGE; bool is_before = FALSE; char *cp; int fmask = 0, @@ -354,7 +356,7 @@ DecodeInterval(char **field, int *ftype, int nf, /*int range,*/ *dtype = DTK_DELTA; type = IGNORE_DTF; - ClearPgTm(tm,fsec); + ClearPgTm(tm, fsec); /* read through list backwards to pick up units before values */ for (i = nf - 1; i >= 0; i--) @@ -362,7 +364,7 @@ DecodeInterval(char **field, int *ftype, int nf, /*int range,*/ switch (ftype[i]) { case DTK_TIME: - dterr = DecodeTime(field[i], /* range, */ + dterr = DecodeTime(field[i], /* range, */ &tmask, tm, fsec); if (dterr) return dterr; @@ -372,19 +374,19 @@ DecodeInterval(char **field, int *ftype, int nf, /*int range,*/ case DTK_TZ: /* - * Timezone is a token with a leading sign character and - * at least one digit; there could be ':', '.', '-' - * embedded in it as well. + * Timezone is a token with a leading sign character and at + * least one digit; there could be ':', '.', '-' embedded in + * it as well. */ /* Assert(*field[i] == '-' || *field[i] == '+'); */ /* * Try for hh:mm or hh:mm:ss. If not, fall through to - * DTK_NUMBER case, which can handle signed float numbers - * and signed year-month values. + * DTK_NUMBER case, which can handle signed float numbers and + * signed year-month values. */ if (strchr(field[i] + 1, ':') != NULL && - DecodeTime(field[i] + 1, /* INTERVAL_FULL_RANGE, */ + DecodeTime(field[i] + 1, /* INTERVAL_FULL_RANGE, */ &tmask, tm, fsec) == 0) { if (*field[i] == '-') @@ -453,7 +455,7 @@ DecodeInterval(char **field, int *ftype, int nf, /*int range,*/ if (*cp == '-') { /* SQL "years-months" syntax */ - int val2; + int val2; val2 = strtoi(cp + 1, &cp, 10); if (errno == ERANGE || val2 < 0 || val2 >= MONTHS_PER_YEAR) @@ -642,7 +644,7 @@ DecodeInterval(char **field, int *ftype, int nf, /*int range,*/ /*---------- * The SQL standard defines the interval literal - * '-1 1:00:00' + * '-1 1:00:00' * to mean "negative 1 days and negative 1 hours", while Postgres * traditionally treats this as meaning "negative 1 days and positive * 1 hours". In SQL_STANDARD intervalstyle, we apply the leading sign @@ -652,14 +654,14 @@ DecodeInterval(char **field, int *ftype, int nf, /*int range,*/ * This protects us against misinterpreting postgres-style dump output, * since the postgres-style output code has always put an explicit sign on * all fields following a negative field. But note that SQL-spec output - * is ambiguous and can be misinterpreted on load! (So it's best practice + * is ambiguous and can be misinterpreted on load! (So it's best practice * to dump in postgres style, not SQL style.) *---------- */ if (IntervalStyle == INTSTYLE_SQL_STANDARD && *field[0] == '-') { /* Check for additional explicit signs */ - bool more_signs = false; + bool more_signs = false; for (i = 1; i < nf; i++) { @@ -673,8 +675,8 @@ DecodeInterval(char **field, int *ftype, int nf, /*int range,*/ if (!more_signs) { /* - * Rather than re-determining which field was field[0], just - * force 'em all negative. + * Rather than re-determining which field was field[0], just force + * 'em all negative. */ if (*fsec > 0) *fsec = -(*fsec); @@ -742,9 +744,10 @@ AddPostgresIntPart(char *cp, int value, const char *units, value, units, (value != 1) ? "s" : ""); + /* - * Each nonzero field sets is_before for (only) the next one. This is - * a tad bizarre but it's how it worked before... + * Each nonzero field sets is_before for (only) the next one. This is a + * tad bizarre but it's how it worked before... */ *is_before = (value < 0); *is_zero = FALSE; @@ -791,21 +794,21 @@ AppendSeconds(char *cp, int sec, fsec_t fsec, int precision, bool fillzeros) /* copy&pasted from .../src/backend/utils/adt/datetime.c - * + * * Change pg_tm to tm */ int -EncodeInterval(struct /*pg_*/tm * tm, fsec_t fsec, int style, char *str) +EncodeInterval(struct /* pg_ */ tm * tm, fsec_t fsec, int style, char *str) { char *cp = str; int year = tm->tm_year; - int mon = tm->tm_mon; + int mon = tm->tm_mon; int mday = tm->tm_mday; int hour = tm->tm_hour; - int min = tm->tm_min; - int sec = tm->tm_sec; + int min = tm->tm_min; + int sec = tm->tm_sec; bool is_before = FALSE; bool is_zero = TRUE; @@ -817,21 +820,21 @@ EncodeInterval(struct /*pg_*/tm * tm, fsec_t fsec, int style, char *str) */ switch (style) { - /* SQL Standard interval format */ + /* SQL Standard interval format */ case INTSTYLE_SQL_STANDARD: { - bool has_negative = year < 0 || mon < 0 || - mday < 0 || hour < 0 || - min < 0 || sec < 0 || fsec < 0; - bool has_positive = year > 0 || mon > 0 || - mday > 0 || hour > 0 || - min > 0 || sec > 0 || fsec > 0; - bool has_year_month = year != 0 || mon != 0; - bool has_day_time = mday != 0 || hour != 0 || - min != 0 || sec != 0 || fsec != 0; - bool has_day = mday != 0; - bool sql_standard_value = !(has_negative && has_positive) && - !(has_year_month && has_day_time); + bool has_negative = year < 0 || mon < 0 || + mday < 0 || hour < 0 || + min < 0 || sec < 0 || fsec < 0; + bool has_positive = year > 0 || mon > 0 || + mday > 0 || hour > 0 || + min > 0 || sec > 0 || fsec > 0; + bool has_year_month = year != 0 || mon != 0; + bool has_day_time = mday != 0 || hour != 0 || + min != 0 || sec != 0 || fsec != 0; + bool has_day = mday != 0; + bool sql_standard_value = !(has_negative && has_positive) && + !(has_year_month && has_day_time); /* * SQL Standard wants only 1 "<sign>" preceding the whole @@ -841,11 +844,11 @@ EncodeInterval(struct /*pg_*/tm * tm, fsec_t fsec, int style, char *str) { *cp++ = '-'; year = -year; - mon = -mon; + mon = -mon; mday = -mday; hour = -hour; - min = -min; - sec = -sec; + min = -min; + sec = -sec; fsec = -fsec; } @@ -856,15 +859,14 @@ EncodeInterval(struct /*pg_*/tm * tm, fsec_t fsec, int style, char *str) else if (!sql_standard_value) { /* - * For non sql-standard interval values, - * force outputting the signs to avoid - * ambiguities with intervals with mixed - * sign components. + * For non sql-standard interval values, force outputting + * the signs to avoid ambiguities with intervals with + * mixed sign components. */ - char year_sign = (year < 0 || mon < 0) ? '-' : '+'; - char day_sign = (mday < 0) ? '-' : '+'; - char sec_sign = (hour < 0 || min < 0 || - sec < 0 || fsec < 0) ? '-' : '+'; + char year_sign = (year < 0 || mon < 0) ? '-' : '+'; + char day_sign = (mday < 0) ? '-' : '+'; + char sec_sign = (hour < 0 || min < 0 || + sec < 0 || fsec < 0) ? '-' : '+'; sprintf(cp, "%c%d-%d %c%d %c%d:%02d:", year_sign, abs(year), abs(mon), @@ -892,23 +894,23 @@ EncodeInterval(struct /*pg_*/tm * tm, fsec_t fsec, int style, char *str) } break; - /* ISO 8601 "time-intervals by duration only" */ + /* ISO 8601 "time-intervals by duration only" */ case INTSTYLE_ISO_8601: /* special-case zero to avoid printing nothing */ if (year == 0 && mon == 0 && mday == 0 && - hour == 0 && min == 0 && sec == 0 && fsec == 0) + hour == 0 && min == 0 && sec == 0 && fsec == 0) { sprintf(cp, "PT0S"); break; } *cp++ = 'P'; cp = AddISO8601IntPart(cp, year, 'Y'); - cp = AddISO8601IntPart(cp, mon , 'M'); + cp = AddISO8601IntPart(cp, mon, 'M'); cp = AddISO8601IntPart(cp, mday, 'D'); if (hour != 0 || min != 0 || sec != 0 || fsec != 0) *cp++ = 'T'; cp = AddISO8601IntPart(cp, hour, 'H'); - cp = AddISO8601IntPart(cp, min , 'M'); + cp = AddISO8601IntPart(cp, min, 'M'); if (sec != 0 || fsec != 0) { if (sec < 0 || fsec < 0) @@ -920,14 +922,14 @@ EncodeInterval(struct /*pg_*/tm * tm, fsec_t fsec, int style, char *str) } break; - /* Compatible with postgresql < 8.4 when DateStyle = 'iso' */ + /* Compatible with postgresql < 8.4 when DateStyle = 'iso' */ case INTSTYLE_POSTGRES: cp = AddPostgresIntPart(cp, year, "year", &is_zero, &is_before); cp = AddPostgresIntPart(cp, mon, "mon", &is_zero, &is_before); cp = AddPostgresIntPart(cp, mday, "day", &is_zero, &is_before); if (is_zero || hour != 0 || min != 0 || sec != 0 || fsec != 0) { - bool minus = (hour < 0 || min < 0 || sec < 0 || fsec < 0); + bool minus = (hour < 0 || min < 0 || sec < 0 || fsec < 0); sprintf(cp, "%s%s%02d:%02d:", is_zero ? "" : " ", @@ -938,7 +940,7 @@ EncodeInterval(struct /*pg_*/tm * tm, fsec_t fsec, int style, char *str) } break; - /* Compatible with postgresql < 8.4 when DateStyle != 'iso' */ + /* Compatible with postgresql < 8.4 when DateStyle != 'iso' */ case INTSTYLE_POSTGRES_VERBOSE: default: strcpy(cp, "@"); @@ -1133,7 +1135,7 @@ PGTYPESinterval_to_asc(interval * span) *tm = &tt; fsec_t fsec; char buf[MAXDATELEN + 1]; - int IntervalStyle = INTSTYLE_POSTGRES_VERBOSE; + int IntervalStyle = INTSTYLE_POSTGRES_VERBOSE; if (interval2tm(*span, tm, &fsec) != 0) { diff --git a/src/interfaces/ecpg/pgtypeslib/timestamp.c b/src/interfaces/ecpg/pgtypeslib/timestamp.c index ff44a85756..22e3ce7273 100644 --- a/src/interfaces/ecpg/pgtypeslib/timestamp.c +++ b/src/interfaces/ecpg/pgtypeslib/timestamp.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/timestamp.c,v 1.44 2009/05/20 16:13:18 meskes Exp $ + * $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/timestamp.c,v 1.45 2009/06/11 14:49:13 momjian Exp $ */ #include "postgres_fe.h" diff --git a/src/interfaces/ecpg/preproc/c_keywords.c b/src/interfaces/ecpg/preproc/c_keywords.c index 3ab4f0ed95..2eae2c769b 100644 --- a/src/interfaces/ecpg/preproc/c_keywords.c +++ b/src/interfaces/ecpg/preproc/c_keywords.c @@ -3,7 +3,7 @@ * keywords.c * lexical token lookup for reserved words in postgres embedded SQL * - * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/c_keywords.c,v 1.22 2008/05/20 23:17:32 meskes Exp $ + * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/c_keywords.c,v 1.23 2009/06/11 14:49:13 momjian Exp $ * § *------------------------------------------------------------------------- */ @@ -22,8 +22,11 @@ */ static const ScanKeyword ScanCKeywords[] = { /* name, value, category */ - /* category is not needed in ecpg, it is only here so we can share - * the data structure with the backend */ + + /* + * category is not needed in ecpg, it is only here so we can share the + * data structure with the backend + */ {"VARCHAR", VARCHAR, 0}, {"auto", S_AUTO, 0}, {"bool", SQL_BOOL, 0}, diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c index 55296dc0bd..07990b85ad 100644 --- a/src/interfaces/ecpg/preproc/ecpg.c +++ b/src/interfaces/ecpg/preproc/ecpg.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.109 2009/02/25 13:03:07 petere Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.110 2009/06/11 14:49:13 momjian Exp $ */ /* New main for ecpg, the PostgreSQL embedded SQL precompiler. */ /* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */ @@ -36,7 +36,7 @@ help(const char *progname) printf(_("%s is the PostgreSQL embedded SQL preprocessor for C programs.\n\n"), progname); printf(_("Usage:\n" - " %s [OPTION]... FILE...\n\n"), + " %s [OPTION]... FILE...\n\n"), progname); printf(_("Options:\n")); printf(_(" -c automatically generate C code from embedded SQL code;\n" @@ -52,13 +52,13 @@ help(const char *progname) printf(_(" -I DIRECTORY search DIRECTORY for include files\n")); printf(_(" -o OUTFILE write result to OUTFILE\n")); printf(_(" -r OPTION specify run-time behavior; OPTION can be:\n" - " \"no_indicator\", \"prepare\", \"questionmarks\"\n")); + " \"no_indicator\", \"prepare\", \"questionmarks\"\n")); printf(_(" --regression run in regression testing mode\n")); printf(_(" -t turn on autocommit of transactions\n")); printf(_(" --help show this help, then exit\n")); printf(_(" --version output version information, then exit\n")); printf(_("\nIf no output file is specified, the name is formed by adding .c to the\n" - "input file name, after stripping off .pgc if present.\n")); + "input file name, after stripping off .pgc if present.\n")); printf(_("\nReport bugs to <pgsql-bugs@postgresql.org>.\n")); } @@ -455,10 +455,9 @@ main(int argc, char *const argv[]) /* and parse the source */ base_yyparse(); - /* - * Check whether all cursors were indeed opened. It - * does not really make sense to declare a cursor but - * not open it. + /* + * Check whether all cursors were indeed opened. It does not + * really make sense to declare a cursor but not open it. */ for (ptr = cur; ptr != NULL; ptr = ptr->next) if (!(ptr->opened)) diff --git a/src/interfaces/ecpg/preproc/ecpg_keywords.c b/src/interfaces/ecpg/preproc/ecpg_keywords.c index ae2c3aa4bd..0aef816169 100644 --- a/src/interfaces/ecpg/preproc/ecpg_keywords.c +++ b/src/interfaces/ecpg/preproc/ecpg_keywords.c @@ -4,7 +4,7 @@ * lexical token lookup for reserved words in postgres embedded SQL * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg_keywords.c,v 1.39 2008/10/21 08:38:16 petere Exp $ + * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg_keywords.c,v 1.40 2009/06/11 14:49:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -24,8 +24,11 @@ */ static const ScanKeyword ScanECPGKeywords[] = { /* name, value, category */ - /* category is not needed in ecpg, it is only here so we can share - * the data structure with the backend */ + + /* + * category is not needed in ecpg, it is only here so we can share the + * data structure with the backend + */ {"allocate", SQL_ALLOCATE, 0}, {"autocommit", SQL_AUTOCOMMIT, 0}, {"bool", SQL_BOOL, 0}, @@ -60,7 +63,7 @@ static const ScanKeyword ScanECPGKeywords[] = { {"section", SQL_SECTION, 0}, {"short", SQL_SHORT, 0}, {"signed", SQL_SIGNED, 0}, - {"sql", SQL_SQL, 0}, /* strange thing, used for into sql descriptor + {"sql", SQL_SQL, 0}, /* strange thing, used for into sql descriptor * MYDESC; */ {"sqlerror", SQL_SQLERROR, 0}, {"sqlprint", SQL_SQLPRINT, 0}, diff --git a/src/interfaces/ecpg/preproc/extern.h b/src/interfaces/ecpg/preproc/extern.h index e5e1e41218..a7a125c13b 100644 --- a/src/interfaces/ecpg/preproc/extern.h +++ b/src/interfaces/ecpg/preproc/extern.h @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/extern.h,v 1.72 2009/06/03 20:24:51 tgl Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/extern.h,v 1.73 2009/06/11 14:49:13 momjian Exp $ */ #ifndef _ECPG_PREPROC_EXTERN_H #define _ECPG_PREPROC_EXTERN_H @@ -74,7 +74,8 @@ extern int base_yylex(void); extern void base_yyerror(const char *); extern void *mm_alloc(size_t), *mm_realloc(void *, size_t); extern char *mm_strdup(const char *); -extern void mmerror(int, enum errortype, const char *, ...) +extern void +mmerror(int, enum errortype, const char *,...) /* This extension allows gcc to check the format string */ __attribute__((format(printf, 3, 4))); extern void output_get_descr_header(char *); diff --git a/src/interfaces/ecpg/preproc/output.c b/src/interfaces/ecpg/preproc/output.c index e12308d666..09486c66d0 100644 --- a/src/interfaces/ecpg/preproc/output.c +++ b/src/interfaces/ecpg/preproc/output.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/output.c,v 1.24 2008/03/20 15:56:59 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/output.c,v 1.25 2009/06/11 14:49:13 momjian Exp $ */ #include "postgres_fe.h" @@ -194,15 +194,21 @@ output_escaped_str(char *str, bool quoted) fputs("\\\n", yyout); else if (str[i] == '\\') { - int j = i; - - /* check whether this is a continuation line - * if it is, do not output anything because newlines are escaped anyway */ + int j = i; + + /* + * check whether this is a continuation line if it is, do not + * output anything because newlines are escaped anyway + */ /* accept blanks after the '\' as some other compilers do too */ - do { j++; } while (str[j] == ' ' || str[j] == '\t'); + do + { + j++; + } while (str[j] == ' ' || str[j] == '\t'); - if ((str[j] != '\n') && (str[j] != '\r' || str[j + 1] != '\n')) /* not followed by a newline */ + if ((str[j] != '\n') && (str[j] != '\r' || str[j + 1] != '\n')) /* not followed by a + * newline */ fputs("\\\\", yyout); } else if (str[i] == '\r' && str[i + 1] == '\n') diff --git a/src/interfaces/ecpg/preproc/type.c b/src/interfaces/ecpg/preproc/type.c index 1d3030e3c4..49caa32f26 100644 --- a/src/interfaces/ecpg/preproc/type.c +++ b/src/interfaces/ecpg/preproc/type.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.82 2009/01/23 12:43:32 petere Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.83 2009/06/11 14:49:13 momjian Exp $ */ #include "postgres_fe.h" @@ -242,7 +242,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, switch (type->u.element->type) { case ECPGt_array: - mmerror(PARSE_ERROR, ET_ERROR, "nested arrays are not supported (except strings)"); /* array of array */ + mmerror(PARSE_ERROR, ET_ERROR, "nested arrays are not supported (except strings)"); /* array of array */ break; case ECPGt_struct: case ECPGt_union: @@ -327,9 +327,10 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type, fprintf(o, "\n\tECPGt_descriptor, %s, 0L, 0L, 0L, ", name); else { - char *variable = (char *) mm_alloc(strlen(name) + ((prefix == NULL) ? 0 : strlen(prefix)) + 4); - char *offset = (char *) mm_alloc(strlen(name) + strlen("sizeof(struct varchar_)") + 1 + strlen(varcharsize) + sizeof(int) * CHAR_BIT * 10 / 3); - char *var_name, *ptr; + char *variable = (char *) mm_alloc(strlen(name) + ((prefix == NULL) ? 0 : strlen(prefix)) + 4); + char *offset = (char *) mm_alloc(strlen(name) + strlen("sizeof(struct varchar_)") + 1 + strlen(varcharsize) + sizeof(int) * CHAR_BIT * 10 / 3); + char *var_name, + *ptr; switch (type) { @@ -354,7 +355,8 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type, /* remove trailing [] is name is array element */ var_name = mm_strdup(name); ptr = strchr(var_name, '['); - if (ptr) *ptr = '\0'; + if (ptr) + *ptr = '\0'; if (lineno) sprintf(offset, "sizeof(struct varchar_%s_%d)", var_name, lineno); else diff --git a/src/interfaces/ecpg/preproc/type.h b/src/interfaces/ecpg/preproc/type.h index 28cbbe62d7..45fd8cca61 100644 --- a/src/interfaces/ecpg/preproc/type.h +++ b/src/interfaces/ecpg/preproc/type.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.h,v 1.50 2008/05/20 23:17:32 meskes Exp $ + * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.h,v 1.51 2009/06/11 14:49:13 momjian Exp $ */ #ifndef _ECPG_PREPROC_TYPE_H #define _ECPG_PREPROC_TYPE_H diff --git a/src/interfaces/ecpg/preproc/variable.c b/src/interfaces/ecpg/preproc/variable.c index 55ff8d23c8..307490465e 100644 --- a/src/interfaces/ecpg/preproc/variable.c +++ b/src/interfaces/ecpg/preproc/variable.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/variable.c,v 1.48 2009/03/26 22:26:08 petere Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/variable.c,v 1.49 2009/06/11 14:49:13 momjian Exp $ */ #include "postgres_fe.h" @@ -497,8 +497,8 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty if (pointer_len > 2) mmerror(PARSE_ERROR, ET_FATAL, ngettext("multilevel pointers (more than 2 levels) are not supported; found %d level", - "multilevel pointers (more than 2 levels) are not supported; found %d levels", pointer_len), - pointer_len); + "multilevel pointers (more than 2 levels) are not supported; found %d levels", pointer_len), + pointer_len); if (pointer_len > 1 && type_enum != ECPGt_char && type_enum != ECPGt_unsigned_char) mmerror(PARSE_ERROR, ET_FATAL, "pointer to pointer is not supported for this data type"); diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c index dd0023a64f..a41242ba04 100644 --- a/src/interfaces/libpq/fe-auth.c +++ b/src/interfaces/libpq/fe-auth.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.141 2009/03/22 18:06:35 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.142 2009/06/11 14:49:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -580,13 +580,14 @@ pg_SSPI_continue(PGconn *conn) } /* - * If the negotiation is complete, there may be zero bytes to send. The server is - * at this point not expecting any more data, so don't send it. + * If the negotiation is complete, there may be zero bytes to send. + * The server is at this point not expecting any more data, so don't + * send it. */ if (outbuf.pBuffers[0].cbBuffer > 0) { if (pqPacketSend(conn, 'p', - outbuf.pBuffers[0].pvBuffer, outbuf.pBuffers[0].cbBuffer)) + outbuf.pBuffers[0].pvBuffer, outbuf.pBuffers[0].cbBuffer)) { FreeContextBuffer(outbuf.pBuffers[0].pvBuffer); return STATUS_ERROR; @@ -914,7 +915,7 @@ pg_fe_sendauth(AuthRequest areq, PGconn *conn) case AUTH_REQ_CRYPT: printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("Crypt authentication not supported\n")); + libpq_gettext("Crypt authentication not supported\n")); return STATUS_ERROR; case AUTH_REQ_MD5: @@ -971,12 +972,11 @@ pg_fe_getauthname(PQExpBuffer errorMessage) #endif /* - * Some users are using configure - * --enable-thread-safety-force, so we might as well do the locking within - * our library to protect pqGetpwuid(). In fact, application developers - * can use getpwuid() in their application if they use the locking call we - * provide, or install their own locking function using - * PQregisterThreadLock(). + * Some users are using configure --enable-thread-safety-force, so we + * might as well do the locking within our library to protect + * pqGetpwuid(). In fact, application developers can use getpwuid() in + * their application if they use the locking call we provide, or install + * their own locking function using PQregisterThreadLock(). */ pglock_thread(); diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index d009fc3166..d20d0b6010 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.374 2009/05/18 16:15:22 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.375 2009/06/11 14:49:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -176,9 +176,9 @@ static const PQconninfoOption PQconninfoOptions[] = { /* * ssl options are allowed even without client SSL support because the - * client can still handle SSL modes "disable" and "allow". Other parameters - * have no effect on non-SSL connections, so there is no reason to exclude them - * since none of them are mandatory. + * client can still handle SSL modes "disable" and "allow". Other + * parameters have no effect on non-SSL connections, so there is no reason + * to exclude them since none of them are mandatory. */ {"sslmode", "PGSSLMODE", DefaultSSLMode, NULL, "SSL-Mode", "", 8}, /* sizeof("disable") == 8 */ @@ -566,7 +566,7 @@ connectOptions2(PGconn *conn) * * Parse an empty string like PQconnectdb() would do and return the * resulting connection options array, ie, all the default values that are - * available from the environment etc. On error (eg out of memory), + * available from the environment etc. On error (eg out of memory), * NULL is returned. * * Using this function, an application may determine all possible options @@ -949,7 +949,11 @@ connectDBComplete(PGconn *conn) switch (flag) { case PGRES_POLLING_OK: - /* Reset stored error messages since we now have a working connection */ + + /* + * Reset stored error messages since we now have a working + * connection + */ resetPQExpBuffer(&conn->errorMessage); return 1; /* success! */ @@ -1330,7 +1334,10 @@ keep_going: /* We will come back to here until there is EnvironmentOptions); if (!startpacket) { - /* will not appendbuffer here, since it's likely to also run out of memory */ + /* + * will not appendbuffer here, since it's likely to also + * run out of memory + */ printfPQExpBuffer(&conn->errorMessage, libpq_gettext("out of memory\n")); goto error_return; @@ -1407,7 +1414,8 @@ keep_going: /* We will come back to here until there is else if (SSLok == 'N') { if (conn->sslmode[0] == 'r' || /* "require" */ - conn->sslmode[0] == 'v') /* "verify-ca" or "verify-full" */ + conn->sslmode[0] == 'v') /* "verify-ca" or + * "verify-full" */ { /* Require SSL, but server does not want it */ appendPQExpBuffer(&conn->errorMessage, @@ -1425,7 +1433,8 @@ keep_going: /* We will come back to here until there is if (conn->Pfdebug) fprintf(conn->Pfdebug, "received error from server, attempting fallback to pre-7.0\n"); if (conn->sslmode[0] == 'r' || /* "require" */ - conn->sslmode[0] == 'v') /* "verify-ca" or "verify-full" */ + conn->sslmode[0] == 'v') /* "verify-ca" or + * "verify-full" */ { /* Require SSL, but server is too old */ appendPQExpBuffer(&conn->errorMessage, @@ -2070,7 +2079,7 @@ freePGconn(PGconn *conn) * - properly close a connection to the backend * * This should reset or release all transient state, but NOT the connection - * parameters. On exit, the PGconn should be in condition to start a fresh + * parameters. On exit, the PGconn should be in condition to start a fresh * connection with the same parameters (see PQreset()). */ static void @@ -2206,10 +2215,10 @@ PQreset(PGconn *conn) if (connectDBStart(conn) && connectDBComplete(conn)) { /* - * Notify event procs of successful reset. We treat an event - * proc failure as disabling the connection ... good idea? + * Notify event procs of successful reset. We treat an event proc + * failure as disabling the connection ... good idea? */ - int i; + int i; for (i = 0; i < conn->nEvents; i++) { @@ -2266,10 +2275,10 @@ PQresetPoll(PGconn *conn) if (status == PGRES_POLLING_OK) { /* - * Notify event procs of successful reset. We treat an event - * proc failure as disabling the connection ... good idea? + * Notify event procs of successful reset. We treat an event proc + * failure as disabling the connection ... good idea? */ - int i; + int i; for (i = 0; i < conn->nEvents; i++) { @@ -3139,7 +3148,7 @@ parseServiceInfo(PQconninfoOption *options, PQExpBuffer errorMessage) * PQconninfoParse * * Parse a string like PQconnectdb() would do and return the - * resulting connection options array. NULL is returned on failure. + * resulting connection options array. NULL is returned on failure. * The result contains only options specified directly in the string, * not any possible default values. * diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index 25590f4d37..c00f5eae6a 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.202 2009/05/27 14:16:51 meskes Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.203 2009/06/11 14:49:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -64,7 +64,7 @@ static bool PQexecStart(PGconn *conn); static PGresult *PQexecFinish(PGconn *conn); static int PQsendDescribe(PGconn *conn, char desc_type, const char *desc_target); -static int check_field_number(const PGresult *res, int field_num); +static int check_field_number(const PGresult *res, int field_num); /* ---------------- @@ -218,7 +218,7 @@ PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status) int PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs) { - int i; + int i; /* If attrs already exist, they cannot be overwritten. */ if (!res || res->numAttributes > 0) @@ -262,29 +262,29 @@ PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs) * Returns a deep copy of the provided 'src' PGresult, which cannot be NULL. * The 'flags' argument controls which portions of the result will or will * NOT be copied. The created result is always put into the - * PGRES_TUPLES_OK status. The source result error message is not copied, + * PGRES_TUPLES_OK status. The source result error message is not copied, * although cmdStatus is. * - * To set custom attributes, use PQsetResultAttrs. That function requires + * To set custom attributes, use PQsetResultAttrs. That function requires * that there are no attrs contained in the result, so to use that * function you cannot use the PG_COPYRES_ATTRS or PG_COPYRES_TUPLES * options with this function. * * Options: - * PG_COPYRES_ATTRS - Copy the source result's attributes + * PG_COPYRES_ATTRS - Copy the source result's attributes * - * PG_COPYRES_TUPLES - Copy the source result's tuples. This implies - * copying the attrs, seeeing how the attrs are needed by the tuples. + * PG_COPYRES_TUPLES - Copy the source result's tuples. This implies + * copying the attrs, seeeing how the attrs are needed by the tuples. * - * PG_COPYRES_EVENTS - Copy the source result's events. + * PG_COPYRES_EVENTS - Copy the source result's events. * - * PG_COPYRES_NOTICEHOOKS - Copy the source result's notice hooks. + * PG_COPYRES_NOTICEHOOKS - Copy the source result's notice hooks. */ PGresult * PQcopyResult(const PGresult *src, int flags) { - PGresult *dest; - int i; + PGresult *dest; + int i; if (!src) return NULL; @@ -293,7 +293,7 @@ PQcopyResult(const PGresult *src, int flags) if (!dest) return NULL; - /* Always copy these over. Is cmdStatus really useful here? */ + /* Always copy these over. Is cmdStatus really useful here? */ dest->client_encoding = src->client_encoding; strcpy(dest->cmdStatus, src->cmdStatus); @@ -310,7 +310,8 @@ PQcopyResult(const PGresult *src, int flags) /* Wants to copy tuples? */ if (flags & PG_COPYRES_TUPLES) { - int tup, field; + int tup, + field; for (tup = 0; tup < src->ntups; tup++) { @@ -373,8 +374,8 @@ PQcopyResult(const PGresult *src, int flags) static PGEvent * dupEvents(PGEvent *events, int count) { - PGEvent *newEvents; - int i; + PGEvent *newEvents; + int i; if (!events || count <= 0) return NULL; @@ -424,7 +425,7 @@ PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len) /* need to grow the tuple table? */ if (res->ntups >= res->tupArrSize) { - int n = res->tupArrSize ? res->tupArrSize * 2 : 128; + int n = res->tupArrSize ? res->tupArrSize * 2 : 128; PGresAttValue **tups; if (res->tuples) @@ -445,7 +446,7 @@ PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len) if (tup_num == res->ntups && !res->tuples[tup_num]) { PGresAttValue *tup; - int i; + int i; tup = (PGresAttValue *) pqResultAlloc(res, res->numAttributes * sizeof(PGresAttValue), @@ -661,7 +662,7 @@ void PQclear(PGresult *res) { PGresult_data *block; - int i; + int i; if (!res) return; @@ -1600,7 +1601,7 @@ PQgetResult(PGconn *conn) if (res) { - int i; + int i; for (i = 0; i < res->nEvents; i++) { @@ -3115,7 +3116,7 @@ PQescapeByteaInternal(PGconn *conn, { if (*vp < 0x20 || *vp > 0x7e) { - int val = *vp; + int val = *vp; if (!std_strings) *rp++ = '\\'; @@ -3219,11 +3220,11 @@ PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen) (ISOCTDIGIT(strtext[i + 1])) && (ISOCTDIGIT(strtext[i + 2]))) { - int byte; + int byte; byte = OCTVAL(strtext[i++]); - byte = (byte << 3) + OCTVAL(strtext[i++]); - byte = (byte << 3) + OCTVAL(strtext[i++]); + byte = (byte <<3) +OCTVAL(strtext[i++]); + byte = (byte <<3) +OCTVAL(strtext[i++]); buffer[j++] = byte; } } diff --git a/src/interfaces/libpq/fe-lobj.c b/src/interfaces/libpq/fe-lobj.c index 601d52e1e9..49ff30a583 100644 --- a/src/interfaces/libpq/fe-lobj.c +++ b/src/interfaces/libpq/fe-lobj.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-lobj.c,v 1.67 2009/01/01 17:24:03 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-lobj.c,v 1.68 2009/06/11 14:49:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -42,7 +42,7 @@ static int lo_initialize(PGconn *conn); static Oid -lo_import_internal(PGconn *conn, const char *filename, const Oid oid); + lo_import_internal(PGconn *conn, const char *filename, const Oid oid); /* * lo_open diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c index 60459cb7e1..4ae6cdc910 100644 --- a/src/interfaces/libpq/fe-misc.c +++ b/src/interfaces/libpq/fe-misc.c @@ -23,7 +23,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.139 2009/05/21 12:54:27 meskes Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.140 2009/06/11 14:49:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -769,10 +769,11 @@ pqSendSome(PGconn *conn, int len) #ifndef WIN32 sent = pqsecure_write(conn, ptr, len); #else + /* - * Windows can fail on large sends, per KB article Q201213. The failure-point - * appears to be different in different versions of Windows, but 64k should - * always be safe. + * Windows can fail on large sends, per KB article Q201213. The + * failure-point appears to be different in different versions of + * Windows, but 64k should always be safe. */ sent = pqsecure_write(conn, ptr, Min(len, 65536)); #endif @@ -1073,10 +1074,11 @@ pqSocketPoll(int sock, int forRead, int forWrite, time_t end_time) FD_ZERO(&output_mask); FD_ZERO(&except_mask); if (forRead) - FD_SET(sock, &input_mask); + FD_SET (sock, &input_mask); + if (forWrite) - FD_SET(sock, &output_mask); - FD_SET(sock, &except_mask); + FD_SET (sock, &output_mask); + FD_SET (sock, &except_mask); /* Compute appropriate timeout interval */ if (end_time == ((time_t) -1)) diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c index 7dba7c2f81..10e5edd756 100644 --- a/src/interfaces/libpq/fe-protocol3.c +++ b/src/interfaces/libpq/fe-protocol3.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.38 2009/01/09 18:50:03 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.39 2009/06/11 14:49:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -309,7 +309,7 @@ pqParseInput3(PGconn *conn) if (conn->result == NULL) { conn->result = PQmakeEmptyPGresult(conn, - PGRES_COMMAND_OK); + PGRES_COMMAND_OK); if (!conn->result) return; } @@ -1378,7 +1378,7 @@ pqGetCopyData3(PGconn *conn, char **buffer, int async) for (;;) { /* - * Collect the next input message. To make life simpler for async + * Collect the next input message. To make life simpler for async * callers, we keep returning 0 until the next message is fully * available, even if it is not Copy Data. */ @@ -1387,13 +1387,13 @@ pqGetCopyData3(PGconn *conn, char **buffer, int async) { /* * On end-of-copy, exit COPY_OUT mode and let caller read status - * with PQgetResult(). The normal case is that it's Copy Done, - * but we let parseInput read that. If error, we expect the - * state was already changed. + * with PQgetResult(). The normal case is that it's Copy Done, + * but we let parseInput read that. If error, we expect the state + * was already changed. */ if (msgLength == -1) conn->asyncStatus = PGASYNC_BUSY; - return msgLength; /* end-of-copy or error */ + return msgLength; /* end-of-copy or error */ } if (msgLength == 0) { diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c index 75152dc2c4..9ecf55e39b 100644 --- a/src/interfaces/libpq/fe-secure.c +++ b/src/interfaces/libpq/fe-secure.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.125 2009/05/03 17:16:58 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.126 2009/06/11 14:49:14 momjian Exp $ * * NOTES * @@ -111,10 +111,8 @@ static pthread_mutex_t ssl_config_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t ssl_config_mutex = NULL; static long win32_ssl_create_mutex = 0; #endif - -#endif /* ENABLE_THREAD_SAFETY */ - -#endif /* SSL */ +#endif /* ENABLE_THREAD_SAFETY */ +#endif /* SSL */ /* @@ -141,8 +139,7 @@ static long win32_ssl_create_mutex = 0; #define RESTORE_SIGPIPE() \ pq_reset_sigpipe(&osigmask, sigpipe_pending, got_epipe) - -#else /* !ENABLE_THREAD_SAFETY */ +#else /* !ENABLE_THREAD_SAFETY */ #define DISABLE_SIGPIPE(failaction) \ pqsigfunc oldsighandler = pqsignal(SIGPIPE, SIG_IGN) @@ -151,15 +148,13 @@ static long win32_ssl_create_mutex = 0; #define RESTORE_SIGPIPE() \ pqsignal(SIGPIPE, oldsighandler) - -#endif /* ENABLE_THREAD_SAFETY */ -#else /* WIN32 */ +#endif /* ENABLE_THREAD_SAFETY */ +#else /* WIN32 */ #define DISABLE_SIGPIPE(failaction) #define REMEMBER_EPIPE(cond) #define RESTORE_SIGPIPE() - -#endif /* WIN32 */ +#endif /* WIN32 */ /* ------------------------------------------------------------ */ /* Procedures common to all secure sessions */ @@ -180,14 +175,15 @@ PQinitSSL(int do_init) * Exported function to allow application to tell us it's already * initialized OpenSSL and/or libcrypto. */ -void +void PQinitOpenSSL(int do_ssl, int do_crypto) { #ifdef USE_SSL #ifdef ENABLE_THREAD_SAFETY + /* - * Disallow changing the flags while we have open connections, else - * we'd get completely confused. + * Disallow changing the flags while we have open connections, else we'd + * get completely confused. */ if (ssl_open_connections != 0) return; @@ -473,11 +469,11 @@ verify_cb(int ok, X509_STORE_CTX *ctx) * Check if a wildcard certificate matches the server hostname. * * The rule for this is: - * 1. We only match the '*' character as wildcard - * 2. We match only wildcards at the start of the string - * 3. The '*' character does *not* match '.', meaning that we match only - * a single pathname component. - * 4. We don't support more than one '*' in a single pattern. + * 1. We only match the '*' character as wildcard + * 2. We match only wildcards at the start of the string + * 3. The '*' character does *not* match '.', meaning that we match only + * a single pathname component. + * 4. We don't support more than one '*' in a single pattern. * * This is roughly in line with RFC2818, but contrary to what most browsers * appear to be implementing (point 3 being the difference) @@ -487,8 +483,8 @@ verify_cb(int ok, X509_STORE_CTX *ctx) static int wildcard_certificate_match(const char *pattern, const char *string) { - int lenpat = strlen(pattern); - int lenstr = strlen(string); + int lenpat = strlen(pattern); + int lenstr = strlen(string); /* If we don't start with a wildcard, it's not a match (rule 1 & 2) */ if (lenpat < 3 || @@ -500,12 +496,20 @@ wildcard_certificate_match(const char *pattern, const char *string) /* If pattern is longer than the string, we can never match */ return 0; - if (pg_strcasecmp(pattern+1, string+lenstr-lenpat+1) != 0) - /* If string does not end in pattern (minus the wildcard), we don't match */ + if (pg_strcasecmp(pattern + 1, string + lenstr - lenpat + 1) != 0) + + /* + * If string does not end in pattern (minus the wildcard), we don't + * match + */ return 0; - if (strchr(string, '.') < string+lenstr-lenpat) - /* If there is a dot left of where the pattern started to match, we don't match (rule 3) */ + if (strchr(string, '.') < string + lenstr - lenpat) + + /* + * If there is a dot left of where the pattern started to match, we + * don't match (rule 3) + */ return 0; /* String ended with pattern, and didn't have a dot before, so we match */ @@ -520,8 +524,8 @@ static bool verify_peer_name_matches_certificate(PGconn *conn) { /* - * If told not to verify the peer name, don't do it. Return - * 0 indicating that the verification was successful. + * If told not to verify the peer name, don't do it. Return 0 indicating + * that the verification was successful. */ if (strcmp(conn->sslmode, "verify-full") != 0) return true; @@ -650,10 +654,10 @@ client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey) BIO_free(bio); /* - * Read the SSL key. If a key is specified, treat it as an engine:key combination - * if there is colon present - we don't support files with colon in the name. The - * exception is if the second character is a colon, in which case it can be a Windows - * filename with drive specification. + * Read the SSL key. If a key is specified, treat it as an engine:key + * combination if there is colon present - we don't support files with + * colon in the name. The exception is if the second character is a colon, + * in which case it can be a Windows filename with drive specification. */ if (conn->sslkey && strlen(conn->sslkey) > 0) { @@ -662,15 +666,15 @@ client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey) #ifdef WIN32 && conn->sslkey[1] != ':' #endif - ) + ) { /* Colon, but not in second character, treat as engine:key */ ENGINE *engine_ptr; char *engine_str = strdup(conn->sslkey); char *engine_colon = strchr(engine_str, ':'); - *engine_colon = '\0'; /* engine_str now has engine name */ - engine_colon++; /* engine_colon now has key name */ + *engine_colon = '\0'; /* engine_str now has engine name */ + engine_colon++; /* engine_colon now has key name */ engine_ptr = ENGINE_by_id(engine_str); if (engine_ptr == NULL) @@ -678,7 +682,7 @@ client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey) char *err = SSLerrmessage(); printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not load SSL engine \"%s\": %s\n"), + libpq_gettext("could not load SSL engine \"%s\": %s\n"), engine_str, err); SSLerrfree(err); free(engine_str); @@ -702,10 +706,11 @@ client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey) } free(engine_str); - fnbuf[0] = '\0'; /* indicate we're not going to load from a file */ + fnbuf[0] = '\0'; /* indicate we're not going to load from a + * file */ } else -#endif /* support for SSL engines */ +#endif /* support for SSL engines */ { /* PGSSLKEY is not an engine, treat it as a filename */ strncpy(fnbuf, conn->sslkey, sizeof(fnbuf)); @@ -733,7 +738,7 @@ client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey) if (!S_ISREG(buf.st_mode) || buf.st_mode & (S_IRWXG | S_IRWXO)) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("private key file \"%s\" has group or world access; permissions should be u=rw (0600) or less\n"), + libpq_gettext("private key file \"%s\" has group or world access; permissions should be u=rw (0600) or less\n"), fnbuf); ERR_pop_to_mark(); return 0; @@ -869,7 +874,7 @@ init_ssl_system(PGconn *conn) */ if (pq_lockarray == NULL) { - int i; + int i; pq_lockarray = malloc(sizeof(pthread_mutex_t) * CRYPTO_num_locks()); if (!pq_lockarray) @@ -896,7 +901,7 @@ init_ssl_system(PGconn *conn) CRYPTO_set_locking_callback(pq_lockingcallback); } } -#endif /* ENABLE_THREAD_SAFETY */ +#endif /* ENABLE_THREAD_SAFETY */ if (!SSL_context) { @@ -959,12 +964,11 @@ destroy_ssl_system(void) CRYPTO_set_id_callback(NULL); /* - * We don't free the lock array. If we get another connection - * in this process, we will just re-use it with the existing - * mutexes. + * We don't free the lock array. If we get another connection in this + * process, we will just re-use it with the existing mutexes. * - * This means we leak a little memory on repeated load/unload - * of the library. + * This means we leak a little memory on repeated load/unload of the + * library. */ } @@ -991,15 +995,16 @@ initialize_SSL(PGconn *conn) * verification. If set to "verify-full" we will also do further * verification after the connection has been completed. * - * If we are going to look for either root certificate or CRL in the home directory, - * we need pqGetHomeDirectory() to succeed. In other cases, we don't need to - * get the home directory explicitly. + * If we are going to look for either root certificate or CRL in the home + * directory, we need pqGetHomeDirectory() to succeed. In other cases, we + * don't need to get the home directory explicitly. */ if (!conn->sslrootcert || !conn->sslcrl) { if (!pqGetHomeDirectory(homedir, sizeof(homedir))) { - if (conn->sslmode[0] == 'v') /* "verify-ca" or "verify-full" */ + if (conn->sslmode[0] == 'v') /* "verify-ca" or + * "verify-full" */ { printfPQExpBuffer(&conn->errorMessage, libpq_gettext("could not get home directory to locate root certificate file")); @@ -1044,7 +1049,7 @@ initialize_SSL(PGconn *conn) /* OpenSSL 0.96 does not support X509_V_FLAG_CRL_CHECK */ #ifdef X509_V_FLAG_CRL_CHECK X509_STORE_set_flags(cvstore, - X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL); + X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL); /* if not found, silently ignore; we do not require CRL */ #else { @@ -1064,10 +1069,10 @@ initialize_SSL(PGconn *conn) else { /* stat() failed; assume cert file doesn't exist */ - if (conn->sslmode[0] == 'v') /* "verify-ca" or "verify-full" */ + if (conn->sslmode[0] == 'v') /* "verify-ca" or "verify-full" */ { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("root certificate file \"%s\" does not exist\n" + libpq_gettext("root certificate file \"%s\" does not exist\n" "Either provide the file or change sslmode to disable server certificate verification.\n"), fnbuf); return -1; } @@ -1153,8 +1158,8 @@ open_client_SSL(PGconn *conn) } /* - * We already checked the server certificate in initialize_SSL() - * using SSL_CTX_set_verify() if root.crt exists. + * We already checked the server certificate in initialize_SSL() using + * SSL_CTX_set_verify() if root.crt exists. */ /* pull out server distinguished and common names */ diff --git a/src/interfaces/libpq/libpq-events.c b/src/interfaces/libpq/libpq-events.c index a1ad42f1de..aef0343d0f 100644 --- a/src/interfaces/libpq/libpq-events.c +++ b/src/interfaces/libpq/libpq-events.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-events.c,v 1.4 2009/01/01 17:24:03 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-events.c,v 1.5 2009/06/11 14:49:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -40,7 +40,7 @@ int PQregisterEventProc(PGconn *conn, PGEventProc proc, const char *name, void *passThrough) { - int i; + int i; PGEventRegister regevt; if (!proc || !conn || !name || !*name) @@ -54,8 +54,8 @@ PQregisterEventProc(PGconn *conn, PGEventProc proc, if (conn->nEvents >= conn->eventArraySize) { - PGEvent *e; - int newSize; + PGEvent *e; + int newSize; newSize = conn->eventArraySize ? conn->eventArraySize * 2 : 8; if (conn->events) @@ -97,7 +97,7 @@ PQregisterEventProc(PGconn *conn, PGEventProc proc, int PQsetInstanceData(PGconn *conn, PGEventProc proc, void *data) { - int i; + int i; if (!conn || !proc) return FALSE; @@ -120,7 +120,7 @@ PQsetInstanceData(PGconn *conn, PGEventProc proc, void *data) void * PQinstanceData(const PGconn *conn, PGEventProc proc) { - int i; + int i; if (!conn || !proc) return NULL; @@ -141,7 +141,7 @@ PQinstanceData(const PGconn *conn, PGEventProc proc) int PQresultSetInstanceData(PGresult *result, PGEventProc proc, void *data) { - int i; + int i; if (!result || !proc) return FALSE; @@ -164,7 +164,7 @@ PQresultSetInstanceData(PGresult *result, PGEventProc proc, void *data) void * PQresultInstanceData(const PGresult *result, PGEventProc proc) { - int i; + int i; if (!result || !proc) return NULL; @@ -184,7 +184,7 @@ PQresultInstanceData(const PGresult *result, PGEventProc proc) int PQfireResultCreateEvents(PGconn *conn, PGresult *res) { - int i; + int i; if (!res) return FALSE; diff --git a/src/interfaces/libpq/libpq-events.h b/src/interfaces/libpq/libpq-events.h index 8335439bdf..9340211e23 100644 --- a/src/interfaces/libpq/libpq-events.h +++ b/src/interfaces/libpq/libpq-events.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-events.h,v 1.3 2009/01/01 17:24:03 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-events.h,v 1.4 2009/06/11 14:49:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -24,7 +24,7 @@ extern "C" #endif /* Callback Event Ids */ -typedef enum + typedef enum { PGEVT_REGISTER, PGEVT_CONNRESET, @@ -36,41 +36,41 @@ typedef enum typedef struct { - PGconn *conn; + PGconn *conn; } PGEventRegister; typedef struct { - PGconn *conn; + PGconn *conn; } PGEventConnReset; typedef struct { - PGconn *conn; + PGconn *conn; } PGEventConnDestroy; typedef struct { - PGconn *conn; - PGresult *result; + PGconn *conn; + PGresult *result; } PGEventResultCreate; typedef struct { const PGresult *src; - PGresult *dest; + PGresult *dest; } PGEventResultCopy; typedef struct { - PGresult *result; + PGresult *result; } PGEventResultDestroy; typedef int (*PGEventProc) (PGEventId evtId, void *evtInfo, void *passThrough); /* Registers an event proc with the given PGconn. */ -extern int PQregisterEventProc(PGconn *conn, PGEventProc proc, - const char *name, void *passThrough); +extern int PQregisterEventProc(PGconn *conn, PGEventProc proc, + const char *name, void *passThrough); /* Sets the PGconn instance data for the provided proc to data. */ extern int PQsetInstanceData(PGconn *conn, PGEventProc proc, void *data); @@ -91,4 +91,4 @@ extern int PQfireResultCreateEvents(PGconn *conn, PGresult *res); } #endif -#endif /* LIBPQ_EVENTS_H */ +#endif /* LIBPQ_EVENTS_H */ diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-fe.h index bef0908707..6119fd539b 100644 --- a/src/interfaces/libpq/libpq-fe.h +++ b/src/interfaces/libpq/libpq-fe.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.146 2009/03/31 01:41:27 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.147 2009/06/11 14:49:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -31,10 +31,10 @@ extern "C" /* * Option flags for PQcopyResult */ -#define PG_COPYRES_ATTRS 0x01 -#define PG_COPYRES_TUPLES 0x02 /* Implies PG_COPYRES_ATTRS */ -#define PG_COPYRES_EVENTS 0x04 -#define PG_COPYRES_NOTICEHOOKS 0x08 +#define PG_COPYRES_ATTRS 0x01 +#define PG_COPYRES_TUPLES 0x02 /* Implies PG_COPYRES_ATTRS */ +#define PG_COPYRES_EVENTS 0x04 +#define PG_COPYRES_NOTICEHOOKS 0x08 /* Application-visible enum types */ @@ -463,9 +463,9 @@ extern void PQfreemem(void *ptr); /* Create and manipulate PGresults */ extern PGresult *PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status); extern PGresult *PQcopyResult(const PGresult *src, int flags); -extern int PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs); +extern int PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs); extern void *PQresultAlloc(PGresult *res, size_t nBytes); -extern int PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len); +extern int PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len); /* Quoting strings before inclusion in queries. */ extern size_t PQescapeStringConn(PGconn *conn, diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h index eeb50462e6..f4d6315a56 100644 --- a/src/interfaces/libpq/libpq-int.h +++ b/src/interfaces/libpq/libpq-int.h @@ -12,7 +12,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.141 2009/04/24 09:43:10 mha Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.142 2009/06/11 14:49:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -69,7 +69,7 @@ typedef struct { void *value; int length; -} gss_buffer_desc; +} gss_buffer_desc; #endif #endif /* ENABLE_SSPI */ @@ -155,11 +155,11 @@ typedef struct typedef struct PGEvent { - PGEventProc proc; /* the function to call on events */ + PGEventProc proc; /* the function to call on events */ char *name; /* used only for error messages */ void *passThrough; /* pointer supplied at registration time */ void *data; /* optional state (instance) data */ - bool resultInitialized; /* T if RESULTCREATE/COPY succeeded */ + bool resultInitialized; /* T if RESULTCREATE/COPY succeeded */ } PGEvent; struct pg_result @@ -182,7 +182,7 @@ struct pg_result * on the PGresult don't have to reference the PGconn. */ PGNoticeHooks noticeHooks; - PGEvent *events; + PGEvent *events; int nEvents; int client_encoding; /* encoding id */ @@ -310,9 +310,9 @@ struct pg_conn PGNoticeHooks noticeHooks; /* Event procs registered via PQregisterEventProc */ - PGEvent *events; /* expandable array of event data */ + PGEvent *events; /* expandable array of event data */ int nEvents; /* number of active events */ - int eventArraySize; /* allocated array size */ + int eventArraySize; /* allocated array size */ /* Status indicators */ ConnStatusType status; diff --git a/src/interfaces/libpq/pqexpbuffer.c b/src/interfaces/libpq/pqexpbuffer.c index 26f796cb2a..2b297dc1e8 100644 --- a/src/interfaces/libpq/pqexpbuffer.c +++ b/src/interfaces/libpq/pqexpbuffer.c @@ -17,7 +17,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/interfaces/libpq/pqexpbuffer.c,v 1.26 2009/01/01 17:24:03 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/pqexpbuffer.c,v 1.27 2009/06/11 14:49:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -47,11 +47,12 @@ markPQExpBufferBroken(PQExpBuffer str) { if (str->data != oom_buffer) free(str->data); + /* - * Casting away const here is a bit ugly, but it seems preferable to - * not marking oom_buffer const. We want to do that to encourage the - * compiler to put oom_buffer in read-only storage, so that anyone who - * tries to scribble on a broken PQExpBuffer will get a failure. + * Casting away const here is a bit ugly, but it seems preferable to not + * marking oom_buffer const. We want to do that to encourage the compiler + * to put oom_buffer in read-only storage, so that anyone who tries to + * scribble on a broken PQExpBuffer will get a failure. */ str->data = (char *) oom_buffer; str->len = 0; @@ -126,7 +127,7 @@ termPQExpBuffer(PQExpBuffer str) if (str->data != oom_buffer) free(str->data); /* just for luck, make the buffer validly empty. */ - str->data = (char *) oom_buffer; /* see comment above */ + str->data = (char *) oom_buffer; /* see comment above */ str->maxlen = 0; str->len = 0; } @@ -160,7 +161,7 @@ resetPQExpBuffer(PQExpBuffer str) * Make sure there is enough space for 'needed' more bytes in the buffer * ('needed' does not include the terminating null). * - * Returns 1 if OK, 0 if failed to enlarge buffer. (In the latter case + * Returns 1 if OK, 0 if failed to enlarge buffer. (In the latter case * the buffer is left in "broken" state.) */ int diff --git a/src/interfaces/libpq/pqexpbuffer.h b/src/interfaces/libpq/pqexpbuffer.h index c425a94d80..c4e9da9ba8 100644 --- a/src/interfaces/libpq/pqexpbuffer.h +++ b/src/interfaces/libpq/pqexpbuffer.h @@ -18,7 +18,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/interfaces/libpq/pqexpbuffer.h,v 1.22 2009/01/01 17:24:03 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/pqexpbuffer.h,v 1.23 2009/06/11 14:49:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -37,7 +37,7 @@ * more space. We must always have maxlen > len. * * An exception occurs if we failed to allocate enough memory for the string - * buffer. In that case data points to a statically allocated empty string, + * buffer. In that case data points to a statically allocated empty string, * and len = maxlen = 0. *------------------------- */ @@ -56,7 +56,7 @@ typedef PQExpBufferData *PQExpBuffer; * are no-ops. *------------------------ */ -#define PQExpBufferBroken(str) \ +#define PQExpBufferBroken(str) \ ((str) == NULL || (str)->maxlen == 0) /*------------------------ @@ -126,7 +126,7 @@ extern void resetPQExpBuffer(PQExpBuffer str); * Make sure there is enough space for 'needed' more bytes in the buffer * ('needed' does not include the terminating null). * - * Returns 1 if OK, 0 if failed to enlarge buffer. (In the latter case + * Returns 1 if OK, 0 if failed to enlarge buffer. (In the latter case * the buffer is left in "broken" state.) */ extern int enlargePQExpBuffer(PQExpBuffer str, size_t needed); diff --git a/src/interfaces/libpq/pthread-win32.c b/src/interfaces/libpq/pthread-win32.c index 538aa5e1ac..105580cbad 100644 --- a/src/interfaces/libpq/pthread-win32.c +++ b/src/interfaces/libpq/pthread-win32.c @@ -5,7 +5,7 @@ * * Copyright (c) 2004-2009, PostgreSQL Global Development Group * IDENTIFICATION -* $PostgreSQL: pgsql/src/interfaces/libpq/pthread-win32.c,v 1.18 2009/01/01 17:24:03 momjian Exp $ +* $PostgreSQL: pgsql/src/interfaces/libpq/pthread-win32.c,v 1.19 2009/06/11 14:49:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -35,7 +35,7 @@ pthread_getspecific(pthread_key_t key) int pthread_mutex_init(pthread_mutex_t *mp, void *attr) { - *mp = (CRITICAL_SECTION *)malloc(sizeof(CRITICAL_SECTION)); + *mp = (CRITICAL_SECTION *) malloc(sizeof(CRITICAL_SECTION)); if (!*mp) return 1; InitializeCriticalSection(*mp); diff --git a/src/interfaces/libpq/win32.c b/src/interfaces/libpq/win32.c index 51e7ad2a29..cf87e1c1d6 100644 --- a/src/interfaces/libpq/win32.c +++ b/src/interfaces/libpq/win32.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/interfaces/libpq/win32.c,v 1.25 2009/01/01 17:24:03 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/win32.c,v 1.26 2009/06/11 14:49:14 momjian Exp $ * * * FILE diff --git a/src/interfaces/libpq/win32.h b/src/interfaces/libpq/win32.h index b1c52688ae..b40909527b 100644 --- a/src/interfaces/libpq/win32.h +++ b/src/interfaces/libpq/win32.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/interfaces/libpq/win32.h,v 1.29 2008/05/17 01:28:25 adunstan Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/win32.h,v 1.30 2009/06/11 14:49:14 momjian Exp $ */ #ifndef __win32_h_included #define __win32_h_included diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index 4abbdeae20..9a64f578f8 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -1,7 +1,7 @@ /********************************************************************** * plperl.c - perl as a procedural language for PostgreSQL * - * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.149 2009/06/06 03:45:36 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.150 2009/06/11 14:49:14 momjian Exp $ * **********************************************************************/ @@ -199,7 +199,7 @@ _PG_init(void) pg_bindtextdomain(TEXTDOMAIN); DefineCustomBoolVariable("plperl.use_strict", - gettext_noop("If true, trusted and untrusted Perl code will be compiled in strict mode."), + gettext_noop("If true, trusted and untrusted Perl code will be compiled in strict mode."), NULL, &plperl_use_strict, false, @@ -273,7 +273,7 @@ _PG_init(void) #define SAFE_MODULE \ "require Safe; $Safe::VERSION" -/* +/* * The temporary enabling of the caller opcode here is to work around a * bug in perl 5.10, which unkindly changed the way its Safe.pm works, without * notice. It is quite safe, as caller is informational only, and in any case @@ -398,7 +398,7 @@ plperl_init_interp(void) static char *embedding[3] = { "", "-e", PERLBOOT }; - int nargs = 3; + int nargs = 3; #ifdef WIN32 @@ -455,7 +455,7 @@ plperl_init_interp(void) /* only call this the first time through, as per perlembed man page */ if (interp_state == INTERP_NONE) { - char *dummy_env[1] = { NULL }; + char *dummy_env[1] = {NULL}; PERL_SYS_INIT3(&nargs, (char ***) &embedding, (char ***) &dummy_env); } @@ -548,17 +548,16 @@ plperl_safe_init(void) eval_pv(SAFE_OK, FALSE); if (GetDatabaseEncoding() == PG_UTF8) { - /* - * Fill in just enough information to set up this perl - * function in the safe container and call it. - * For some reason not entirely clear, it prevents errors that - * can arise from the regex code later trying to load - * utf8 modules. + /* + * Fill in just enough information to set up this perl function in + * the safe container and call it. For some reason not entirely + * clear, it prevents errors that can arise from the regex code + * later trying to load utf8 modules. */ - plperl_proc_desc desc; + plperl_proc_desc desc; FunctionCallInfoData fcinfo; - SV *ret; - SV *func; + SV *ret; + SV *func; /* make sure we don't call ourselves recursively */ plperl_safe_init_done = true; @@ -576,7 +575,7 @@ plperl_safe_init(void) fcinfo.arg[0] = CStringGetTextDatum("a"); fcinfo.argnull[0] = false; - + /* and make the call */ ret = plperl_call_perl_func(&desc, &fcinfo); } @@ -1457,7 +1456,7 @@ plperl_trigger_handler(PG_FUNCTION_ARGS) { ereport(WARNING, (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED), - errmsg("ignoring modified row in DELETE trigger"))); + errmsg("ignoring modified row in DELETE trigger"))); trv = NULL; } } @@ -1465,8 +1464,8 @@ plperl_trigger_handler(PG_FUNCTION_ARGS) { ereport(ERROR, (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED), - errmsg("result of PL/Perl trigger function must be undef, " - "\"SKIP\", or \"MODIFY\""))); + errmsg("result of PL/Perl trigger function must be undef, " + "\"SKIP\", or \"MODIFY\""))); trv = NULL; } retval = PointerGetDatum(trv); @@ -1979,7 +1978,7 @@ plperl_return_next(SV *sv) if (prodesc->fn_retistuple) { - HeapTuple tuple; + HeapTuple tuple; tuple = plperl_build_tuple_result((HV *) SvRV(sv), current_call_data->attinmeta); diff --git a/src/pl/plperl/spi_internal.c b/src/pl/plperl/spi_internal.c index 7a0f76671b..5544fbf461 100644 --- a/src/pl/plperl/spi_internal.c +++ b/src/pl/plperl/spi_internal.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/pl/plperl/spi_internal.c,v 1.9 2008/05/17 01:28:25 adunstan Exp $ + * $PostgreSQL: pgsql/src/pl/plperl/spi_internal.c,v 1.10 2009/06/11 14:49:14 momjian Exp $ * * * This kludge is necessary because of the conflicting diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c index 5f75818d7a..659e797f2c 100644 --- a/src/pl/plpgsql/src/pl_comp.c +++ b/src/pl/plpgsql/src/pl_comp.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.135 2009/04/19 18:52:57 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.136 2009/06/11 14:49:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -415,8 +415,8 @@ do_compile(FunctionCallInfo fcinfo, argdtype->ttype != PLPGSQL_TTYPE_ROW) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("PL/pgSQL functions cannot accept type %s", - format_type_be(argtypeid)))); + errmsg("PL/pgSQL functions cannot accept type %s", + format_type_be(argtypeid)))); /* Build variable and add to datum list */ argvariable = plpgsql_build_variable(buf, 0, @@ -534,8 +534,8 @@ do_compile(FunctionCallInfo fcinfo, else ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("PL/pgSQL functions cannot return type %s", - format_type_be(rettypeid)))); + errmsg("PL/pgSQL functions cannot return type %s", + format_type_be(rettypeid)))); } if (typeStruct->typrelid != InvalidOid || @@ -787,8 +787,8 @@ plpgsql_parse_word(const char *word) plpgsql_convert_ident(word, cp, 1); /* - * Recognize tg_argv when compiling triggers - * (XXX this sucks, it should be a regular variable in the namestack) + * Recognize tg_argv when compiling triggers (XXX this sucks, it should be + * a regular variable in the namestack) */ if (plpgsql_curr_compile->fn_is_trigger) { @@ -977,8 +977,8 @@ plpgsql_parse_tripword(const char *word) plpgsql_convert_ident(word, cp, 3); /* - * Do a lookup on the compiler's namestack. - * Must find a qualified reference. + * Do a lookup on the compiler's namestack. Must find a qualified + * reference. */ ns = plpgsql_ns_lookup(cp[0], cp[1], cp[2], &nnames); if (ns == NULL || nnames != 2) @@ -1168,8 +1168,8 @@ plpgsql_parse_dblwordtype(char *word) pfree(cp[2]); /* - * Do a lookup on the compiler's namestack. Ensure we scan all levels. - * We don't need to check number of names matched, because we will only + * Do a lookup on the compiler's namestack. Ensure we scan all levels. We + * don't need to check number of names matched, because we will only * consider scalar variables. */ old_nsstate = plpgsql_ns_setlocal(false); @@ -1755,8 +1755,8 @@ build_datatype(HeapTuple typeTup, int32 typmod) } /* - * plpgsql_recognize_err_condition - * Check condition name and translate it to SQLSTATE. + * plpgsql_recognize_err_condition + * Check condition name and translate it to SQLSTATE. * * Note: there are some cases where the same condition name has multiple * entries in the table. We arbitrarily return the first match. diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index b5f0006918..579a6c572d 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.242 2009/06/04 18:33:07 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.243 2009/06/11 14:49:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -52,7 +52,7 @@ typedef struct * creates its own "eval_econtext" ExprContext within this estate for * per-evaluation workspace. eval_econtext is freed at normal function exit, * and the EState is freed at transaction end (in case of error, we assume - * that the abort mechanisms clean it all up). Furthermore, any exception + * that the abort mechanisms clean it all up). Furthermore, any exception * block within a function has to have its own eval_econtext separate from * the containing function's, so that we can clean up ExprContext callbacks * properly at subtransaction exit. We maintain a stack that tracks the @@ -65,9 +65,9 @@ typedef struct */ typedef struct SimpleEcontextStackEntry { - ExprContext *stack_econtext; /* a stacked econtext */ - SubTransactionId xact_subxid; /* ID for current subxact */ - struct SimpleEcontextStackEntry *next; /* next stack entry up */ + ExprContext *stack_econtext; /* a stacked econtext */ + SubTransactionId xact_subxid; /* ID for current subxact */ + struct SimpleEcontextStackEntry *next; /* next stack entry up */ } SimpleEcontextStackEntry; static EState *simple_eval_estate = NULL; @@ -94,7 +94,7 @@ static int exec_stmt_getdiag(PLpgSQL_execstate *estate, static int exec_stmt_if(PLpgSQL_execstate *estate, PLpgSQL_stmt_if *stmt); static int exec_stmt_case(PLpgSQL_execstate *estate, - PLpgSQL_stmt_case *stmt); + PLpgSQL_stmt_case *stmt); static int exec_stmt_loop(PLpgSQL_execstate *estate, PLpgSQL_stmt_loop *stmt); static int exec_stmt_while(PLpgSQL_execstate *estate, @@ -168,7 +168,7 @@ static Datum exec_eval_expr(PLpgSQL_execstate *estate, static int exec_run_select(PLpgSQL_execstate *estate, PLpgSQL_expr *expr, long maxtuples, Portal *portalP); static int exec_for_query(PLpgSQL_execstate *estate, PLpgSQL_stmt_forq *stmt, - Portal portal, bool prefetch_ok); + Portal portal, bool prefetch_ok); static void eval_expr_params(PLpgSQL_execstate *estate, PLpgSQL_expr *expr, Datum **p_values, char **p_nulls); static void exec_move_row(PLpgSQL_execstate *estate, @@ -197,10 +197,10 @@ static void plpgsql_destroy_econtext(PLpgSQL_execstate *estate); static void free_var(PLpgSQL_var *var); static void assign_text_var(PLpgSQL_var *var, const char *str); static PreparedParamsData *exec_eval_using_params(PLpgSQL_execstate *estate, - List *params); + List *params); static void free_params_data(PreparedParamsData *ppd); static Portal exec_dynquery_with_params(PLpgSQL_execstate *estate, - PLpgSQL_expr *query, List *params); + PLpgSQL_expr *query, List *params); /* ---------- @@ -414,7 +414,7 @@ plpgsql_exec_function(PLpgSQL_function *func, FunctionCallInfo fcinfo) * sure it is labeled with the caller-supplied tuple type. */ estate.retval = - PointerGetDatum(SPI_returntuple((HeapTuple)DatumGetPointer(estate.retval), + PointerGetDatum(SPI_returntuple((HeapTuple) DatumGetPointer(estate.retval), tupdesc)); } else @@ -764,7 +764,10 @@ plpgsql_exec_error_callback(void *arg) */ if (estate->err_stmt != NULL) { - /* translator: last %s is a phrase such as "during statement block local variable initialization" */ + /* + * translator: last %s is a phrase such as "during statement block + * local variable initialization" + */ errcontext("PL/pgSQL function \"%s\" line %d %s", estate->err_func->fn_name, estate->err_stmt->lineno, @@ -772,7 +775,10 @@ plpgsql_exec_error_callback(void *arg) } else { - /* translator: last %s is a phrase such as "while storing call arguments into local variables" */ + /* + * translator: last %s is a phrase such as "while storing call + * arguments into local variables" + */ errcontext("PL/pgSQL function \"%s\" %s", estate->err_func->fn_name, _(estate->err_text)); @@ -1032,8 +1038,8 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block) CurrentResourceOwner = oldowner; /* - * Revert to outer eval_econtext. (The inner one was automatically - * cleaned up during subxact exit.) + * Revert to outer eval_econtext. (The inner one was + * automatically cleaned up during subxact exit.) */ estate->eval_econtext = old_eval_econtext; @@ -1145,6 +1151,7 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block) return rc; case PLPGSQL_RC_EXIT: + /* * This is intentionally different from the handling of RC_EXIT * for loops: to match a block, we require a match by label. @@ -1451,18 +1458,17 @@ exec_stmt_case(PLpgSQL_execstate *estate, PLpgSQL_stmt_case *stmt) if (stmt->t_expr != NULL) { /* simple case */ - Datum t_val; - Oid t_oid; + Datum t_val; + Oid t_oid; t_val = exec_eval_expr(estate, stmt->t_expr, &isnull, &t_oid); t_var = (PLpgSQL_var *) estate->datums[stmt->t_varno]; /* - * When expected datatype is different from real, change it. - * Note that what we're modifying here is an execution copy - * of the datum, so this doesn't affect the originally stored - * function parse tree. + * When expected datatype is different from real, change it. Note that + * what we're modifying here is an execution copy of the datum, so + * this doesn't affect the originally stored function parse tree. */ if (t_var->datatype->typoid != t_oid) t_var->datatype = plpgsql_build_datatype(t_oid, -1); @@ -1481,7 +1487,7 @@ exec_stmt_case(PLpgSQL_execstate *estate, PLpgSQL_stmt_case *stmt) foreach(l, stmt->case_when_list) { PLpgSQL_case_when *cwt = (PLpgSQL_case_when *) lfirst(l); - bool value; + bool value; value = exec_eval_boolean(estate, cwt->expr, &isnull); exec_eval_cleanup(estate); @@ -1904,7 +1910,7 @@ exec_stmt_forc(PLpgSQL_execstate *estate, PLpgSQL_stmt_forc *stmt) if (curvar->cursor_explicit_argrow < 0) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("arguments given for cursor without arguments"))); + errmsg("arguments given for cursor without arguments"))); memset(&set_args, 0, sizeof(set_args)); set_args.cmd_type = PLPGSQL_STMT_EXECSQL; @@ -2069,7 +2075,7 @@ exec_stmt_return(PLpgSQL_execstate *estate, PLpgSQL_stmt_return *stmt) estate->retval = PointerGetDatum(make_tuple_from_row(estate, row, row->rowtupdesc)); - if (DatumGetPointer(estate->retval) == NULL) /* should not happen */ + if (DatumGetPointer(estate->retval) == NULL) /* should not happen */ elog(ERROR, "row not compatible with its own tupdesc"); estate->rettupdesc = row->rowtupdesc; estate->retisnull = false; @@ -2132,11 +2138,11 @@ static int exec_stmt_return_next(PLpgSQL_execstate *estate, PLpgSQL_stmt_return_next *stmt) { - TupleDesc tupdesc; - int natts; - MemoryContext oldcxt; - HeapTuple tuple = NULL; - bool free_tuple = false; + TupleDesc tupdesc; + int natts; + MemoryContext oldcxt; + HeapTuple tuple = NULL; + bool free_tuple = false; if (!estate->retisset) ereport(ERROR, @@ -2190,10 +2196,10 @@ exec_stmt_return_next(PLpgSQL_execstate *estate, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("record \"%s\" is not assigned yet", rec->refname), - errdetail("The tuple structure of a not-yet-assigned" - " record is indeterminate."))); + errdetail("The tuple structure of a not-yet-assigned" + " record is indeterminate."))); validate_tupdesc_compat(tupdesc, rec->tupdesc, - "wrong record type supplied in RETURN NEXT"); + "wrong record type supplied in RETURN NEXT"); tuple = rec->tup; } break; @@ -2277,7 +2283,7 @@ exec_stmt_return_query(PLpgSQL_execstate *estate, PLpgSQL_stmt_return_query *stmt) { Portal portal; - uint32 processed = 0; + uint32 processed = 0; if (!estate->retisset) ereport(ERROR, @@ -2301,7 +2307,7 @@ exec_stmt_return_query(PLpgSQL_execstate *estate, } validate_tupdesc_compat(estate->rettupdesc, portal->tupDesc, - "structure of query does not match function result type"); + "structure of query does not match function result type"); while (true) { @@ -2418,10 +2424,10 @@ exec_stmt_raise(PLpgSQL_execstate *estate, PLpgSQL_stmt_raise *stmt) if (current_param == NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("too few parameters specified for RAISE"))); + errmsg("too few parameters specified for RAISE"))); paramvalue = exec_eval_expr(estate, - (PLpgSQL_expr *) lfirst(current_param), + (PLpgSQL_expr *) lfirst(current_param), ¶misnull, ¶mtypeid); @@ -2804,6 +2810,7 @@ exec_stmt_execsql(PLpgSQL_execstate *estate, case SPI_OK_REWRITTEN: Assert(!stmt->mod_stmt); + /* * The command was rewritten into another kind of command. It's * not clear what FOUND would mean in that case (and SPI doesn't @@ -2975,7 +2982,7 @@ exec_stmt_dynexecute(PLpgSQL_execstate *estate, if (*ptr == 'S' || *ptr == 's') ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("EXECUTE of SELECT ... INTO is not implemented"))); + errmsg("EXECUTE of SELECT ... INTO is not implemented"))); break; } @@ -3604,8 +3611,8 @@ exec_assign_value(PLpgSQL_execstate *estate, /* * Get the number of the records field to change and the - * number of attributes in the tuple. Note: disallow - * system column names because the code below won't cope. + * number of attributes in the tuple. Note: disallow system + * column names because the code below won't cope. */ fno = SPI_fnumber(rec->tupdesc, recfield->fieldname); if (fno <= 0) @@ -4186,8 +4193,8 @@ exec_for_query(PLpgSQL_execstate *estate, PLpgSQL_stmt_forq *stmt, elog(ERROR, "unsupported target"); /* - * Fetch the initial tuple(s). If prefetching is allowed then we grab - * a few more rows to avoid multiple trips through executor startup + * Fetch the initial tuple(s). If prefetching is allowed then we grab a + * few more rows to avoid multiple trips through executor startup * overhead. */ SPI_cursor_fetch(portal, true, prefetch_ok ? 10 : 1); @@ -4195,8 +4202,8 @@ exec_for_query(PLpgSQL_execstate *estate, PLpgSQL_stmt_forq *stmt, n = SPI_processed; /* - * If the query didn't return any rows, set the target to NULL and - * fall through with found = false. + * If the query didn't return any rows, set the target to NULL and fall + * through with found = false. */ if (n <= 0) exec_move_row(estate, rec, row, NULL, tuptab->tupdesc); @@ -4567,12 +4574,13 @@ exec_move_row(PLpgSQL_execstate *estate, * attributes of the tuple to the variables the row points to. * * NOTE: this code used to demand row->nfields == - * HeapTupleHeaderGetNatts(tup->t_data), but that's wrong. The tuple might - * have more fields than we expected if it's from an inheritance-child - * table of the current table, or it might have fewer if the table has had - * columns added by ALTER TABLE. Ignore extra columns and assume NULL for - * missing columns, the same as heap_getattr would do. We also have to - * skip over dropped columns in either the source or destination. + * HeapTupleHeaderGetNatts(tup->t_data), but that's wrong. The tuple + * might have more fields than we expected if it's from an + * inheritance-child table of the current table, or it might have fewer if + * the table has had columns added by ALTER TABLE. Ignore extra columns + * and assume NULL for missing columns, the same as heap_getattr would do. + * We also have to skip over dropped columns in either the source or + * destination. * * If we have no tuple data at all, we'll assign NULL to all columns of * the row variable. @@ -5118,7 +5126,7 @@ exec_simple_check_plan(PLpgSQL_expr *expr) static void validate_tupdesc_compat(TupleDesc expected, TupleDesc returned, const char *msg) { - int i; + int i; const char *dropped_column_type = gettext_noop("N/A (dropped column)"); if (!expected || !returned) @@ -5139,15 +5147,15 @@ validate_tupdesc_compat(TupleDesc expected, TupleDesc returned, const char *msg) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("%s", _(msg)), - errdetail("Returned type %s does not match expected type " - "%s in column \"%s\".", - OidIsValid(returned->attrs[i]->atttypid) ? - format_type_be(returned->attrs[i]->atttypid) : - _(dropped_column_type), - OidIsValid(expected->attrs[i]->atttypid) ? - format_type_be(expected->attrs[i]->atttypid) : - _(dropped_column_type), - NameStr(expected->attrs[i]->attname)))); + errdetail("Returned type %s does not match expected type " + "%s in column \"%s\".", + OidIsValid(returned->attrs[i]->atttypid) ? + format_type_be(returned->attrs[i]->atttypid) : + _(dropped_column_type), + OidIsValid(expected->attrs[i]->atttypid) ? + format_type_be(expected->attrs[i]->atttypid) : + _(dropped_column_type), + NameStr(expected->attrs[i]->attname)))); } /* ---------- @@ -5343,7 +5351,7 @@ exec_eval_using_params(PLpgSQL_execstate *estate, List *params) foreach(lc, params) { PLpgSQL_expr *param = (PLpgSQL_expr *) lfirst(lc); - bool isnull; + bool isnull; ppd->values[i] = exec_eval_expr(estate, param, &isnull, @@ -5354,8 +5362,8 @@ exec_eval_using_params(PLpgSQL_execstate *estate, List *params) /* pass-by-ref non null values must be copied into plpgsql context */ if (!isnull) { - int16 typLen; - bool typByVal; + int16 typLen; + bool typByVal; get_typlenbyval(ppd->types[i], &typLen, &typByVal); if (!typByVal) @@ -5379,7 +5387,7 @@ exec_eval_using_params(PLpgSQL_execstate *estate, List *params) static void free_params_data(PreparedParamsData *ppd) { - int i; + int i; for (i = 0; i < ppd->nargs; i++) { @@ -5409,8 +5417,8 @@ exec_dynquery_with_params(PLpgSQL_execstate *estate, PLpgSQL_expr *dynquery, char *querystr; /* - * Evaluate the string expression after the EXECUTE keyword. Its result - * is the querystring we have to execute. + * Evaluate the string expression after the EXECUTE keyword. Its result is + * the querystring we have to execute. */ query = exec_eval_expr(estate, dynquery, &isnull, &restype); if (isnull) @@ -5424,9 +5432,9 @@ exec_dynquery_with_params(PLpgSQL_execstate *estate, PLpgSQL_expr *dynquery, exec_eval_cleanup(estate); /* - * Open an implicit cursor for the query. We use SPI_cursor_open_with_args - * even when there are no params, because this avoids making and freeing - * one copy of the plan. + * Open an implicit cursor for the query. We use + * SPI_cursor_open_with_args even when there are no params, because this + * avoids making and freeing one copy of the plan. */ if (params) { diff --git a/src/pl/plpgsql/src/pl_funcs.c b/src/pl/plpgsql/src/pl_funcs.c index b3c9136088..5a3b621a4e 100644 --- a/src/pl/plpgsql/src/pl_funcs.c +++ b/src/pl/plpgsql/src/pl_funcs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.78 2009/04/19 21:50:09 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.79 2009/06/11 14:49:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -228,7 +228,7 @@ plpgsql_ns_additem(int itemtype, int itemno, const char *name) * * Note that this only searches for variables, not labels. * - * name1 must be non-NULL. Pass NULL for name2 and/or name3 if parsing a name + * name1 must be non-NULL. Pass NULL for name2 and/or name3 if parsing a name * with fewer than three components. * * If names_used isn't NULL, *names_used receives the number of names @@ -412,7 +412,7 @@ plpgsql_convert_ident(const char *s, char **output, int numidents) if (*s != '"') /* should not happen if lexer checked */ ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("unterminated \" in identifier: %s", sstart))); + errmsg("unterminated \" in identifier: %s", sstart))); s++; *cp = '\0'; /* Truncate to NAMEDATALEN */ @@ -722,7 +722,7 @@ dump_if(PLpgSQL_stmt_if *stmt) static void dump_case(PLpgSQL_stmt_case *stmt) { - ListCell *l; + ListCell *l; dump_ind(); printf("CASE %d ", stmt->t_varno); @@ -828,7 +828,7 @@ static void dump_forc(PLpgSQL_stmt_forc *stmt) { dump_ind(); - printf("FORC %s ", stmt->rec->refname); + printf("FORC %s ", stmt->rec->refname); printf("curvar=%d\n", stmt->curvar); dump_indent += 2; diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h index 27e1056fd3..8f21f3beb9 100644 --- a/src/pl/plpgsql/src/plpgsql.h +++ b/src/pl/plpgsql/src/plpgsql.h @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.112 2009/04/19 21:50:09 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.113 2009/06/11 14:49:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -405,7 +405,7 @@ typedef struct /* CASE statement */ int lineno; PLpgSQL_expr *t_expr; /* test expression, or NULL if none */ int t_varno; /* var to store test expression value into */ - List *case_when_list; /* List of PLpgSQL_case_when structs */ + List *case_when_list; /* List of PLpgSQL_case_when structs */ bool have_else; /* flag needed because list could be empty */ List *else_stmts; /* List of statements */ } PLpgSQL_stmt_case; @@ -588,7 +588,7 @@ typedef struct typedef struct { /* RAISE statement option */ - int opt_type; + int opt_type; PLpgSQL_expr *expr; } PLpgSQL_raise_option; @@ -822,9 +822,9 @@ extern PLpgSQL_variable *plpgsql_build_variable(const char *refname, int lineno, PLpgSQL_type *dtype, bool add2namespace); extern PLpgSQL_rec *plpgsql_build_record(const char *refname, int lineno, - bool add2namespace); -extern int plpgsql_recognize_err_condition(const char *condname, - bool allow_sqlstate); + bool add2namespace); +extern int plpgsql_recognize_err_condition(const char *condname, + bool allow_sqlstate); extern PLpgSQL_condition *plpgsql_parse_err_condition(char *condname); extern void plpgsql_adddatum(PLpgSQL_datum *new); extern int plpgsql_add_initdatums(int **varnos); @@ -871,7 +871,7 @@ extern void plpgsql_ns_push(const char *label); extern void plpgsql_ns_pop(void); extern void plpgsql_ns_additem(int itemtype, int itemno, const char *name); extern PLpgSQL_nsitem *plpgsql_ns_lookup(const char *name1, const char *name2, - const char *name3, int *names_used); + const char *name3, int *names_used); extern PLpgSQL_nsitem *plpgsql_ns_lookup_label(const char *name); extern void plpgsql_ns_rename(char *oldname, char *newname); diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c index 345f3f6523..43c7fce2e5 100644 --- a/src/pl/plpython/plpython.c +++ b/src/pl/plpython/plpython.c @@ -1,7 +1,7 @@ /********************************************************************** * plpython.c - python as a procedural language for PostgreSQL * - * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.121 2009/06/04 18:33:08 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.122 2009/06/11 14:49:14 momjian Exp $ * ********************************************************************* */ @@ -87,19 +87,19 @@ typedef struct PLyDatumToOb Oid typoid; /* The OID of the type */ Oid typioparam; bool typbyval; -} PLyDatumToOb; +} PLyDatumToOb; typedef struct PLyTupleToOb { PLyDatumToOb *atts; int natts; -} PLyTupleToOb; +} PLyTupleToOb; typedef union PLyTypeInput { PLyDatumToOb d; PLyTupleToOb r; -} PLyTypeInput; +} PLyTypeInput; /* convert PyObject to a Postgresql Datum or tuple. * output from Python @@ -110,19 +110,19 @@ typedef struct PLyObToDatum Oid typoid; /* The OID of the type */ Oid typioparam; bool typbyval; -} PLyObToDatum; +} PLyObToDatum; typedef struct PLyObToTuple { PLyObToDatum *atts; int natts; -} PLyObToTuple; +} PLyObToTuple; typedef union PLyTypeOutput { PLyObToDatum d; PLyObToTuple r; -} PLyTypeOutput; +} PLyTypeOutput; /* all we need to move Postgresql data to Python objects, * and vis versa @@ -137,7 +137,7 @@ typedef struct PLyTypeInfo * is_rowtype can be: -1 not known yet (initial state) 0 scalar datatype * 1 rowtype 2 rowtype, but I/O functions not set up yet */ -} PLyTypeInfo; +} PLyTypeInfo; /* cached procedure data */ @@ -160,7 +160,7 @@ typedef struct PLyProcedure PyObject *globals; /* data saved across calls, global scope */ PyObject *me; /* PyCObject containing pointer to this * PLyProcedure */ -} PLyProcedure; +} PLyProcedure; /* Python objects */ @@ -172,16 +172,16 @@ typedef struct PLyPlanObject Oid *types; Datum *values; PLyTypeInfo *args; -} PLyPlanObject; +} PLyPlanObject; typedef struct PLyResultObject { PyObject_HEAD /* HeapTuple *tuples; */ - PyObject * nrows; /* number of rows returned by query */ + PyObject *nrows; /* number of rows returned by query */ PyObject *rows; /* data rows, or None if no data returned */ PyObject *status; /* query status, SPI_OK_*, or SPI_ERR_* */ -} PLyResultObject; +} PLyResultObject; /* function declarations */ @@ -205,11 +205,14 @@ static void PLy_init_interp(void); static void PLy_init_plpy(void); /* call PyErr_SetString with a vprint interface and translation support */ -static void PLy_exception_set(PyObject *, const char *,...) +static void +PLy_exception_set(PyObject *, const char *,...) __attribute__((format(printf, 2, 3))); + /* same, with pluralized message */ -static void PLy_exception_set_plural(PyObject *, const char *, const char *, - unsigned long n,...) +static void +PLy_exception_set_plural(PyObject *, const char *, const char *, + unsigned long n,...) __attribute__((format(printf, 2, 5))) __attribute__((format(printf, 3, 5))); @@ -217,7 +220,8 @@ __attribute__((format(printf, 3, 5))); static char *PLy_procedure_name(PLyProcedure *); /* some utility functions */ -static void PLy_elog(int, const char *,...) +static void +PLy_elog(int, const char *,...) __attribute__((format(printf, 2, 3))); static char *PLy_traceback(int *); @@ -243,7 +247,7 @@ static PLyProcedure *PLy_procedure_get(FunctionCallInfo fcinfo, Oid tgreloid); static PLyProcedure *PLy_procedure_create(HeapTuple procTup, Oid tgreloid, - char *key); + char *key); static void PLy_procedure_compile(PLyProcedure *, const char *); static char *PLy_procedure_munge_source(const char *, const char *); @@ -391,7 +395,7 @@ plpython_call_handler(PG_FUNCTION_ARGS) * to take no arguments and return an argument of type trigger. */ static HeapTuple -PLy_trigger_handler(FunctionCallInfo fcinfo, PLyProcedure * proc) +PLy_trigger_handler(FunctionCallInfo fcinfo, PLyProcedure *proc) { HeapTuple rv = NULL; PyObject *volatile plargs = NULL; @@ -467,7 +471,7 @@ PLy_trigger_handler(FunctionCallInfo fcinfo, PLyProcedure * proc) } static HeapTuple -PLy_modify_tuple(PLyProcedure * proc, PyObject * pltd, TriggerData *tdata, +PLy_modify_tuple(PLyProcedure *proc, PyObject *pltd, TriggerData *tdata, HeapTuple otup) { PyObject *volatile plntup; @@ -493,7 +497,7 @@ PLy_modify_tuple(PLyProcedure * proc, PyObject * pltd, TriggerData *tdata, PG_TRY(); { if ((plntup = PyDict_GetItemString(pltd, "new")) == NULL) - ereport(ERROR, + ereport(ERROR, (errmsg("TD[\"new\"] deleted, cannot modify row"))); if (!PyDict_Check(plntup)) ereport(ERROR, @@ -603,7 +607,7 @@ PLy_modify_tuple(PLyProcedure * proc, PyObject * pltd, TriggerData *tdata, } static PyObject * -PLy_trigger_build_args(FunctionCallInfo fcinfo, PLyProcedure * proc, HeapTuple *rv) +PLy_trigger_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc, HeapTuple *rv) { TriggerData *tdata = (TriggerData *) fcinfo->context; PyObject *pltname, @@ -783,7 +787,7 @@ PLy_trigger_build_args(FunctionCallInfo fcinfo, PLyProcedure * proc, HeapTuple * /* function handler and friends */ static Datum -PLy_function_handler(FunctionCallInfo fcinfo, PLyProcedure * proc) +PLy_function_handler(FunctionCallInfo fcinfo, PLyProcedure *proc) { Datum rv; PyObject *volatile plargs = NULL; @@ -845,7 +849,7 @@ PLy_function_handler(FunctionCallInfo fcinfo, PLyProcedure * proc) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("returned object cannot be iterated"), - errdetail("PL/Python set-returning functions must return an iterable object."))); + errdetail("PL/Python set-returning functions must return an iterable object."))); } /* Fetch next from iterator */ @@ -891,7 +895,7 @@ PLy_function_handler(FunctionCallInfo fcinfo, PLyProcedure * proc) if (plrv != Py_None) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("PL/Python function with return type \"void\" did not return None"))); + errmsg("PL/Python function with return type \"void\" did not return None"))); fcinfo->isnull = false; rv = (Datum) 0; @@ -964,7 +968,7 @@ PLy_function_handler(FunctionCallInfo fcinfo, PLyProcedure * proc) } static PyObject * -PLy_procedure_call(PLyProcedure * proc, char *kargs, PyObject * vargs) +PLy_procedure_call(PLyProcedure *proc, char *kargs, PyObject *vargs) { PyObject *rv; @@ -994,7 +998,7 @@ PLy_procedure_call(PLyProcedure * proc, char *kargs, PyObject * vargs) } static PyObject * -PLy_function_build_args(FunctionCallInfo fcinfo, PLyProcedure * proc) +PLy_function_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc) { PyObject *volatile arg = NULL; PyObject *volatile args = NULL; @@ -1060,7 +1064,7 @@ PLy_function_build_args(FunctionCallInfo fcinfo, PLyProcedure * proc) PLy_elog(ERROR, "PyList_SetItem() failed for PL/Python function \"%s\" while setting up arguments", proc->proname); if (proc->argnames && proc->argnames[i] && - PyDict_SetItemString(proc->globals, proc->argnames[i], arg) == -1) + PyDict_SetItemString(proc->globals, proc->argnames[i], arg) == -1) PLy_elog(ERROR, "PyDict_SetItemString() failed for PL/Python function \"%s\" while setting up arguments", proc->proname); arg = NULL; } @@ -1079,7 +1083,7 @@ PLy_function_build_args(FunctionCallInfo fcinfo, PLyProcedure * proc) static void -PLy_function_delete_args(PLyProcedure * proc) +PLy_function_delete_args(PLyProcedure *proc) { int i; @@ -1149,9 +1153,9 @@ PLy_procedure_get(FunctionCallInfo fcinfo, Oid tgreloid) { /* * Input/output conversion for trigger tuples. Use the result - * TypeInfo variable to store the tuple conversion info. We - * do this over again on each call to cover the possibility that - * the relation's tupdesc changed since the trigger was last called. + * TypeInfo variable to store the tuple conversion info. We do this + * over again on each call to cover the possibility that the + * relation's tupdesc changed since the trigger was last called. * PLy_input_tuple_funcs and PLy_output_tuple_funcs are responsible * for not doing repetitive work. */ @@ -1243,8 +1247,8 @@ PLy_procedure_create(HeapTuple procTup, Oid tgreloid, char *key) else ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("PL/Python functions cannot return type %s", - format_type_be(procStruct->prorettype)))); + errmsg("PL/Python functions cannot return type %s", + format_type_be(procStruct->prorettype)))); } if (rvTypeStruct->typtype == TYPTYPE_COMPOSITE) @@ -1264,19 +1268,19 @@ PLy_procedure_create(HeapTuple procTup, Oid tgreloid, char *key) /* * Now get information required for input conversion of the - * procedure's arguments. Note that we ignore output arguments - * here --- since we don't support returning record, and that was - * already checked above, there's no need to worry about multiple - * output arguments. + * procedure's arguments. Note that we ignore output arguments here + * --- since we don't support returning record, and that was already + * checked above, there's no need to worry about multiple output + * arguments. */ if (procStruct->pronargs) { - Oid *types; - char **names, - *modes; - int i, - pos, - total; + Oid *types; + char **names, + *modes; + int i, + pos, + total; /* extract argument type info from the pg_proc tuple */ total = get_func_arg_info(procTup, &types, &names, &modes); @@ -1322,7 +1326,7 @@ PLy_procedure_create(HeapTuple procTup, Oid tgreloid, char *key) /* Disallow pseudotype argument */ ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("PL/Python functions cannot accept type %s", + errmsg("PL/Python functions cannot accept type %s", format_type_be(types[i])))); break; case TYPTYPE_COMPOSITE: @@ -1375,7 +1379,7 @@ PLy_procedure_create(HeapTuple procTup, Oid tgreloid, char *key) } static void -PLy_procedure_compile(PLyProcedure * proc, const char *src) +PLy_procedure_compile(PLyProcedure *proc, const char *src) { PyObject *crv = NULL; char *msrc; @@ -1465,7 +1469,7 @@ PLy_procedure_munge_source(const char *name, const char *src) } static void -PLy_procedure_delete(PLyProcedure * proc) +PLy_procedure_delete(PLyProcedure *proc) { int i; @@ -1498,7 +1502,7 @@ PLy_procedure_delete(PLyProcedure * proc) * PostgreSQL, and vice versa. */ static void -PLy_input_tuple_funcs(PLyTypeInfo * arg, TupleDesc desc) +PLy_input_tuple_funcs(PLyTypeInfo *arg, TupleDesc desc) { int i; @@ -1540,7 +1544,7 @@ PLy_input_tuple_funcs(PLyTypeInfo * arg, TupleDesc desc) } static void -PLy_output_tuple_funcs(PLyTypeInfo * arg, TupleDesc desc) +PLy_output_tuple_funcs(PLyTypeInfo *arg, TupleDesc desc) { int i; @@ -1580,7 +1584,7 @@ PLy_output_tuple_funcs(PLyTypeInfo * arg, TupleDesc desc) } static void -PLy_output_datum_func(PLyTypeInfo * arg, HeapTuple typeTup) +PLy_output_datum_func(PLyTypeInfo *arg, HeapTuple typeTup) { if (arg->is_rowtype > 0) elog(ERROR, "PLyTypeInfo struct is initialized for a Tuple"); @@ -1589,7 +1593,7 @@ PLy_output_datum_func(PLyTypeInfo * arg, HeapTuple typeTup) } static void -PLy_output_datum_func2(PLyObToDatum * arg, HeapTuple typeTup) +PLy_output_datum_func2(PLyObToDatum *arg, HeapTuple typeTup) { Form_pg_type typeStruct = (Form_pg_type) GETSTRUCT(typeTup); @@ -1600,7 +1604,7 @@ PLy_output_datum_func2(PLyObToDatum * arg, HeapTuple typeTup) } static void -PLy_input_datum_func(PLyTypeInfo * arg, Oid typeOid, HeapTuple typeTup) +PLy_input_datum_func(PLyTypeInfo *arg, Oid typeOid, HeapTuple typeTup) { if (arg->is_rowtype > 0) elog(ERROR, "PLyTypeInfo struct is initialized for Tuple"); @@ -1609,7 +1613,7 @@ PLy_input_datum_func(PLyTypeInfo * arg, Oid typeOid, HeapTuple typeTup) } static void -PLy_input_datum_func2(PLyDatumToOb * arg, Oid typeOid, HeapTuple typeTup) +PLy_input_datum_func2(PLyDatumToOb *arg, Oid typeOid, HeapTuple typeTup) { Form_pg_type typeStruct = (Form_pg_type) GETSTRUCT(typeTup); @@ -1644,7 +1648,7 @@ PLy_input_datum_func2(PLyDatumToOb * arg, Oid typeOid, HeapTuple typeTup) } static void -PLy_typeinfo_init(PLyTypeInfo * arg) +PLy_typeinfo_init(PLyTypeInfo *arg) { arg->is_rowtype = -1; arg->in.r.natts = arg->out.r.natts = 0; @@ -1653,7 +1657,7 @@ PLy_typeinfo_init(PLyTypeInfo * arg) } static void -PLy_typeinfo_dealloc(PLyTypeInfo * arg) +PLy_typeinfo_dealloc(PLyTypeInfo *arg) { if (arg->is_rowtype == 1) { @@ -1718,7 +1722,7 @@ PLyString_FromString(const char *src) } static PyObject * -PLyDict_FromTuple(PLyTypeInfo * info, HeapTuple tuple, TupleDesc desc) +PLyDict_FromTuple(PLyTypeInfo *info, HeapTuple tuple, TupleDesc desc) { PyObject *volatile dict; int i; @@ -1775,7 +1779,7 @@ PLyDict_FromTuple(PLyTypeInfo * info, HeapTuple tuple, TupleDesc desc) static HeapTuple -PLyMapping_ToTuple(PLyTypeInfo * info, PyObject * mapping) +PLyMapping_ToTuple(PLyTypeInfo *info, PyObject *mapping) { TupleDesc desc; HeapTuple tuple; @@ -1831,7 +1835,7 @@ PLyMapping_ToTuple(PLyTypeInfo * info, PyObject * mapping) (errcode(ERRCODE_UNDEFINED_COLUMN), errmsg("key \"%s\" not found in mapping", key), errhint("To return null in a column, " - "add the value None to the mapping with the key named after the column."))); + "add the value None to the mapping with the key named after the column."))); Py_XDECREF(value); value = NULL; @@ -1855,7 +1859,7 @@ PLyMapping_ToTuple(PLyTypeInfo * info, PyObject * mapping) static HeapTuple -PLySequence_ToTuple(PLyTypeInfo * info, PyObject * sequence) +PLySequence_ToTuple(PLyTypeInfo *info, PyObject *sequence) { TupleDesc desc; HeapTuple tuple; @@ -1874,7 +1878,7 @@ PLySequence_ToTuple(PLyTypeInfo * info, PyObject * sequence) if (PySequence_Length(sequence) != desc->natts) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("length of returned sequence did not match number of columns in row"))); + errmsg("length of returned sequence did not match number of columns in row"))); if (info->is_rowtype == 2) PLy_output_tuple_funcs(info, desc); @@ -1937,7 +1941,7 @@ PLySequence_ToTuple(PLyTypeInfo * info, PyObject * sequence) static HeapTuple -PLyObject_ToTuple(PLyTypeInfo * info, PyObject * object) +PLyObject_ToTuple(PLyTypeInfo *info, PyObject *object) { TupleDesc desc; HeapTuple tuple; @@ -1990,7 +1994,7 @@ PLyObject_ToTuple(PLyTypeInfo * info, PyObject * object) (errcode(ERRCODE_UNDEFINED_COLUMN), errmsg("attribute \"%s\" does not exist in Python object", key), errhint("To return null in a column, " - "let the returned object have an attribute named " + "let the returned object have an attribute named " "after column with value None."))); Py_XDECREF(value); @@ -2175,7 +2179,7 @@ PLy_plan_new(void) static void -PLy_plan_dealloc(PyObject * arg) +PLy_plan_dealloc(PyObject *arg) { PLyPlanObject *ob = (PLyPlanObject *) arg; @@ -2197,13 +2201,13 @@ PLy_plan_dealloc(PyObject * arg) static PyObject * -PLy_plan_getattr(PyObject * self, char *name) +PLy_plan_getattr(PyObject *self, char *name) { return Py_FindMethod(PLy_plan_methods, self, name); } static PyObject * -PLy_plan_status(PyObject * self, PyObject * args) +PLy_plan_status(PyObject *self, PyObject *args) { if (PyArg_ParseTuple(args, "")) { @@ -2238,7 +2242,7 @@ PLy_result_new(void) } static void -PLy_result_dealloc(PyObject * arg) +PLy_result_dealloc(PyObject *arg) { PLyResultObject *ob = (PLyResultObject *) arg; @@ -2250,13 +2254,13 @@ PLy_result_dealloc(PyObject * arg) } static PyObject * -PLy_result_getattr(PyObject * self, char *name) +PLy_result_getattr(PyObject *self, char *name) { return Py_FindMethod(PLy_result_methods, self, name); } static PyObject * -PLy_result_nrows(PyObject * self, PyObject * args) +PLy_result_nrows(PyObject *self, PyObject *args) { PLyResultObject *ob = (PLyResultObject *) self; @@ -2265,7 +2269,7 @@ PLy_result_nrows(PyObject * self, PyObject * args) } static PyObject * -PLy_result_status(PyObject * self, PyObject * args) +PLy_result_status(PyObject *self, PyObject *args) { PLyResultObject *ob = (PLyResultObject *) self; @@ -2274,7 +2278,7 @@ PLy_result_status(PyObject * self, PyObject * args) } static Py_ssize_t -PLy_result_length(PyObject * arg) +PLy_result_length(PyObject *arg) { PLyResultObject *ob = (PLyResultObject *) arg; @@ -2282,7 +2286,7 @@ PLy_result_length(PyObject * arg) } static PyObject * -PLy_result_item(PyObject * arg, Py_ssize_t idx) +PLy_result_item(PyObject *arg, Py_ssize_t idx) { PyObject *rv; PLyResultObject *ob = (PLyResultObject *) arg; @@ -2294,7 +2298,7 @@ PLy_result_item(PyObject * arg, Py_ssize_t idx) } static int -PLy_result_ass_item(PyObject * arg, Py_ssize_t idx, PyObject * item) +PLy_result_ass_item(PyObject *arg, Py_ssize_t idx, PyObject *item) { int rv; PLyResultObject *ob = (PLyResultObject *) arg; @@ -2305,7 +2309,7 @@ PLy_result_ass_item(PyObject * arg, Py_ssize_t idx, PyObject * item) } static PyObject * -PLy_result_slice(PyObject * arg, Py_ssize_t lidx, Py_ssize_t hidx) +PLy_result_slice(PyObject *arg, Py_ssize_t lidx, Py_ssize_t hidx) { PyObject *rv; PLyResultObject *ob = (PLyResultObject *) arg; @@ -2318,7 +2322,7 @@ PLy_result_slice(PyObject * arg, Py_ssize_t lidx, Py_ssize_t hidx) } static int -PLy_result_ass_slice(PyObject * arg, Py_ssize_t lidx, Py_ssize_t hidx, PyObject * slice) +PLy_result_ass_slice(PyObject *arg, Py_ssize_t lidx, Py_ssize_t hidx, PyObject *slice) { int rv; PLyResultObject *ob = (PLyResultObject *) arg; @@ -2329,7 +2333,7 @@ PLy_result_ass_slice(PyObject * arg, Py_ssize_t lidx, Py_ssize_t hidx, PyObject /* SPI interface */ static PyObject * -PLy_spi_prepare(PyObject * self, PyObject * args) +PLy_spi_prepare(PyObject *self, PyObject *args) { PLyPlanObject *plan; PyObject *list = NULL; @@ -2355,7 +2359,7 @@ PLy_spi_prepare(PyObject * self, PyObject * args) if (list && (!PySequence_Check(list))) { PLy_exception_set(PLy_exc_spi_error, - "second argument of plpy.prepare must be a sequence"); + "second argument of plpy.prepare must be a sequence"); return NULL; } @@ -2470,7 +2474,7 @@ PLy_spi_prepare(PyObject * self, PyObject * args) * execute(plan=plan, values=(foo, bar), limit=5) */ static PyObject * -PLy_spi_execute(PyObject * self, PyObject * args) +PLy_spi_execute(PyObject *self, PyObject *args) { char *query; PyObject *plan; @@ -2498,7 +2502,7 @@ PLy_spi_execute(PyObject * self, PyObject * args) } static PyObject * -PLy_spi_execute_plan(PyObject * ob, PyObject * list, long limit) +PLy_spi_execute_plan(PyObject *ob, PyObject *list, long limit) { volatile int nargs; int i, @@ -2530,8 +2534,8 @@ PLy_spi_execute_plan(PyObject * ob, PyObject * list, long limit) PLy_procedure_name(PLy_curr_procedure)); sv = PyString_AsString(so); PLy_exception_set_plural(PLy_exc_spi_error, - "Expected sequence of %d argument, got %d: %s", - "Expected sequence of %d arguments, got %d: %s", + "Expected sequence of %d argument, got %d: %s", + "Expected sequence of %d arguments, got %d: %s", plan->nargs, plan->nargs, nargs, sv); Py_DECREF(so); @@ -2737,7 +2741,7 @@ PLy_spi_execute_fetch_result(SPITupleTable *tuptable, int rows, int status) FlushErrorState(); if (!PyErr_Occurred()) PLy_exception_set(PLy_exc_error, - "unrecognized error in PLy_spi_execute_fetch_result"); + "unrecognized error in PLy_spi_execute_fetch_result"); Py_DECREF(result); PLy_typeinfo_dealloc(&args); return NULL; @@ -2844,50 +2848,50 @@ PLy_init_plpy(void) static PyObject *PLy_output(volatile int, PyObject *, PyObject *); static PyObject * -PLy_debug(PyObject * self, PyObject * args) +PLy_debug(PyObject *self, PyObject *args) { return PLy_output(DEBUG2, self, args); } static PyObject * -PLy_log(PyObject * self, PyObject * args) +PLy_log(PyObject *self, PyObject *args) { return PLy_output(LOG, self, args); } static PyObject * -PLy_info(PyObject * self, PyObject * args) +PLy_info(PyObject *self, PyObject *args) { return PLy_output(INFO, self, args); } static PyObject * -PLy_notice(PyObject * self, PyObject * args) +PLy_notice(PyObject *self, PyObject *args) { return PLy_output(NOTICE, self, args); } static PyObject * -PLy_warning(PyObject * self, PyObject * args) +PLy_warning(PyObject *self, PyObject *args) { return PLy_output(WARNING, self, args); } static PyObject * -PLy_error(PyObject * self, PyObject * args) +PLy_error(PyObject *self, PyObject *args) { return PLy_output(ERROR, self, args); } static PyObject * -PLy_fatal(PyObject * self, PyObject * args) +PLy_fatal(PyObject *self, PyObject *args) { return PLy_output(FATAL, self, args); } static PyObject * -PLy_output(volatile int level, PyObject * self, PyObject * args) +PLy_output(volatile int level, PyObject *self, PyObject *args) { PyObject *so; char *volatile sv; @@ -2940,7 +2944,7 @@ PLy_output(volatile int level, PyObject * self, PyObject * args) * NB: this returns the SQL name, not the internal Python procedure name */ static char * -PLy_procedure_name(PLyProcedure * proc) +PLy_procedure_name(PLyProcedure *proc) { if (proc == NULL) return "<unknown procedure>"; @@ -2951,7 +2955,7 @@ PLy_procedure_name(PLyProcedure * proc) * Call PyErr_SetString with a vprint interface and translation support */ static void -PLy_exception_set(PyObject * exc, const char *fmt,...) +PLy_exception_set(PyObject *exc, const char *fmt,...) { char buf[1024]; va_list ap; diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c index 6b30e9973d..2e8db71275 100644 --- a/src/pl/tcl/pltcl.c +++ b/src/pl/tcl/pltcl.c @@ -2,7 +2,7 @@ * pltcl.c - PostgreSQL support for Tcl as * procedural language (PL) * - * $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.127 2009/01/21 11:13:14 heikki Exp $ + * $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.128 2009/06/11 14:49:14 momjian Exp $ * **********************************************************************/ @@ -672,7 +672,7 @@ pltcl_func_handler(PG_FUNCTION_ARGS) { UTF_BEGIN; retval = InputFunctionCall(&prodesc->result_in_func, - UTF_U2E((char *) Tcl_GetStringResult(interp)), + UTF_U2E((char *) Tcl_GetStringResult(interp)), prodesc->result_typioparam, -1); UTF_END; @@ -1009,10 +1009,10 @@ throw_tcl_error(Tcl_Interp *interp, const char *proname) { /* * Caution is needed here because Tcl_GetVar could overwrite the - * interpreter result (even though it's not really supposed to), - * and we can't control the order of evaluation of ereport arguments. - * Hence, make real sure we have our own copy of the result string - * before invoking Tcl_GetVar. + * interpreter result (even though it's not really supposed to), and we + * can't control the order of evaluation of ereport arguments. Hence, make + * real sure we have our own copy of the result string before invoking + * Tcl_GetVar. */ char *emsg; char *econtext; @@ -1210,7 +1210,7 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid) free(prodesc); ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("PL/Tcl functions cannot return composite types"))); + errmsg("PL/Tcl functions cannot return composite types"))); } perm_fmgr_info(typeStruct->typinput, &(prodesc->result_in_func)); @@ -1416,19 +1416,19 @@ pltcl_elog(ClientData cdata, Tcl_Interp *interp, if (level == ERROR) { /* - * We just pass the error back to Tcl. If it's not caught, - * it'll eventually get converted to a PG error when we reach - * the call handler. + * We just pass the error back to Tcl. If it's not caught, it'll + * eventually get converted to a PG error when we reach the call + * handler. */ Tcl_SetResult(interp, (char *) argv[2], TCL_VOLATILE); return TCL_ERROR; } /* - * For non-error messages, just pass 'em to elog(). We do not expect - * that this will fail, but just on the off chance it does, report the - * error back to Tcl. Note we are assuming that elog() can't have any - * internal failures that are so bad as to require a transaction abort. + * For non-error messages, just pass 'em to elog(). We do not expect that + * this will fail, but just on the off chance it does, report the error + * back to Tcl. Note we are assuming that elog() can't have any internal + * failures that are so bad as to require a transaction abort. * * This path is also used for FATAL errors, which aren't going to come * back to us at all. diff --git a/src/port/crypt.c b/src/port/crypt.c index 7139ecf3d1..920ab932a5 100644 --- a/src/port/crypt.c +++ b/src/port/crypt.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/port/crypt.c,v 1.15 2006/03/11 04:38:40 momjian Exp $ */ +/* $PostgreSQL: pgsql/src/port/crypt.c,v 1.16 2009/06/11 14:49:15 momjian Exp $ */ /* $NetBSD: crypt.c,v 1.18 2001/03/01 14:37:35 wiz Exp $ */ /* @@ -236,7 +236,7 @@ typedef union #if defined(B64) B64 b64; #endif -} C_block; +} C_block; /* * Convert twenty-four-bit long in host-order diff --git a/src/port/dirmod.c b/src/port/dirmod.c index 5bda09b92c..a31e74cbd3 100644 --- a/src/port/dirmod.c +++ b/src/port/dirmod.c @@ -10,7 +10,7 @@ * Win32 (NT4 and newer). * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/dirmod.c,v 1.57 2009/05/04 09:30:06 mha Exp $ + * $PostgreSQL: pgsql/src/port/dirmod.c,v 1.58 2009/06/11 14:49:15 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -195,7 +195,7 @@ typedef struct WORD PrintNameOffset; WORD PrintNameLength; WCHAR PathBuffer[1]; -} REPARSE_JUNCTION_DATA_BUFFER; +} REPARSE_JUNCTION_DATA_BUFFER; #define REPARSE_JUNCTION_DATA_BUFFER_HEADER_SIZE \ FIELD_OFFSET(REPARSE_JUNCTION_DATA_BUFFER, SubstituteNameOffset) @@ -260,7 +260,7 @@ pgsymlink(const char *oldpath, const char *newpath) FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), - (LPSTR) & msg, 0, NULL); + (LPSTR) &msg, 0, NULL); #ifndef FRONTEND ereport(ERROR, (errcode_for_file_access(), @@ -291,7 +291,7 @@ pgsymlink(const char *oldpath, const char *newpath) * must call pgfnames_cleanup later to free the memory allocated by this * function. */ -char ** +char ** pgfnames(const char *path) { DIR *dir; @@ -412,11 +412,11 @@ rmtree(const char *path, bool rmtopdir) * delete it anyway. * * This is not an academic possibility. One scenario where this - * happens is when bgwriter has a pending unlink request for a file - * in a database that's being dropped. In dropdb(), we call + * happens is when bgwriter has a pending unlink request for a file in + * a database that's being dropped. In dropdb(), we call * ForgetDatabaseFsyncRequests() to flush out any such pending unlink - * requests, but because that's asynchronous, it's not guaranteed - * that the bgwriter receives the message in time. + * requests, but because that's asynchronous, it's not guaranteed that + * the bgwriter receives the message in time. */ if (lstat(pathbuf, &statbuf) != 0) { @@ -492,10 +492,10 @@ rmtree(const char *path, bool rmtopdir) * field when run. So we define our own version that uses the Win32 API * to update this field. */ -int -pgwin32_safestat(const char *path, struct stat *buf) +int +pgwin32_safestat(const char *path, struct stat * buf) { - int r; + int r; WIN32_FILE_ATTRIBUTE_DATA attr; r = stat(path, buf); @@ -509,8 +509,8 @@ pgwin32_safestat(const char *path, struct stat *buf) } /* - * XXX no support for large files here, but we don't do that in - * general on Win32 yet. + * XXX no support for large files here, but we don't do that in general on + * Win32 yet. */ buf->st_size = attr.nFileSizeLow; diff --git a/src/port/exec.c b/src/port/exec.c index f508777b57..dde509eeeb 100644 --- a/src/port/exec.c +++ b/src/port/exec.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/exec.c,v 1.62 2009/01/01 17:24:04 momjian Exp $ + * $PostgreSQL: pgsql/src/port/exec.c,v 1.63 2009/06/11 14:49:15 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -56,7 +56,7 @@ static int resolve_symlinks(char *path); static char *pipe_read_line(char *cmd, char *line, int maxsize); #ifdef WIN32 -static BOOL GetUserSid(PSID * ppSidUser, HANDLE hToken); +static BOOL GetUserSid(PSID *ppSidUser, HANDLE hToken); #endif /* @@ -736,7 +736,7 @@ AddUserToDacl(HANDLE hProcess) } /* Get the ACL info */ - if (!GetAclInformation(ptdd->DefaultDacl, (LPVOID) & asi, + if (!GetAclInformation(ptdd->DefaultDacl, (LPVOID) &asi, (DWORD) sizeof(ACL_SIZE_INFORMATION), AclSizeInformation)) { @@ -752,7 +752,7 @@ AddUserToDacl(HANDLE hProcess) } /* Figure out the size of the new ACL */ - dwNewAclSize = asi.AclBytesInUse + sizeof(ACCESS_ALLOWED_ACE) + GetLengthSid(psidUser) - sizeof(DWORD); + dwNewAclSize = asi.AclBytesInUse + sizeof(ACCESS_ALLOWED_ACE) + GetLengthSid(psidUser) -sizeof(DWORD); /* Allocate the ACL buffer & initialize it */ pacl = (PACL) LocalAlloc(LPTR, dwNewAclSize); @@ -771,7 +771,7 @@ AddUserToDacl(HANDLE hProcess) /* Loop through the existing ACEs, and build the new ACL */ for (i = 0; i < (int) asi.AceCount; i++) { - if (!GetAce(ptdd->DefaultDacl, i, (LPVOID *) & pace)) + if (!GetAce(ptdd->DefaultDacl, i, (LPVOID *) &pace)) { log_error("could not get ACE: %lu", GetLastError()); goto cleanup; @@ -794,7 +794,7 @@ AddUserToDacl(HANDLE hProcess) /* Set the new DACL in the token */ tddNew.DefaultDacl = pacl; - if (!SetTokenInformation(hToken, tic, (LPVOID) & tddNew, dwNewAclSize)) + if (!SetTokenInformation(hToken, tic, (LPVOID) &tddNew, dwNewAclSize)) { log_error("could not set token information: %lu", GetLastError()); goto cleanup; @@ -824,7 +824,7 @@ cleanup: * Get the SID for the current user */ static BOOL -GetUserSid(PSID * ppSidUser, HANDLE hToken) +GetUserSid(PSID *ppSidUser, HANDLE hToken) { DWORD dwLength; PTOKEN_USER pTokenUser = NULL; diff --git a/src/port/getopt.c b/src/port/getopt.c index 1c1ba8e1a8..ed7f421a47 100644 --- a/src/port/getopt.c +++ b/src/port/getopt.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/port/getopt.c,v 1.13 2009/04/04 22:36:11 tgl Exp $ */ +/* $PostgreSQL: pgsql/src/port/getopt.c,v 1.14 2009/06/11 14:49:15 momjian Exp $ */ /* This is used by psql under Win32 */ @@ -49,14 +49,12 @@ int opterr = 1, /* if error message should be printed */ optind = 1, /* index into parent argv vector */ optopt; /* character checked for validity */ char *optarg; /* argument associated with option */ - #else extern int opterr; extern int optind; extern int optopt; extern char *optarg; - #endif #ifndef HAVE_INT_OPTRESET diff --git a/src/port/getopt_long.c b/src/port/getopt_long.c index 504e989f02..9433b56827 100644 --- a/src/port/getopt_long.c +++ b/src/port/getopt_long.c @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/src/port/getopt_long.c,v 1.7 2009/04/05 04:19:59 tgl Exp $ + * $PostgreSQL: pgsql/src/port/getopt_long.c,v 1.8 2009/06/11 14:49:15 momjian Exp $ */ #include "c.h" @@ -40,6 +40,7 @@ #ifndef HAVE_INT_OPTRESET int optreset; + /* else the "extern" was provided by getopt_long.h */ #endif diff --git a/src/port/getrusage.c b/src/port/getrusage.c index c4311647e8..0db4aeddef 100644 --- a/src/port/getrusage.c +++ b/src/port/getrusage.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/getrusage.c,v 1.16 2009/01/01 17:24:04 momjian Exp $ + * $PostgreSQL: pgsql/src/port/getrusage.c,v 1.17 2009/06/11 14:49:15 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -47,7 +47,7 @@ getrusage(int who, struct rusage * rusage) errno = EINVAL; return -1; } - + if (rusage == (struct rusage *) NULL) { errno = EFAULT; diff --git a/src/port/open.c b/src/port/open.c index a0c4797108..b9dc8d0d20 100644 --- a/src/port/open.c +++ b/src/port/open.c @@ -6,7 +6,7 @@ * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/port/open.c,v 1.27 2009/01/01 17:24:04 momjian Exp $ + * $PostgreSQL: pgsql/src/port/open.c,v 1.28 2009/06/11 14:49:15 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -82,24 +82,25 @@ pgwin32_open(const char *fileName, int fileFlags,...) ((fileFlags & O_WRONLY) ? GENERIC_WRITE : GENERIC_READ), /* These flags allow concurrent rename/unlink */ (FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE), - &sa, - openFlagsToCreateFileFlags(fileFlags), - FILE_ATTRIBUTE_NORMAL | + &sa, + openFlagsToCreateFileFlags(fileFlags), + FILE_ATTRIBUTE_NORMAL | ((fileFlags & O_RANDOM) ? FILE_FLAG_RANDOM_ACCESS : 0) | ((fileFlags & O_SEQUENTIAL) ? FILE_FLAG_SEQUENTIAL_SCAN : 0) | ((fileFlags & _O_SHORT_LIVED) ? FILE_ATTRIBUTE_TEMPORARY : 0) | ((fileFlags & O_TEMPORARY) ? FILE_FLAG_DELETE_ON_CLOSE : 0) | ((fileFlags & O_DIRECT) ? FILE_FLAG_NO_BUFFERING : 0) | - ((fileFlags & O_DSYNC) ? FILE_FLAG_WRITE_THROUGH : 0), - NULL)) == INVALID_HANDLE_VALUE) + ((fileFlags & O_DSYNC) ? FILE_FLAG_WRITE_THROUGH : 0), + NULL)) == INVALID_HANDLE_VALUE) { /* * Sharing violation or locking error can indicate antivirus, backup - * or similar software that's locking the file. Try again for 30 seconds - * before giving up. + * or similar software that's locking the file. Try again for 30 + * seconds before giving up. */ - DWORD err = GetLastError(); - if (err == ERROR_SHARING_VIOLATION || + DWORD err = GetLastError(); + + if (err == ERROR_SHARING_VIOLATION || err == ERROR_LOCK_VIOLATION) { pg_usleep(100000); @@ -108,10 +109,10 @@ pgwin32_open(const char *fileName, int fileFlags,...) #ifndef FRONTEND if (loops == 50) ereport(LOG, - (errmsg("could not open file \"%s\": %s", fileName, - (err == ERROR_SHARING_VIOLATION)?_("sharing violation"):_("lock violation")), - errdetail("Continuing to retry for 30 seconds."), - errhint("You might have antivirus, backup, or similar software interfering with the database system."))); + (errmsg("could not open file \"%s\": %s", fileName, + (err == ERROR_SHARING_VIOLATION) ? _("sharing violation") : _("lock violation")), + errdetail("Continuing to retry for 30 seconds."), + errhint("You might have antivirus, backup, or similar software interfering with the database system."))); #endif if (loops < 300) diff --git a/src/port/path.c b/src/port/path.c index 7aa39c3195..3fc1ef33b5 100644 --- a/src/port/path.c +++ b/src/port/path.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/path.c,v 1.78 2009/04/03 23:27:17 tgl Exp $ + * $PostgreSQL: pgsql/src/port/path.c,v 1.79 2009/06/11 14:49:15 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -432,7 +432,7 @@ dir_strcmp(const char *s1, const char *s2) #ifndef WIN32 *s1 != *s2 #else - /* On windows, paths are case-insensitive */ + /* On windows, paths are case-insensitive */ pg_tolower((unsigned char) *s1) != pg_tolower((unsigned char) *s2) #endif && !(IS_DIR_SEP(*s1) && IS_DIR_SEP(*s2))) diff --git a/src/port/pipe.c b/src/port/pipe.c index a3bbbcab4f..a6df1a4ee1 100644 --- a/src/port/pipe.c +++ b/src/port/pipe.c @@ -10,7 +10,7 @@ * must be replaced with recv/send. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/pipe.c,v 1.14 2009/01/01 17:24:04 momjian Exp $ + * $PostgreSQL: pgsql/src/port/pipe.c,v 1.15 2009/06/11 14:49:15 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -37,7 +37,7 @@ pgpipe(int handles[2]) serv_addr.sin_family = AF_INET; serv_addr.sin_port = htons(0); serv_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - if (bind(s, (SOCKADDR *) & serv_addr, len) == SOCKET_ERROR) + if (bind(s, (SOCKADDR *) &serv_addr, len) == SOCKET_ERROR) { ereport(LOG, (errmsg_internal("pgpipe failed to bind: %ui", WSAGetLastError()))); closesocket(s); @@ -49,7 +49,7 @@ pgpipe(int handles[2]) closesocket(s); return -1; } - if (getsockname(s, (SOCKADDR *) & serv_addr, &len) == SOCKET_ERROR) + if (getsockname(s, (SOCKADDR *) &serv_addr, &len) == SOCKET_ERROR) { ereport(LOG, (errmsg_internal("pgpipe failed to getsockname: %ui", WSAGetLastError()))); closesocket(s); @@ -62,13 +62,13 @@ pgpipe(int handles[2]) return -1; } - if (connect(handles[1], (SOCKADDR *) & serv_addr, len) == SOCKET_ERROR) + if (connect(handles[1], (SOCKADDR *) &serv_addr, len) == SOCKET_ERROR) { ereport(LOG, (errmsg_internal("pgpipe failed to connect socket: %ui", WSAGetLastError()))); closesocket(s); return -1; } - if ((handles[0] = accept(s, (SOCKADDR *) & serv_addr, &len)) == INVALID_SOCKET) + if ((handles[0] = accept(s, (SOCKADDR *) &serv_addr, &len)) == INVALID_SOCKET) { ereport(LOG, (errmsg_internal("pgpipe failed to accept socket: %ui", WSAGetLastError()))); closesocket(handles[1]); diff --git a/src/port/pthread-win32.h b/src/port/pthread-win32.h index e8e4a559ce..799637345d 100644 --- a/src/port/pthread-win32.h +++ b/src/port/pthread-win32.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/port/pthread-win32.h,v 1.5 2008/05/21 14:20:48 mha Exp $ + * $PostgreSQL: pgsql/src/port/pthread-win32.h,v 1.6 2009/06/11 14:49:15 momjian Exp $ */ #ifndef __PTHREAD_H #define __PTHREAD_H diff --git a/src/port/rand.c b/src/port/rand.c index c9a966c9eb..8559ef8c17 100644 --- a/src/port/rand.c +++ b/src/port/rand.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/port/rand.c,v 1.5 2008/05/17 01:28:25 adunstan Exp $ + * $PostgreSQL: pgsql/src/port/rand.c,v 1.6 2009/06/11 14:49:15 momjian Exp $ * *------------------------------------------------------------------------- * diff --git a/src/port/strlcat.c b/src/port/strlcat.c index 9099b45c5f..cab2e9adf7 100644 --- a/src/port/strlcat.c +++ b/src/port/strlcat.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/port/strlcat.c,v 1.3 2008/05/17 01:28:25 adunstan Exp $ + * $PostgreSQL: pgsql/src/port/strlcat.c,v 1.4 2009/06/11 14:49:15 momjian Exp $ * * $OpenBSD: strlcat.c,v 1.13 2005/08/08 08:05:37 espie Exp $ */ diff --git a/src/port/strtol.c b/src/port/strtol.c index f9d28f8d0e..d48c896992 100644 --- a/src/port/strtol.c +++ b/src/port/strtol.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/port/strtol.c,v 1.16 2009/01/01 17:24:04 momjian Exp $ + * $PostgreSQL: pgsql/src/port/strtol.c,v 1.17 2009/06/11 14:49:15 momjian Exp $ * * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group diff --git a/src/port/strtoul.c b/src/port/strtoul.c index 8ac6618655..18f04ac179 100644 --- a/src/port/strtoul.c +++ b/src/port/strtoul.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/port/strtoul.c,v 1.4 2008/05/17 01:28:25 adunstan Exp $ + * $PostgreSQL: pgsql/src/port/strtoul.c,v 1.5 2009/06/11 14:49:15 momjian Exp $ * * * Copyright (c) 1990, 1993 diff --git a/src/port/win32env.c b/src/port/win32env.c index 36888286b7..9a32387337 100644 --- a/src/port/win32env.c +++ b/src/port/win32env.c @@ -1,16 +1,16 @@ /*------------------------------------------------------------------------- * * win32env.c - * putenv() and unsetenv() for win32, that updates both process - * environment and the cached versions in (potentially multiple) - * MSVCRT. + * putenv() and unsetenv() for win32, that updates both process + * environment and the cached versions in (potentially multiple) + * MSVCRT. * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/win32env.c,v 1.2 2009/02/12 12:53:34 mha Exp $ + * $PostgreSQL: pgsql/src/port/win32env.c,v 1.3 2009/06/11 14:49:15 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -20,41 +20,41 @@ int pgwin32_putenv(const char *envval) { - char *envcpy; - char *cp; + char *envcpy; + char *cp; /* * Each version of MSVCRT has its own _putenv() call in the runtime * library. * - * If we're in VC 7.0 or later (means != mingw), update in - * the 6.0 MSVCRT.DLL environment as well, to work with third party - * libraries linked against it (such as gnuwin32 libraries). + * If we're in VC 7.0 or later (means != mingw), update in the 6.0 + * MSVCRT.DLL environment as well, to work with third party libraries + * linked against it (such as gnuwin32 libraries). */ #if defined(_MSC_VER) && (_MSC_VER >= 1300) - typedef int (_cdecl *PUTENVPROC)(const char *); - HMODULE hmodule; - static PUTENVPROC putenvFunc = NULL; - int ret; + typedef int (_cdecl * PUTENVPROC) (const char *); + HMODULE hmodule; + static PUTENVPROC putenvFunc = NULL; + int ret; if (putenvFunc == NULL) { hmodule = GetModuleHandle("msvcrt"); if (hmodule == NULL) return 1; - putenvFunc = (PUTENVPROC)GetProcAddress(hmodule, "_putenv"); + putenvFunc = (PUTENVPROC) GetProcAddress(hmodule, "_putenv"); if (putenvFunc == NULL) return 1; } ret = putenvFunc(envval); if (ret != 0) return ret; -#endif /* _MSC_VER >= 1300 */ +#endif /* _MSC_VER >= 1300 */ /* - * Update the process environment - to make modifications visible - * to child processes. + * Update the process environment - to make modifications visible to child + * processes. * * Need a copy of the string so we can modify it. */ @@ -68,8 +68,8 @@ pgwin32_putenv(const char *envval) { /* * Only call SetEnvironmentVariable() when we are adding a variable, - * not when removing it. Calling it on both crashes on at least certain - * versions of MingW. + * not when removing it. Calling it on both crashes on at least + * certain versions of MingW. */ if (!SetEnvironmentVariable(envcpy, cp)) { @@ -86,9 +86,9 @@ pgwin32_putenv(const char *envval) void pgwin32_unsetenv(const char *name) { - char *envbuf; + char *envbuf; - envbuf = (char *) malloc(strlen(name)+2); + envbuf = (char *) malloc(strlen(name) + 2); if (!envbuf) return; @@ -96,4 +96,3 @@ pgwin32_unsetenv(const char *name) pgwin32_putenv(envbuf); free(envbuf); } - diff --git a/src/test/examples/testlibpq.c b/src/test/examples/testlibpq.c index b27d4186f6..eed7617835 100644 --- a/src/test/examples/testlibpq.c +++ b/src/test/examples/testlibpq.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/test/examples/testlibpq.c,v 1.17 2008/05/17 01:28:25 adunstan Exp $ + * $PostgreSQL: pgsql/src/test/examples/testlibpq.c,v 1.18 2009/06/11 14:49:15 momjian Exp $ * * * testlibpq.c diff --git a/src/test/examples/testlibpq2.c b/src/test/examples/testlibpq2.c index 8500f50b8e..37c94f45a4 100644 --- a/src/test/examples/testlibpq2.c +++ b/src/test/examples/testlibpq2.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/test/examples/testlibpq2.c,v 1.14 2008/05/17 01:28:26 adunstan Exp $ + * $PostgreSQL: pgsql/src/test/examples/testlibpq2.c,v 1.15 2009/06/11 14:49:15 momjian Exp $ * * * testlibpq2.c @@ -103,7 +103,7 @@ main(int argc, char **argv) break; /* shouldn't happen */ FD_ZERO(&input_mask); - FD_SET(sock, &input_mask); + FD_SET (sock, &input_mask); if (select(sock + 1, &input_mask, NULL, NULL, NULL) < 0) { diff --git a/src/test/examples/testlibpq3.c b/src/test/examples/testlibpq3.c index 0e9f9e8b51..ef573802a5 100644 --- a/src/test/examples/testlibpq3.c +++ b/src/test/examples/testlibpq3.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/test/examples/testlibpq3.c,v 1.15 2008/05/17 01:28:26 adunstan Exp $ + * $PostgreSQL: pgsql/src/test/examples/testlibpq3.c,v 1.16 2009/06/11 14:49:15 momjian Exp $ * * * testlibpq3.c diff --git a/src/test/examples/testlibpq4.c b/src/test/examples/testlibpq4.c index 8db0ac5e06..a2935e895f 100644 --- a/src/test/examples/testlibpq4.c +++ b/src/test/examples/testlibpq4.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/test/examples/testlibpq4.c,v 1.13 2008/05/17 01:28:26 adunstan Exp $ + * $PostgreSQL: pgsql/src/test/examples/testlibpq4.c,v 1.14 2009/06/11 14:49:15 momjian Exp $ * * * testlibpq4.c diff --git a/src/test/locale/test-ctype.c b/src/test/locale/test-ctype.c index 904bed32ce..08b491e4e7 100644 --- a/src/test/locale/test-ctype.c +++ b/src/test/locale/test-ctype.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/test/locale/test-ctype.c,v 1.5 2008/05/17 01:28:26 adunstan Exp $ + * $PostgreSQL: pgsql/src/test/locale/test-ctype.c,v 1.6 2009/06/11 14:49:15 momjian Exp $ */ /* diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index b51d6ec2b5..a2bc0af1a3 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.62 2009/04/23 00:23:46 tgl Exp $ + * $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.63 2009/06/11 14:49:15 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -126,7 +126,7 @@ psql_command(const char *database, const char *query,...) __attribute__((format(printf, 2, 3))); #ifdef WIN32 -typedef BOOL(WINAPI * __CreateRestrictedToken) (HANDLE, DWORD, DWORD, PSID_AND_ATTRIBUTES, DWORD, PLUID_AND_ATTRIBUTES, DWORD, PSID_AND_ATTRIBUTES, PHANDLE); +typedef BOOL (WINAPI * __CreateRestrictedToken) (HANDLE, DWORD, DWORD, PSID_AND_ATTRIBUTES, DWORD, PLUID_AND_ATTRIBUTES, DWORD, PSID_AND_ATTRIBUTES, PHANDLE); /* Windows API define missing from MingW headers */ #define DISABLE_MAX_PRIVILEGE 0x1 @@ -285,7 +285,7 @@ stop_postmaster(void) { fprintf(stderr, _("\n%s: could not stop postmaster: exit code was %d\n"), progname, r); - exit(2); /* not exit_nicely(), that would be recursive */ + exit(2); /* not exit_nicely(), that would be recursive */ } postmaster_running = false; @@ -407,7 +407,7 @@ convert_sourcefiles_in(char *source_subdir, char *dest_subdir, char *suffix) { char testtablespace[MAXPGPATH]; char indir[MAXPGPATH]; - struct stat st; + struct stat st; int ret; char **name; char **names; @@ -420,8 +420,8 @@ convert_sourcefiles_in(char *source_subdir, char *dest_subdir, char *suffix) if (ret != 0 || !S_ISDIR(st.st_mode)) { /* - * No warning, to avoid noise in tests that do not have - * these directories; for example, ecpg, contrib and src/pl. + * No warning, to avoid noise in tests that do not have these + * directories; for example, ecpg, contrib and src/pl. */ return; } @@ -434,11 +434,12 @@ convert_sourcefiles_in(char *source_subdir, char *dest_subdir, char *suffix) snprintf(testtablespace, MAXPGPATH, "%s/testtablespace", outputdir); #ifdef WIN32 + /* * On Windows only, clean out the test tablespace dir, or create it if it - * doesn't exist. On other platforms we expect the Makefile to take - * care of that. (We don't migrate that functionality in here because - * it'd be harder to cope with platform-specific issues such as SELinux.) + * doesn't exist. On other platforms we expect the Makefile to take care + * of that. (We don't migrate that functionality in here because it'd be + * harder to cope with platform-specific issues such as SELinux.) * * XXX it would be better if pg_regress.c had nothing at all to do with * testtablespace, and this were handled by a .BAT file or similar on @@ -704,10 +705,10 @@ initialize_environment(void) } /* - * Set translation-related settings to English; otherwise psql - * will produce translated messages and produce diffs. (XXX If we - * ever support translation of pg_regress, this needs to be moved - * elsewhere, where psql is actually called.) + * Set translation-related settings to English; otherwise psql will + * produce translated messages and produce diffs. (XXX If we ever support + * translation of pg_regress, this needs to be moved elsewhere, where psql + * is actually called.) */ unsetenv("LANGUAGE"); unsetenv("LC_ALL"); @@ -728,14 +729,14 @@ initialize_environment(void) putenv("PGDATESTYLE=Postgres, MDY"); /* - * Likewise set intervalstyle to ensure consistent results. This is a - * bit more painful because we must use PGOPTIONS, and we want to preserve - * the user's ability to set other variables through that. + * Likewise set intervalstyle to ensure consistent results. This is a bit + * more painful because we must use PGOPTIONS, and we want to preserve the + * user's ability to set other variables through that. */ { const char *my_pgoptions = "-c intervalstyle=postgres_verbose"; const char *old_pgoptions = getenv("PGOPTIONS"); - char *new_pgoptions; + char *new_pgoptions; if (!old_pgoptions) old_pgoptions = ""; @@ -1021,16 +1022,16 @@ spawn_process(const char *cmdline) sprintf(cmdline2, "cmd /c %s", cmdline); if (!CreateProcessAsUser(restrictedToken, - NULL, - cmdline2, - NULL, - NULL, - TRUE, - CREATE_SUSPENDED, - NULL, - NULL, - &si, - &pi)) + NULL, + cmdline2, + NULL, + NULL, + TRUE, + CREATE_SUSPENDED, + NULL, + NULL, + &si, + &pi)) { fprintf(stderr, _("could not start process for \"%s\": %lu\n"), cmdline2, GetLastError()); @@ -1043,7 +1044,7 @@ spawn_process(const char *cmdline) free(cmdline2); - ResumeThread(pi.hThread); + ResumeThread(pi.hThread); CloseHandle(pi.hThread); return pi.hProcess; #endif @@ -1328,7 +1329,7 @@ results_differ(const char *testname, const char *resultsfile, const char *defaul * Note: it's OK to scribble on the pids array, but not on the names array */ static void -wait_for_tests(PID_TYPE *pids, int *statuses, char **names, int num_tests) +wait_for_tests(PID_TYPE * pids, int *statuses, char **names, int num_tests) { int tests_left; int i; @@ -1346,6 +1347,7 @@ wait_for_tests(PID_TYPE *pids, int *statuses, char **names, int num_tests) #ifndef WIN32 int exit_status; + p = wait(&exit_status); if (p == INVALID_PID) @@ -1808,13 +1810,13 @@ create_role(const char *rolename, const _stringlist * granted_dbs) static char * make_absolute_path(const char *in) { - char *result; + char *result; if (is_absolute_path(in)) result = strdup(in); else { - static char cwdbuf[MAXPGPATH]; + static char cwdbuf[MAXPGPATH]; if (!cwdbuf[0]) { @@ -2013,10 +2015,11 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc } if (temp_install && !port_specified_by_user) + /* - * To reduce chances of interference with parallel - * installations, use a port number starting in the private - * range (49152-65535) calculated from the version number. + * To reduce chances of interference with parallel installations, use + * a port number starting in the private range (49152-65535) + * calculated from the version number. */ port = 0xC000 | (PG_VERSION_NUM & 0x3FFF); @@ -2095,12 +2098,12 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc } /* - * Adjust the default postgresql.conf as needed for regression testing. - * The user can specify a file to be appended; in any case we set - * max_prepared_transactions to enable testing of prepared xacts. + * Adjust the default postgresql.conf as needed for regression + * testing. The user can specify a file to be appended; in any case we + * set max_prepared_transactions to enable testing of prepared xacts. * (Note: to reduce the probability of unexpected shmmax failures, - * don't set max_prepared_transactions any higher than actually - * needed by the prepared_xacts regression test.) + * don't set max_prepared_transactions any higher than actually needed + * by the prepared_xacts regression test.) */ snprintf(buf, sizeof(buf), "%s/data/postgresql.conf", temp_install); pg_conf = fopen(buf, "a"); @@ -2152,7 +2155,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc exit_nicely(2); } - fprintf(stderr, _("port %d apparently in use, trying %d\n"), port, port+1); + fprintf(stderr, _("port %d apparently in use, trying %d\n"), port, port + 1); port++; sprintf(s, "%d", port); doputenv("PGPORT", s); diff --git a/src/test/regress/pg_regress_main.c b/src/test/regress/pg_regress_main.c index 8434534cab..e068792eb3 100644 --- a/src/test/regress/pg_regress_main.c +++ b/src/test/regress/pg_regress_main.c @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/test/regress/pg_regress_main.c,v 1.5 2009/01/01 17:24:04 momjian Exp $ + * $PostgreSQL: pgsql/src/test/regress/pg_regress_main.c,v 1.6 2009/06/11 14:49:15 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -35,10 +35,10 @@ psql_start_test(const char *testname, char psql_cmd[MAXPGPATH * 3]; /* - * Look for files in the output dir first, consistent with a vpath - * search. This is mainly to create more reasonable error - * messages if the file is not found. It also allows local test - * overrides when running pg_regress outside of the source tree. + * Look for files in the output dir first, consistent with a vpath search. + * This is mainly to create more reasonable error messages if the file is + * not found. It also allows local test overrides when running pg_regress + * outside of the source tree. */ snprintf(infile, sizeof(infile), "%s/sql/%s.sql", outputdir, testname); diff --git a/src/timezone/localtime.c b/src/timezone/localtime.c index 2efa3ecc0e..869b446209 100644 --- a/src/timezone/localtime.c +++ b/src/timezone/localtime.c @@ -3,7 +3,7 @@ * 1996-06-05 by Arthur David Olson. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/timezone/localtime.c,v 1.20 2008/02/16 21:16:04 tgl Exp $ + * $PostgreSQL: pgsql/src/timezone/localtime.c,v 1.21 2009/06/11 14:49:15 momjian Exp $ */ /* @@ -77,7 +77,7 @@ struct rule static long detzcode(const char *codep); static pg_time_t detzcode64(const char *codep); -static int differ_by_repeat(pg_time_t t1, pg_time_t t0); +static int differ_by_repeat(pg_time_t t1, pg_time_t t0); static const char *getzname(const char *strp); static const char *getqzname(const char *strp, int delim); static const char *getnum(const char *strp, int *nump, int min, int max); @@ -85,16 +85,16 @@ static const char *getsecs(const char *strp, long *secsp); static const char *getoffset(const char *strp, long *offsetp); static const char *getrule(const char *strp, struct rule * rulep); static void gmtload(struct state * sp); -static struct pg_tm *gmtsub(const pg_time_t *timep, long offset, - struct pg_tm *tmp); -static struct pg_tm *localsub(const pg_time_t *timep, long offset, - struct pg_tm *tmp, const pg_tz *tz); -static int increment_overflow(int *number, int delta); +static struct pg_tm *gmtsub(const pg_time_t *timep, long offset, + struct pg_tm * tmp); +static struct pg_tm *localsub(const pg_time_t *timep, long offset, + struct pg_tm * tmp, const pg_tz *tz); +static int increment_overflow(int *number, int delta); static pg_time_t transtime(pg_time_t janfirst, int year, - const struct rule *rulep, long offset); -static int typesequiv(const struct state *sp, int a, int b); + const struct rule * rulep, long offset); +static int typesequiv(const struct state * sp, int a, int b); static struct pg_tm *timesub(const pg_time_t *timep, long offset, - const struct state *sp, struct pg_tm *tmp); + const struct state * sp, struct pg_tm * tmp); /* GMT timezone */ static struct state gmtmem; @@ -130,10 +130,10 @@ detzcode(const char *codep) static pg_time_t detzcode64(const char *codep) { - pg_time_t result; - int i; + pg_time_t result; + int i; - result = (codep[0] & 0x80) ? (~(int64) 0) : 0; + result = (codep[0] & 0x80) ? (~(int64) 0) : 0; for (i = 0; i < 8; ++i) result = result * 256 + (codep[i] & 0xff); return result; @@ -143,7 +143,7 @@ static int differ_by_repeat(pg_time_t t1, pg_time_t t0) { if (TYPE_INTEGRAL(pg_time_t) && - TYPE_BIT(pg_time_t) - TYPE_SIGNED(pg_time_t) < SECSPERREPEAT_BITS) + TYPE_BIT(pg_time_t) -TYPE_SIGNED(pg_time_t) <SECSPERREPEAT_BITS) return 0; return t1 - t0 == SECSPERREPEAT; } @@ -160,9 +160,9 @@ tzload(const char *name, char *canonname, struct state * sp, int doextend) { struct tzhead tzhead; char buf[2 * sizeof(struct tzhead) + - 2 * sizeof *sp + - 4 * TZ_MAX_TIMES]; - } u; + 2 * sizeof *sp + + 4 * TZ_MAX_TIMES]; + } u; if (name == NULL && (name = TZDEFAULT) == NULL) return -1; @@ -194,9 +194,9 @@ tzload(const char *name, char *canonname, struct state * sp, int doextend) (ttisgmtcnt != sp->typecnt && ttisgmtcnt != 0)) return -1; if (nread - (p - u.buf) < - sp->timecnt * stored + /* ats */ + sp->timecnt * stored + /* ats */ sp->timecnt + /* types */ - sp->typecnt * 6 + /* ttinfos */ + sp->typecnt * 6 + /* ttinfos */ sp->charcnt + /* chars */ sp->leapcnt * (stored + 4) + /* lsinfos */ ttisstdcnt + /* ttisstds */ @@ -271,10 +271,10 @@ tzload(const char *name, char *canonname, struct state * sp, int doextend) return -1; } } + /* - * Out-of-sort ats should mean we're running on a - * signed time_t system but using a data file with - * unsigned values (or vice versa). + * Out-of-sort ats should mean we're running on a signed time_t system + * but using a data file with unsigned values (or vice versa). */ for (i = 0; i < sp->timecnt - 2; ++i) if (sp->ats[i] > sp->ats[i + 1]) @@ -292,8 +292,8 @@ tzload(const char *name, char *canonname, struct state * sp, int doextend) /* * Ignore the beginning (harder). */ - int j; - + int j; + for (j = 0; j + i < sp->timecnt; ++j) { sp->ats[j] = sp->ats[j + i]; @@ -303,6 +303,7 @@ tzload(const char *name, char *canonname, struct state * sp, int doextend) } break; } + /* * If this is an old file, we're done. */ @@ -311,6 +312,7 @@ tzload(const char *name, char *canonname, struct state * sp, int doextend) nread -= p - u.buf; for (i = 0; i < nread; ++i) u.buf[i] = p[i]; + /* * If this is a narrow integer time_t system, we're done. */ @@ -321,9 +323,9 @@ tzload(const char *name, char *canonname, struct state * sp, int doextend) u.buf[0] == '\n' && u.buf[nread - 1] == '\n' && sp->typecnt + 2 <= TZ_MAX_TYPES) { - struct state ts; - int result; - + struct state ts; + int result; + u.buf[nread - 1] = '\0'; result = tzparse(&u.buf[1], &ts, FALSE); if (result == 0 && ts.typecnt == 2 && @@ -369,9 +371,9 @@ tzload(const char *name, char *canonname, struct state * sp, int doextend) } static int -typesequiv(const struct state *sp, int a, int b) +typesequiv(const struct state * sp, int a, int b) { - int result; + int result; if (sp == NULL || a < 0 || a >= sp->typecnt || @@ -428,7 +430,7 @@ getzname(const char *strp) static const char * getqzname(const char *strp, int delim) { - int c; + int c; while ((c = *strp) != '\0' && c != delim) ++strp; @@ -814,7 +816,7 @@ tzparse(const char *name, struct state * sp, int lastditch) sp->timecnt + 2 <= TZ_MAX_TIMES; ++year) { - pg_time_t newfirst; + pg_time_t newfirst; starttime = transtime(janfirst, year, &start, stdoffset); @@ -986,7 +988,7 @@ gmtload(struct state * sp) */ static struct pg_tm * localsub(const pg_time_t *timep, long offset, - struct pg_tm *tmp, const pg_tz *tz) + struct pg_tm * tmp, const pg_tz *tz) { const struct state *sp; const struct ttinfo *ttisp; @@ -1002,10 +1004,11 @@ localsub(const pg_time_t *timep, long offset, pg_time_t seconds; pg_time_t tcycles; int64 icycles; - + if (t < sp->ats[0]) seconds = sp->ats[0] - t; - else seconds = t - sp->ats[sp->timecnt - 1]; + else + seconds = t - sp->ats[sp->timecnt - 1]; --seconds; tcycles = seconds / YEARSPERREPEAT / AVGSECSPERYEAR; ++tcycles; @@ -1017,19 +1020,21 @@ localsub(const pg_time_t *timep, long offset, seconds *= AVGSECSPERYEAR; if (t < sp->ats[0]) newt += seconds; - else newt -= seconds; + else + newt -= seconds; if (newt < sp->ats[0] || newt > sp->ats[sp->timecnt - 1]) - return NULL; /* "cannot happen" */ + return NULL; /* "cannot happen" */ result = localsub(&newt, offset, tmp, tz); if (result == tmp) { - pg_time_t newy; + pg_time_t newy; newy = tmp->tm_year; if (t < sp->ats[0]) newy -= icycles * YEARSPERREPEAT; - else newy += icycles * YEARSPERREPEAT; + else + newy += icycles * YEARSPERREPEAT; tmp->tm_year = newy; if (tmp->tm_year != newy) return NULL; @@ -1048,16 +1053,17 @@ localsub(const pg_time_t *timep, long offset, } else { - int lo = 1; - int hi = sp->timecnt; - + int lo = 1; + int hi = sp->timecnt; + while (lo < hi) { - int mid = (lo + hi) >> 1; - + int mid = (lo + hi) >> 1; + if (t < sp->ats[mid]) hi = mid; - else lo = mid + 1; + else + lo = mid + 1; } i = (int) sp->types[lo - 1]; } @@ -1081,7 +1087,7 @@ pg_localtime(const pg_time_t *timep, const pg_tz *tz) * gmtsub is to gmtime as localsub is to localtime. */ static struct pg_tm * -gmtsub(const pg_time_t *timep, long offset, struct pg_tm *tmp) +gmtsub(const pg_time_t *timep, long offset, struct pg_tm * tmp) { struct pg_tm *result; @@ -1125,11 +1131,11 @@ leaps_thru_end_of(const int y) static struct pg_tm * timesub(const pg_time_t *timep, long offset, - const struct state *sp, struct pg_tm *tmp) + const struct state * sp, struct pg_tm * tmp) { const struct lsinfo *lp; pg_time_t tdays; - int idays; /* unsigned would be so 2003 */ + int idays; /* unsigned would be so 2003 */ long rem; int y; const int *ip; @@ -1169,11 +1175,11 @@ timesub(const pg_time_t *timep, long offset, rem = *timep - tdays * SECSPERDAY; while (tdays < 0 || tdays >= year_lengths[isleap(y)]) { - int newy; + int newy; pg_time_t tdelta; - int idelta; - int leapdays; - + int idelta; + int leapdays; + tdelta = tdays / DAYSPERLYEAR; idelta = tdelta; if (tdelta - idelta >= 1 || idelta - tdelta >= 1) @@ -1190,12 +1196,13 @@ timesub(const pg_time_t *timep, long offset, y = newy; } { - long seconds; - + long seconds; + seconds = tdays * SECSPERDAY + 0.5; tdays = seconds / SECSPERDAY; rem += seconds - tdays * SECSPERDAY; } + /* * Given the range, we can now fearlessly cast... */ @@ -1227,6 +1234,7 @@ timesub(const pg_time_t *timep, long offset, if (increment_overflow(&tmp->tm_year, -TM_YEAR_BASE)) return NULL; tmp->tm_yday = idays; + /* * The "extra" mods below avoid overflow problems. */ @@ -1264,7 +1272,7 @@ timesub(const pg_time_t *timep, long offset, static int increment_overflow(int *number, int delta) { - int number0; + int number0; number0 = *number; *number += delta; @@ -1330,10 +1338,11 @@ pg_next_dst_boundary(const pg_time_t *timep, pg_time_t tcycles; int64 icycles; int result; - + if (t < sp->ats[0]) seconds = sp->ats[0] - t; - else seconds = t - sp->ats[sp->timecnt - 1]; + else + seconds = t - sp->ats[sp->timecnt - 1]; --seconds; tcycles = seconds / YEARSPERREPEAT / AVGSECSPERYEAR; ++tcycles; @@ -1345,10 +1354,11 @@ pg_next_dst_boundary(const pg_time_t *timep, seconds *= AVGSECSPERYEAR; if (t < sp->ats[0]) newt += seconds; - else newt -= seconds; + else + newt -= seconds; if (newt < sp->ats[0] || newt > sp->ats[sp->timecnt - 1]) - return -1; /* "cannot happen" */ + return -1; /* "cannot happen" */ result = pg_next_dst_boundary(&newt, before_gmtoff, before_isdst, @@ -1395,16 +1405,17 @@ pg_next_dst_boundary(const pg_time_t *timep, } /* Else search to find the containing segment */ { - int lo = 1; - int hi = sp->timecnt; - + int lo = 1; + int hi = sp->timecnt; + while (lo < hi) { - int mid = (lo + hi) >> 1; - + int mid = (lo + hi) >> 1; + if (t < sp->ats[mid]) hi = mid; - else lo = mid + 1; + else + lo = mid + 1; } i = lo; } diff --git a/src/timezone/pgtz.c b/src/timezone/pgtz.c index e4850ec665..82a0243878 100644 --- a/src/timezone/pgtz.c +++ b/src/timezone/pgtz.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.62 2009/01/01 17:24:04 momjian Exp $ + * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.63 2009/06/11 14:49:15 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -387,15 +387,15 @@ identify_system_timezone(void) * enough to identify DST transition rules, since everybody switches on * Sundays.) This is sufficient to cover most of the Unix time_t range, * and we don't want to look further than that since many systems won't - * have sane TZ behavior further back anyway. The further - * back the zone matches, the better we score it. This may seem like a - * rather random way of doing things, but experience has shown that - * system-supplied timezone definitions are likely to have DST behavior - * that is right for the recent past and not so accurate further back. - * Scoring in this way allows us to recognize zones that have some - * commonality with the zic database, without insisting on exact match. - * (Note: we probe Thursdays, not Sundays, to avoid triggering - * DST-transition bugs in localtime itself.) + * have sane TZ behavior further back anyway. The further back the zone + * matches, the better we score it. This may seem like a rather random + * way of doing things, but experience has shown that system-supplied + * timezone definitions are likely to have DST behavior that is right for + * the recent past and not so accurate further back. Scoring in this way + * allows us to recognize zones that have some commonality with the zic + * database, without insisting on exact match. (Note: we probe Thursdays, + * not Sundays, to avoid triggering DST-transition bugs in localtime + * itself.) */ tnow = time(NULL); tm = localtime(&tnow); @@ -404,6 +404,7 @@ identify_system_timezone(void) thisyear = tm->tm_year + 1900; t = build_time_t(thisyear, 1, 15); + /* * Round back to GMT midnight Thursday. This depends on the knowledge * that the time_t origin is Thu Jan 01 1970. (With a different origin @@ -731,7 +732,7 @@ static const struct "Central Standard Time (Mexico)", "Central Daylight Time (Mexico)", "America/Mexico_City" }, /* (GMT-06:00) Guadalajara, Mexico City, - Monterrey - New */ + * Monterrey - New */ { "China Standard Time", "China Daylight Time", "Asia/Hong_Kong" @@ -852,8 +853,8 @@ static const struct { "Mountain Standard Time (Mexico)", "Mountain Daylight Time (Mexico)", "America/Chihuahua" - }, /* (GMT-07:00) Chihuahua, La Paz, - Mazatlan - New */ + }, /* (GMT-07:00) Chihuahua, La Paz, Mazatlan - + * New */ { "Myanmar Standard Time", "Myanmar Daylight Time", "Asia/Rangoon" @@ -974,7 +975,7 @@ static const struct "Australia/Perth" }, /* (GMT+08:00) Perth */ /* {"W. Central Africa Standard Time", "W. Central Africa Daylight Time", - * * * * * * * ""}, Could not find a match for this one. Excluded for now. *//* ( + * * * * * * * * ""}, Could not find a match for this one. Excluded for now. *//* ( * G MT+01:00) West Central Africa */ { "W. Europe Standard Time", "W. Europe Daylight Time", @@ -1492,7 +1493,7 @@ pg_tzenumerate_next(pg_tzenum *dir) * Load this timezone using tzload() not pg_tzset(), so we don't fill * the cache */ - if (tzload(fullname + dir->baselen, dir->tz.TZname, &dir->tz.state, + if (tzload(fullname + dir->baselen, dir->tz.TZname, &dir->tz.state, TRUE) != 0) { /* Zone could not be loaded, ignore it */ diff --git a/src/timezone/pgtz.h b/src/timezone/pgtz.h index 9e5a15afad..db865e37b1 100644 --- a/src/timezone/pgtz.h +++ b/src/timezone/pgtz.h @@ -9,7 +9,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/timezone/pgtz.h,v 1.23 2009/01/01 17:24:04 momjian Exp $ + * $PostgreSQL: pgsql/src/timezone/pgtz.h,v 1.24 2009/06/11 14:49:15 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -66,8 +66,8 @@ struct pg_tz extern int pg_open_tzfile(const char *name, char *canonname); /* in localtime.c */ -extern int tzload(const char *name, char *canonname, struct state * sp, - int doextend); +extern int tzload(const char *name, char *canonname, struct state * sp, + int doextend); extern int tzparse(const char *name, struct state * sp, int lastditch); #endif /* _PGTZ_H */ diff --git a/src/timezone/private.h b/src/timezone/private.h index 0f6b405da8..8d6a411a39 100644 --- a/src/timezone/private.h +++ b/src/timezone/private.h @@ -6,7 +6,7 @@ * 1996-06-05 by Arthur David Olson. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/timezone/private.h,v 1.12 2008/02/16 21:16:04 tgl Exp $ + * $PostgreSQL: pgsql/src/timezone/private.h,v 1.13 2009/06/11 14:49:15 momjian Exp $ */ /* @@ -85,7 +85,7 @@ extern const char *scheck(const char *string, const char *format); #ifndef TYPE_INTEGRAL #define TYPE_INTEGRAL(type) (((type) 0.5) != 0.5) -#endif /* !defined TYPE_INTEGRAL */ +#endif /* !defined TYPE_INTEGRAL */ #ifndef INT_STRLEN_MAXIMUM /* @@ -102,24 +102,24 @@ extern const char *scheck(const char *string, const char *format); #define _(msgid) (msgid) #ifndef YEARSPERREPEAT -#define YEARSPERREPEAT 400 /* years before a Gregorian repeat */ -#endif /* !defined YEARSPERREPEAT */ +#define YEARSPERREPEAT 400 /* years before a Gregorian repeat */ +#endif /* !defined YEARSPERREPEAT */ /* ** The Gregorian year averages 365.2425 days, which is 31556952 seconds. */ #ifndef AVGSECSPERYEAR -#define AVGSECSPERYEAR 31556952L -#endif /* !defined AVGSECSPERYEAR */ +#define AVGSECSPERYEAR 31556952L +#endif /* !defined AVGSECSPERYEAR */ #ifndef SECSPERREPEAT -#define SECSPERREPEAT ((int64) YEARSPERREPEAT * (int64) AVGSECSPERYEAR) -#endif /* !defined SECSPERREPEAT */ +#define SECSPERREPEAT ((int64) YEARSPERREPEAT * (int64) AVGSECSPERYEAR) +#endif /* !defined SECSPERREPEAT */ #ifndef SECSPERREPEAT_BITS -#define SECSPERREPEAT_BITS 34 /* ceil(log2(SECSPERREPEAT)) */ -#endif /* !defined SECSPERREPEAT_BITS */ +#define SECSPERREPEAT_BITS 34 /* ceil(log2(SECSPERREPEAT)) */ +#endif /* !defined SECSPERREPEAT_BITS */ /* * UNIX was a registered trademark of The Open Group in 2003. diff --git a/src/timezone/strftime.c b/src/timezone/strftime.c index 3d9d4274c5..39443af9d5 100644 --- a/src/timezone/strftime.c +++ b/src/timezone/strftime.c @@ -15,7 +15,7 @@ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/timezone/strftime.c,v 1.13 2008/02/19 12:06:35 mha Exp $ + * $PostgreSQL: pgsql/src/timezone/strftime.c,v 1.14 2009/06/11 14:49:15 momjian Exp $ */ #include "postgres.h" @@ -92,8 +92,8 @@ static char *_add(const char *, char *, const char *); static char *_conv(int, const char *, char *, const char *); static char *_fmt(const char *, const struct pg_tm *, char *, const char *, int *); -static char * _yconv(const int, const int, const int, const int, - char *, const char * const); +static char *_yconv(const int, const int, const int, const int, + char *, const char *const); #define IN_NONE 0 #define IN_SOME 1 @@ -368,11 +368,11 @@ _fmt(const char *format, const struct pg_tm * t, char *pt, const char *ptlim, { *warnp = IN_ALL; pt = _yconv(year, base, 0, 1, - pt, ptlim); + pt, ptlim); } else pt = _yconv(year, base, 1, 1, - pt, ptlim); + pt, ptlim); } continue; case 'v': @@ -493,13 +493,13 @@ _add(const char *str, char *pt, const char *ptlim) * with more only if necessary. */ static char * -_yconv(const int a, const int b, const int convert_top, - const int convert_yy, char *pt, const char * const ptlim) +_yconv(const int a, const int b, const int convert_top, + const int convert_yy, char *pt, const char *const ptlim) { - int lead; - int trail; - -#define DIVISOR 100 + int lead; + int trail; + +#define DIVISOR 100 trail = a % DIVISOR + b % DIVISOR; lead = a / DIVISOR + b / DIVISOR + trail / DIVISOR; trail %= DIVISOR; @@ -517,10 +517,10 @@ _yconv(const int a, const int b, const int convert_top, { if (lead == 0 && trail < 0) pt = _add("-0", pt, ptlim); - else pt = _conv(lead, "%02d", pt, ptlim); + else + pt = _conv(lead, "%02d", pt, ptlim); } if (convert_yy) pt = _conv(((trail < 0) ? -trail : trail), "%02d", pt, ptlim); return pt; } - diff --git a/src/timezone/tzfile.h b/src/timezone/tzfile.h index a358cad521..46e380b608 100644 --- a/src/timezone/tzfile.h +++ b/src/timezone/tzfile.h @@ -6,7 +6,7 @@ * 1996-06-05 by Arthur David Olson. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/timezone/tzfile.h,v 1.7 2008/02/16 21:16:04 tgl Exp $ + * $PostgreSQL: pgsql/src/timezone/tzfile.h,v 1.8 2009/06/11 14:49:15 momjian Exp $ */ /* @@ -133,16 +133,16 @@ struct tzhead /* * Since everything in isleap is modulo 400 (or a factor of 400), we know that - * isleap(y) == isleap(y % 400) + * isleap(y) == isleap(y % 400) * and so - * isleap(a + b) == isleap((a + b) % 400) + * isleap(a + b) == isleap((a + b) % 400) * or - * isleap(a + b) == isleap(a % 400 + b % 400) + * isleap(a + b) == isleap(a % 400 + b % 400) * This is true even if % means modulo rather than Fortran remainder * (which is allowed by C89 but not C99). * We use this to avoid addition overflow problems. */ -#define isleap_sum(a, b) isleap((a) % 400 + (b) % 400) +#define isleap_sum(a, b) isleap((a) % 400 + (b) % 400) #endif /* !defined TZFILE_H */ diff --git a/src/timezone/zic.c b/src/timezone/zic.c index 221c18ef5e..2f03f558fc 100644 --- a/src/timezone/zic.c +++ b/src/timezone/zic.c @@ -3,7 +3,7 @@ * 2006-07-17 by Arthur David Olson. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/timezone/zic.c,v 1.23 2008/02/16 21:16:04 tgl Exp $ + * $PostgreSQL: pgsql/src/timezone/zic.c,v 1.24 2009/06/11 14:49:15 momjian Exp $ */ #include "postgres_fe.h" @@ -21,13 +21,13 @@ extern char *optarg; #include "pgtz.h" #include "tzfile.h" -#define ZIC_VERSION '2' +#define ZIC_VERSION '2' -typedef int64 zic_t; +typedef int64 zic_t; #ifndef ZIC_MAX_ABBR_LEN_WO_WARN -#define ZIC_MAX_ABBR_LEN_WO_WARN 6 -#endif /* !defined ZIC_MAX_ABBR_LEN_WO_WARN */ +#define ZIC_MAX_ABBR_LEN_WO_WARN 6 +#endif /* !defined ZIC_MAX_ABBR_LEN_WO_WARN */ #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> @@ -57,9 +57,9 @@ static char elsieid[] = "@(#)zic.c 8.17"; #endif #define OFFSET_STRLEN_MAXIMUM (7 + INT_STRLEN_MAXIMUM(long)) -#define RULE_STRLEN_MAXIMUM 8 /* "Mdd.dd.d" */ +#define RULE_STRLEN_MAXIMUM 8 /* "Mdd.dd.d" */ -#define end(cp) (strchr((cp), '\0')) +#define end(cp) (strchr((cp), '\0')) struct rule { @@ -115,7 +115,7 @@ struct zone int z_nrules; struct rule z_untilrule; - zic_t z_untiltime; + zic_t z_untiltime; }; extern int link(const char *fromname, const char *toname); @@ -370,7 +370,7 @@ static const int len_years[2] = { static struct attype { - zic_t at; + zic_t at; unsigned char type; } attypes[TZ_MAX_TIMES]; static long gmtoffs[TZ_MAX_TYPES]; @@ -480,9 +480,10 @@ main(int argc, char *argv[]) (void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH)); #endif /* !WIN32 */ progname = argv[0]; - if (TYPE_BIT(zic_t) < 64) { + if (TYPE_BIT(zic_t) < 64) + { (void) fprintf(stderr, "%s: %s\n", progname, - _("wild compilation-time specification of zic_t")); + _("wild compilation-time specification of zic_t")); exit(EXIT_FAILURE); } for (i = 1; i < argc; ++i) @@ -688,8 +689,8 @@ dolink(const char *fromfield, const char *tofield) static void setboundaries(void) { - int i; - + int i; + min_time = -1; for (i = 0; i < TIME_T_BITS_IN_FILE - 1; ++i) min_time *= 2; @@ -964,7 +965,8 @@ gethms(const char *string, const char *errstring, int signable) error(errstring); return 0; } - if (LONG_MAX / SECSPERHOUR < hh) { + if (LONG_MAX / SECSPERHOUR < hh) + { error(_("time overflow")); return 0; } @@ -1481,9 +1483,9 @@ convert(long val, char *buf) static void convert64(zic_t val, char *buf) { - int i; - int shift; - + int i; + int shift; + for (i = 0, shift = 56; i < 8; ++i, shift -= 8) buf[i] = val >> shift; } @@ -1500,8 +1502,8 @@ puttzcode(long val, FILE *fp) static void puttzcode64(zic_t val, FILE *fp) { - char buf[8]; - + char buf[8]; + convert64(val, buf); (void) fwrite((void *) buf, (size_t) sizeof buf, (size_t) 1, fp); } @@ -1509,9 +1511,9 @@ puttzcode64(zic_t val, FILE *fp) static int atcomp(const void *avp, const void *bvp) { - const zic_t a = ((const struct attype *) avp)->at; - const zic_t b = ((const struct attype *) bvp)->at; - + const zic_t a = ((const struct attype *) avp)->at; + const zic_t b = ((const struct attype *) bvp)->at; + return (a < b) ? -1 : (a > b); } @@ -1527,8 +1529,10 @@ writezone(const char *name, const char *string) FILE *fp; int i, j; - int leapcnt32, leapi32; - int timecnt32, timei32; + int leapcnt32, + leapi32; + int timecnt32, + timei32; int pass; static char *fullname; static const struct tzhead tzh0; @@ -1584,17 +1588,21 @@ writezone(const char *name, const char *string) ats[i] = attypes[i].at; types[i] = attypes[i].type; } + /* * Correct for leap seconds. */ - for (i = 0; i < timecnt; ++i) { + for (i = 0; i < timecnt; ++i) + { j = leapcnt; while (--j >= 0) - if (ats[i] > trans[j] - corr[j]) { + if (ats[i] > trans[j] - corr[j]) + { ats[i] = tadd(ats[i], corr[j]); break; } } + /* * Figure out 32-bit-limited starts and counts. */ @@ -1644,23 +1652,30 @@ writezone(const char *name, const char *string) exit(EXIT_FAILURE); } } - for (pass = 1; pass <= 2; ++pass) { - register int thistimei, thistimecnt; - register int thisleapi, thisleapcnt; - register int thistimelim, thisleaplim; - int writetype[TZ_MAX_TIMES]; - int typemap[TZ_MAX_TYPES]; - register int thistypecnt; + for (pass = 1; pass <= 2; ++pass) + { + register int thistimei, + thistimecnt; + register int thisleapi, + thisleapcnt; + register int thistimelim, + thisleaplim; + int writetype[TZ_MAX_TIMES]; + int typemap[TZ_MAX_TYPES]; + register int thistypecnt; char thischars[TZ_MAX_CHARS]; char thischarcnt; - int indmap[TZ_MAX_CHARS]; + int indmap[TZ_MAX_CHARS]; - if (pass == 1) { + if (pass == 1) + { thistimei = timei32; thistimecnt = timecnt32; thisleapi = leapi32; thisleapcnt = leapcnt32; - } else { + } + else + { thistimei = 0; thistimecnt = timecnt; thisleapi = 0; @@ -1670,31 +1685,36 @@ writezone(const char *name, const char *string) thisleaplim = thisleapi + thisleapcnt; for (i = 0; i < typecnt; ++i) writetype[i] = thistimecnt == timecnt; - if (thistimecnt == 0) { + if (thistimecnt == 0) + { /* - ** No transition times fall in the current - ** (32- or 64-bit) window. - */ + * * No transition times fall in the current * (32- or 64-bit) + * window. + */ if (typecnt != 0) writetype[typecnt - 1] = TRUE; - } else { + } + else + { for (i = thistimei - 1; i < thistimelim; ++i) if (i >= 0) writetype[types[i]] = TRUE; + /* - ** For America/Godthab and Antarctica/Palmer - */ + * * For America/Godthab and Antarctica/Palmer + */ if (thistimei == 0) writetype[0] = TRUE; } thistypecnt = 0; for (i = 0; i < typecnt; ++i) - typemap[i] = writetype[i] ? thistypecnt++ : -1; + typemap[i] = writetype[i] ? thistypecnt++ : -1; for (i = 0; i < sizeof indmap / sizeof indmap[0]; ++i) indmap[i] = -1; thischarcnt = 0; - for (i = 0; i < typecnt; ++i) { - register char * thisabbr; + for (i = 0; i < typecnt; ++i) + { + register char *thisabbr; if (!writetype[i]) continue; @@ -1704,9 +1724,10 @@ writezone(const char *name, const char *string) for (j = 0; j < thischarcnt; ++j) if (strcmp(&thischars[j], thisabbr) == 0) break; - if (j == thischarcnt) { + if (j == thischarcnt) + { (void) strcpy(&thischars[(int) thischarcnt], - thisabbr); + thisabbr); thischarcnt += strlen(thisabbr) + 1; } indmap[abbrinds[i]] = j; @@ -1735,49 +1756,61 @@ writezone(const char *name, const char *string) for (i = thistimei; i < thistimelim; ++i) if (pass == 1) puttzcode((long) ats[i], fp); - else puttzcode64(ats[i], fp); - for (i = thistimei; i < thistimelim; ++i) { - unsigned char uc; + else + puttzcode64(ats[i], fp); + for (i = thistimei; i < thistimelim; ++i) + { + unsigned char uc; uc = typemap[types[i]]; (void) fwrite((void *) &uc, - (size_t) sizeof uc, - (size_t) 1, - fp); + (size_t) sizeof uc, + (size_t) 1, + fp); } for (i = 0; i < typecnt; ++i) - if (writetype[i]) { + if (writetype[i]) + { puttzcode(gmtoffs[i], fp); (void) putc(isdsts[i], fp); (void) putc((unsigned char) indmap[abbrinds[i]], fp); } if (thischarcnt != 0) (void) fwrite((void *) thischars, - (size_t) sizeof thischars[0], - (size_t) thischarcnt, fp); - for (i = thisleapi; i < thisleaplim; ++i) { - register zic_t todo; + (size_t) sizeof thischars[0], + (size_t) thischarcnt, fp); + for (i = thisleapi; i < thisleaplim; ++i) + { + register zic_t todo; - if (roll[i]) { - if (timecnt == 0 || trans[i] < ats[0]) { + if (roll[i]) + { + if (timecnt == 0 || trans[i] < ats[0]) + { j = 0; while (isdsts[j]) - if (++j >= typecnt) { + if (++j >= typecnt) + { j = 0; break; } - } else { + } + else + { j = 1; while (j < timecnt && - trans[i] >= ats[j]) - ++j; + trans[i] >= ats[j]) + ++j; j = types[j - 1]; } todo = tadd(trans[i], -gmtoffs[j]); - } else todo = trans[i]; + } + else + todo = trans[i]; if (pass == 1) puttzcode((long) todo, fp); - else puttzcode64(todo, fp); + else + puttzcode64(todo, fp); puttzcode(corr[i], fp); } for (i = 0; i < typecnt; ++i) @@ -1788,20 +1821,21 @@ writezone(const char *name, const char *string) (void) putc(ttisgmts[i], fp); } (void) fprintf(fp, "\n%s\n", string); - if (ferror(fp) || fclose(fp)) { + if (ferror(fp) || fclose(fp)) + { (void) fprintf(stderr, _("%s: Error writing %s\n"), - progname, fullname); + progname, fullname); exit(EXIT_FAILURE); } } static void -doabbr(char *abbr, const char *format, const char *letters, int isdst, +doabbr(char *abbr, const char *format, const char *letters, int isdst, int doquotes) { - char * cp; - char * slashp; - int len; + char *cp; + char *slashp; + int len; slashp = strchr(format, '/'); if (slashp == NULL) @@ -1831,7 +1865,7 @@ doabbr(char *abbr, const char *format, const char *letters, int isdst, return; abbr[len + 2] = '\0'; abbr[len + 1] = '>'; - for ( ; len > 0; --len) + for (; len > 0; --len) abbr[len] = abbr[len - 1]; abbr[0] = '<'; } @@ -1848,12 +1882,13 @@ updateminmax(int x) static int stringoffset(char *result, long offset) { - int hours; - int minutes; - int seconds; + int hours; + int minutes; + int seconds; result[0] = '\0'; - if (offset < 0) { + if (offset < 0) + { (void) strcpy(result, "-"); offset = -offset; } @@ -1862,12 +1897,14 @@ stringoffset(char *result, long offset) minutes = offset % MINSPERHOUR; offset /= MINSPERHOUR; hours = offset; - if (hours >= HOURSPERDAY) { + if (hours >= HOURSPERDAY) + { result[0] = '\0'; return -1; } (void) sprintf(end(result), "%d", hours); - if (minutes != 0 || seconds != 0) { + if (minutes != 0 || seconds != 0) + { (void) sprintf(end(result), ":%02d", minutes); if (seconds != 0) (void) sprintf(end(result), ":%02d", seconds); @@ -1876,14 +1913,15 @@ stringoffset(char *result, long offset) } static int -stringrule(char *result, const struct rule *rp, long dstoff, long gmtoff) +stringrule(char *result, const struct rule * rp, long dstoff, long gmtoff) { - long tod; + long tod; result = end(result); - if (rp->r_dycode == DC_DOM) + if (rp->r_dycode == DC_DOM) { - int month, total; + int month, + total; if (rp->r_dayofmonth == 29 && rp->r_month == TM_FEBRUARY) return -1; @@ -1894,7 +1932,7 @@ stringrule(char *result, const struct rule *rp, long dstoff, long gmtoff) } else { - int week; + int week; if (rp->r_dycode == DC_DOWGEQ) { @@ -1906,14 +1944,15 @@ stringrule(char *result, const struct rule *rp, long dstoff, long gmtoff) { if (rp->r_dayofmonth == len_months[1][rp->r_month]) week = 5; - else { + else + { week = 1 + rp->r_dayofmonth / DAYSPERWEEK; if (week * DAYSPERWEEK - 1 != rp->r_dayofmonth) return -1; } } else - return -1; /* "cannot happen" */ + return -1; /* "cannot happen" */ (void) sprintf(result, "M%d.%d.%d", rp->r_month + 1, week, rp->r_wday); } @@ -1937,14 +1976,14 @@ stringrule(char *result, const struct rule *rp, long dstoff, long gmtoff) } static void -stringzone(char *result, const struct zone *zpfirst, int zonecount) +stringzone(char *result, const struct zone * zpfirst, int zonecount) { - const struct zone * zp; - struct rule * rp; - struct rule * stdrp; - struct rule * dstrp; + const struct zone *zp; + struct rule *rp; + struct rule *stdrp; + struct rule *dstrp; int i; - const char * abbrvar; + const char *abbrvar; result[0] = '\0'; zp = zpfirst + zonecount - 1; @@ -1956,38 +1995,42 @@ stringzone(char *result, const struct zone *zpfirst, int zonecount) continue; if (rp->r_yrtype != NULL) continue; - if (rp->r_stdoff == 0) { + if (rp->r_stdoff == 0) + { if (stdrp == NULL) stdrp = rp; - else return; + else + return; } else { if (dstrp == NULL) dstrp = rp; - else return; + else + return; } } if (stdrp == NULL && dstrp == NULL) { /* - * There are no rules running through "max". - * Let's find the latest rule. + * There are no rules running through "max". Let's find the latest + * rule. */ for (i = 0; i < zp->z_nrules; ++i) { rp = &zp->z_rules[i]; if (stdrp == NULL || rp->r_hiyear > stdrp->r_hiyear || (rp->r_hiyear == stdrp->r_hiyear && - rp->r_month > stdrp->r_month)) - stdrp = rp; + rp->r_month > stdrp->r_month)) + stdrp = rp; } if (stdrp != NULL && stdrp->r_stdoff != 0) - return; /* We end up in DST (a POSIX no-no). */ + return; /* We end up in DST (a POSIX no-no). */ + /* - * Horrid special case: if year is 2037, - * presume this is a zone handled on a year-by-year basis; - * do not try to apply a rule to the zone. + * Horrid special case: if year is 2037, presume this is a zone + * handled on a year-by-year basis; do not try to apply a rule to the + * zone. */ if (stdrp != NULL && stdrp->r_hiyear == 2037) return; @@ -1996,7 +2039,8 @@ stringzone(char *result, const struct zone *zpfirst, int zonecount) return; abbrvar = (stdrp == NULL) ? "" : stdrp->r_abbrvar; doabbr(result, zp->z_format, abbrvar, FALSE, TRUE); - if (stringoffset(end(result), -zp->z_gmtoff) != 0) { + if (stringoffset(end(result), -zp->z_gmtoff) != 0) + { result[0] = '\0'; return; } @@ -2005,17 +2049,20 @@ stringzone(char *result, const struct zone *zpfirst, int zonecount) doabbr(end(result), zp->z_format, dstrp->r_abbrvar, TRUE, TRUE); if (dstrp->r_stdoff != SECSPERMIN * MINSPERHOUR) if (stringoffset(end(result), - -(zp->z_gmtoff + dstrp->r_stdoff)) != 0) { - result[0] = '\0'; - return; + -(zp->z_gmtoff + dstrp->r_stdoff)) != 0) + { + result[0] = '\0'; + return; } (void) strcat(result, ","); - if (stringrule(result, dstrp, dstrp->r_stdoff, zp->z_gmtoff) != 0) { + if (stringrule(result, dstrp, dstrp->r_stdoff, zp->z_gmtoff) != 0) + { result[0] = '\0'; return; } (void) strcat(result, ","); - if (stringrule(result, stdrp, dstrp->r_stdoff, zp->z_gmtoff) != 0) { + if (stringrule(result, stdrp, dstrp->r_stdoff, zp->z_gmtoff) != 0) + { result[0] = '\0'; return; } @@ -2059,8 +2106,8 @@ outzone(const struct zone * zpfirst, int zonecount) charcnt = 0; /* - * Thanks to Earl Chew for noting the need to - * unconditionally initialize startttisstd. + * Thanks to Earl Chew for noting the need to unconditionally initialize + * startttisstd. */ startttisstd = FALSE; startttisgmt = FALSE; @@ -2084,12 +2131,14 @@ outzone(const struct zone * zpfirst, int zonecount) updateminmax(rp->r_hiyear); } } + /* * Generate lots of data if a rule can't cover all future times. */ stringzone(envvar, zpfirst, zonecount); - if (noise && envvar[0] == '\0') { - char * wp; + if (noise && envvar[0] == '\0') + { + char *wp; wp = ecpyalloc(_("no POSIX environment variable for zone")); wp = ecatalloc(wp, " "); @@ -2101,14 +2150,16 @@ outzone(const struct zone * zpfirst, int zonecount) { if (min_year >= INT_MIN + YEARSPERREPEAT) min_year -= YEARSPERREPEAT; - else min_year = INT_MIN; + else + min_year = INT_MIN; if (max_year <= INT_MAX - YEARSPERREPEAT) max_year += YEARSPERREPEAT; - else max_year = INT_MAX; + else + max_year = INT_MAX; } + /* - * For the benefit of older systems, - * generate data from 1900 through 2037. + * For the benefit of older systems, generate data from 1900 through 2037. */ if (min_year > 1900) min_year = 1900; @@ -2235,7 +2286,7 @@ outzone(const struct zone * zpfirst, int zonecount) FALSE); continue; } - if (*startbuf == '\0' && + if (*startbuf == '\0' && startoff == oadd(zp->z_gmtoff, stdoff)) { doabbr(startbuf, @@ -2366,7 +2417,8 @@ addtype(long gmtoff, const char *abbr, int isdst, error(_("too many local time types")); exit(EXIT_FAILURE); } - if (! (-1L - 2147483647L <= gmtoff && gmtoff <= 2147483647L)) { + if (!(-1L - 2147483647L <= gmtoff && gmtoff <= 2147483647L)) + { error(_("UTC offset out of range")); exit(EXIT_FAILURE); } @@ -2585,7 +2637,7 @@ oadd(long t1, long t2) static zic_t tadd(const zic_t t1, long t2) { - zic_t t; + zic_t t; if (t1 == max_time && t2 > 0) return max_time; @@ -2612,7 +2664,7 @@ rpytime(const struct rule * rp, int wantedy) m, i; long dayoff; /* with a nod to Margaret O. */ - zic_t t; + zic_t t; if (wantedy == INT_MIN) return min_time; @@ -2699,6 +2751,7 @@ will not work with pre-2004 versions of zic")); if (dayoff > max_time / SECSPERDAY) return max_time; t = (zic_t) dayoff *SECSPERDAY; + return tadd(t, rp->r_tod); } @@ -2709,12 +2762,12 @@ newabbr(const char *string) if (strcmp(string, GRANDPARENTED) != 0) { - const char * cp; - char * wp; + const char *cp; + char *wp; /* - * Want one to ZIC_MAX_ABBR_LEN_WO_WARN alphabetics - * optionally followed by a + or - and a number from 1 to 14. + * Want one to ZIC_MAX_ABBR_LEN_WO_WARN alphabetics optionally + * followed by a + or - and a number from 1 to 14. */ cp = string; wp = NULL; @@ -2727,7 +2780,8 @@ newabbr(const char *string) wp = _("time zone abbreviation has more than 3 alphabetics"); if (cp - string > ZIC_MAX_ABBR_LEN_WO_WARN) wp = _("time zone abbreviation has too many alphabetics"); - if (wp == NULL && (*cp == '+' || *cp == '-')) { + if (wp == NULL && (*cp == '+' || *cp == '-')) + { ++cp; if (isascii((unsigned char) *cp) && isdigit((unsigned char) *cp)) @@ -2737,7 +2791,8 @@ newabbr(const char *string) } if (*cp != '\0') wp = _("time zone abbreviation differs from POSIX standard"); - if (wp != NULL) { + if (wp != NULL) + { wp = ecpyalloc(wp); wp = ecatalloc(wp, " ("); wp = ecatalloc(wp, string); diff --git a/src/tools/fsync/test_fsync.c b/src/tools/fsync/test_fsync.c index 07e68bcf11..b87237a689 100644 --- a/src/tools/fsync/test_fsync.c +++ b/src/tools/fsync/test_fsync.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/tools/fsync/test_fsync.c,v 1.22 2009/05/08 14:06:27 momjian Exp $ + * $PostgreSQL: pgsql/src/tools/fsync/test_fsync.c,v 1.23 2009/06/11 14:49:15 momjian Exp $ * * * test_fsync.c diff --git a/src/tutorial/complex.c b/src/tutorial/complex.c index ab0166ba52..bc37220fe3 100644 --- a/src/tutorial/complex.c +++ b/src/tutorial/complex.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/tutorial/complex.c,v 1.14 2008/05/17 01:28:26 adunstan Exp $ + * $PostgreSQL: pgsql/src/tutorial/complex.c,v 1.15 2009/06/11 14:49:15 momjian Exp $ * ****************************************************************************** This file contains routines that can be bound to a Postgres backend and |