aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils')
-rw-r--r--src/backend/utils/adt/acl.c4
-rw-r--r--src/backend/utils/adt/array_userfuncs.c19
-rw-r--r--src/backend/utils/adt/formatting.c54
-rw-r--r--src/backend/utils/adt/json.c6
-rw-r--r--src/backend/utils/adt/jsonb.c115
-rw-r--r--src/backend/utils/adt/jsonb_util.c11
-rw-r--r--src/backend/utils/adt/jsonfuncs.c103
-rw-r--r--src/backend/utils/adt/levenshtein.c4
-rw-r--r--src/backend/utils/adt/lockfuncs.c2
-rw-r--r--src/backend/utils/adt/misc.c2
-rw-r--r--src/backend/utils/adt/network_gist.c8
-rw-r--r--src/backend/utils/adt/numeric.c59
-rw-r--r--src/backend/utils/adt/pg_locale.c2
-rw-r--r--src/backend/utils/adt/pg_upgrade_support.c26
-rw-r--r--src/backend/utils/adt/pgstatfuncs.c20
-rw-r--r--src/backend/utils/adt/rangetypes_spgist.c30
-rw-r--r--src/backend/utils/adt/regexp.c5
-rw-r--r--src/backend/utils/adt/regproc.c8
-rw-r--r--src/backend/utils/adt/ri_triggers.c16
-rw-r--r--src/backend/utils/adt/ruleutils.c73
-rw-r--r--src/backend/utils/adt/tsquery_op.c5
-rw-r--r--src/backend/utils/adt/txid.c6
-rw-r--r--src/backend/utils/adt/varlena.c184
-rw-r--r--src/backend/utils/adt/xml.c4
-rw-r--r--src/backend/utils/cache/inval.c11
-rw-r--r--src/backend/utils/cache/lsyscache.c4
-rw-r--r--src/backend/utils/cache/plancache.c4
-rw-r--r--src/backend/utils/cache/relcache.c14
-rw-r--r--src/backend/utils/cache/syscache.c38
-rw-r--r--src/backend/utils/error/elog.c4
-rw-r--r--src/backend/utils/fmgr/dfmgr.c4
-rw-r--r--src/backend/utils/fmgr/funcapi.c9
-rw-r--r--src/backend/utils/init/miscinit.c1
-rw-r--r--src/backend/utils/init/postinit.c2
-rwxr-xr-xsrc/backend/utils/mb/Unicode/UCS_to_GB18030.pl4
-rwxr-xr-xsrc/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl4
-rw-r--r--src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c8
-rw-r--r--src/backend/utils/misc/guc.c115
-rw-r--r--src/backend/utils/misc/rls.c35
-rw-r--r--src/backend/utils/misc/sampling.c4
-rw-r--r--src/backend/utils/sort/sortsupport.c4
-rw-r--r--src/backend/utils/sort/tuplesort.c116
-rw-r--r--src/backend/utils/time/combocid.c7
-rw-r--r--src/backend/utils/time/snapmgr.c33
-rw-r--r--src/backend/utils/time/tqual.c11
45 files changed, 615 insertions, 583 deletions
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c
index e7aecc95c97..3ca168b4736 100644
--- a/src/backend/utils/adt/acl.c
+++ b/src/backend/utils/adt/acl.c
@@ -5202,7 +5202,7 @@ get_rolespec_tuple(const Node *node)
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("role \"%s\" does not exist", role->rolename)));
+ errmsg("role \"%s\" does not exist", role->rolename)));
break;
case ROLESPEC_CURRENT_USER:
@@ -5221,7 +5221,7 @@ get_rolespec_tuple(const Node *node)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("role \"%s\" does not exist", "public")));
- tuple = NULL; /* make compiler happy */
+ tuple = NULL; /* make compiler happy */
default:
elog(ERROR, "unexpected role type %d", role->roletype);
diff --git a/src/backend/utils/adt/array_userfuncs.c b/src/backend/utils/adt/array_userfuncs.c
index f7b57da48e7..c14ea23dfbc 100644
--- a/src/backend/utils/adt/array_userfuncs.c
+++ b/src/backend/utils/adt/array_userfuncs.c
@@ -687,7 +687,7 @@ array_position_start(PG_FUNCTION_ARGS)
/*
* array_position_common
- * Common code for array_position and array_position_start
+ * Common code for array_position and array_position_start
*
* These are separate wrappers for the sake of opr_sanity regression test.
* They are not strict so we have to test for null inputs explicitly.
@@ -755,7 +755,8 @@ array_position_common(FunctionCallInfo fcinfo)
/*
* We arrange to look up type info for array_create_iterator only once per
- * series of calls, assuming the element type doesn't change underneath us.
+ * series of calls, assuming the element type doesn't change underneath
+ * us.
*/
my_extra = (ArrayMetaState *) fcinfo->flinfo->fn_extra;
if (my_extra == NULL)
@@ -778,8 +779,8 @@ array_position_common(FunctionCallInfo fcinfo)
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(element_type))));
+ errmsg("could not identify an equality operator for type %s",
+ format_type_be(element_type))));
my_extra->element_type = element_type;
fmgr_info(typentry->eq_opr_finfo.fn_oid, &my_extra->proc);
@@ -892,7 +893,8 @@ array_positions(PG_FUNCTION_ARGS)
/*
* We arrange to look up type info for array_create_iterator only once per
- * series of calls, assuming the element type doesn't change underneath us.
+ * series of calls, assuming the element type doesn't change underneath
+ * us.
*/
my_extra = (ArrayMetaState *) fcinfo->flinfo->fn_extra;
if (my_extra == NULL)
@@ -915,15 +917,16 @@ array_positions(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(element_type))));
+ errmsg("could not identify an equality operator for type %s",
+ format_type_be(element_type))));
my_extra->element_type = element_type;
fmgr_info(typentry->eq_opr_finfo.fn_oid, &my_extra->proc);
}
/*
- * Accumulate each array position iff the element matches the given element.
+ * Accumulate each array position iff the element matches the given
+ * element.
*/
array_iterator = array_create_iterator(array, 0, my_extra);
while (array_iterate(array_iterator, &value, &isnull))
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index 84e4db8416a..5391ea0bf0b 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -920,7 +920,7 @@ typedef struct NUMProc
num_count, /* number of write digits */
num_in, /* is inside number */
num_curr, /* current position in number */
- out_pre_spaces, /* spaces before first digit */
+ out_pre_spaces, /* spaces before first digit */
read_dec, /* to_number - was read dec. point */
read_post, /* to_number - number of dec. digit */
@@ -981,7 +981,7 @@ static char *get_last_relevant_decnum(char *num);
static void NUM_numpart_from_char(NUMProc *Np, int id, int input_len);
static void NUM_numpart_to_char(NUMProc *Np, int id);
static char *NUM_processor(FormatNode *node, NUMDesc *Num, char *inout,
- char *number, int from_char_input_len, int to_char_out_pre_spaces,
+ char *number, int from_char_input_len, int to_char_out_pre_spaces,
int sign, bool is_to_char, Oid collid);
static DCHCacheEntry *DCH_cache_search(char *str);
static DCHCacheEntry *DCH_cache_getnew(char *str);
@@ -2541,14 +2541,14 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
break;
if (S_TM(n->suffix))
{
- char *str = str_toupper_z(localized_full_months[tm->tm_mon - 1], collid);
+ char *str = str_toupper_z(localized_full_months[tm->tm_mon - 1], collid);
if (strlen(str) <= (n->key->len + TM_SUFFIX_LEN) * DCH_MAX_ITEM_SIZ)
strcpy(s, str);
else
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
- errmsg("localized string format value too long")));
+ errmsg("localized string format value too long")));
}
else
sprintf(s, "%*s", S_FM(n->suffix) ? 0 : -9,
@@ -2561,14 +2561,14 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
break;
if (S_TM(n->suffix))
{
- char *str = str_initcap_z(localized_full_months[tm->tm_mon - 1], collid);
+ char *str = str_initcap_z(localized_full_months[tm->tm_mon - 1], collid);
if (strlen(str) <= (n->key->len + TM_SUFFIX_LEN) * DCH_MAX_ITEM_SIZ)
strcpy(s, str);
else
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
- errmsg("localized string format value too long")));
+ errmsg("localized string format value too long")));
}
else
sprintf(s, "%*s", S_FM(n->suffix) ? 0 : -9,
@@ -2581,14 +2581,14 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
break;
if (S_TM(n->suffix))
{
- char *str = str_tolower_z(localized_full_months[tm->tm_mon - 1], collid);
+ char *str = str_tolower_z(localized_full_months[tm->tm_mon - 1], collid);
if (strlen(str) <= (n->key->len + TM_SUFFIX_LEN) * DCH_MAX_ITEM_SIZ)
strcpy(s, str);
else
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
- errmsg("localized string format value too long")));
+ errmsg("localized string format value too long")));
}
else
sprintf(s, "%*s", S_FM(n->suffix) ? 0 : -9,
@@ -2601,14 +2601,14 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
break;
if (S_TM(n->suffix))
{
- char *str = str_toupper_z(localized_abbrev_months[tm->tm_mon - 1], collid);
+ char *str = str_toupper_z(localized_abbrev_months[tm->tm_mon - 1], collid);
if (strlen(str) <= (n->key->len + TM_SUFFIX_LEN) * DCH_MAX_ITEM_SIZ)
strcpy(s, str);
else
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
- errmsg("localized string format value too long")));
+ errmsg("localized string format value too long")));
}
else
strcpy(s, asc_toupper_z(months[tm->tm_mon - 1]));
@@ -2620,14 +2620,14 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
break;
if (S_TM(n->suffix))
{
- char *str = str_initcap_z(localized_abbrev_months[tm->tm_mon - 1], collid);
+ char *str = str_initcap_z(localized_abbrev_months[tm->tm_mon - 1], collid);
if (strlen(str) <= (n->key->len + TM_SUFFIX_LEN) * DCH_MAX_ITEM_SIZ)
strcpy(s, str);
else
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
- errmsg("localized string format value too long")));
+ errmsg("localized string format value too long")));
}
else
strcpy(s, months[tm->tm_mon - 1]);
@@ -2639,14 +2639,14 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
break;
if (S_TM(n->suffix))
{
- char *str = str_tolower_z(localized_abbrev_months[tm->tm_mon - 1], collid);
+ char *str = str_tolower_z(localized_abbrev_months[tm->tm_mon - 1], collid);
if (strlen(str) <= (n->key->len + TM_SUFFIX_LEN) * DCH_MAX_ITEM_SIZ)
strcpy(s, str);
else
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
- errmsg("localized string format value too long")));
+ errmsg("localized string format value too long")));
}
else
strcpy(s, asc_tolower_z(months[tm->tm_mon - 1]));
@@ -2662,14 +2662,14 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
INVALID_FOR_INTERVAL;
if (S_TM(n->suffix))
{
- char *str = str_toupper_z(localized_full_days[tm->tm_wday], collid);
+ char *str = str_toupper_z(localized_full_days[tm->tm_wday], collid);
if (strlen(str) <= (n->key->len + TM_SUFFIX_LEN) * DCH_MAX_ITEM_SIZ)
strcpy(s, str);
else
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
- errmsg("localized string format value too long")));
+ errmsg("localized string format value too long")));
}
else
sprintf(s, "%*s", S_FM(n->suffix) ? 0 : -9,
@@ -2680,14 +2680,14 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
INVALID_FOR_INTERVAL;
if (S_TM(n->suffix))
{
- char *str = str_initcap_z(localized_full_days[tm->tm_wday], collid);
+ char *str = str_initcap_z(localized_full_days[tm->tm_wday], collid);
if (strlen(str) <= (n->key->len + TM_SUFFIX_LEN) * DCH_MAX_ITEM_SIZ)
strcpy(s, str);
else
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
- errmsg("localized string format value too long")));
+ errmsg("localized string format value too long")));
}
else
sprintf(s, "%*s", S_FM(n->suffix) ? 0 : -9,
@@ -2698,14 +2698,14 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
INVALID_FOR_INTERVAL;
if (S_TM(n->suffix))
{
- char *str = str_tolower_z(localized_full_days[tm->tm_wday], collid);
+ char *str = str_tolower_z(localized_full_days[tm->tm_wday], collid);
if (strlen(str) <= (n->key->len + TM_SUFFIX_LEN) * DCH_MAX_ITEM_SIZ)
strcpy(s, str);
else
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
- errmsg("localized string format value too long")));
+ errmsg("localized string format value too long")));
}
else
sprintf(s, "%*s", S_FM(n->suffix) ? 0 : -9,
@@ -2716,14 +2716,14 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
INVALID_FOR_INTERVAL;
if (S_TM(n->suffix))
{
- char *str = str_toupper_z(localized_abbrev_days[tm->tm_wday], collid);
+ char *str = str_toupper_z(localized_abbrev_days[tm->tm_wday], collid);
if (strlen(str) <= (n->key->len + TM_SUFFIX_LEN) * DCH_MAX_ITEM_SIZ)
strcpy(s, str);
else
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
- errmsg("localized string format value too long")));
+ errmsg("localized string format value too long")));
}
else
strcpy(s, asc_toupper_z(days_short[tm->tm_wday]));
@@ -2733,14 +2733,14 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
INVALID_FOR_INTERVAL;
if (S_TM(n->suffix))
{
- char *str = str_initcap_z(localized_abbrev_days[tm->tm_wday], collid);
+ char *str = str_initcap_z(localized_abbrev_days[tm->tm_wday], collid);
if (strlen(str) <= (n->key->len + TM_SUFFIX_LEN) * DCH_MAX_ITEM_SIZ)
strcpy(s, str);
else
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
- errmsg("localized string format value too long")));
+ errmsg("localized string format value too long")));
}
else
strcpy(s, days_short[tm->tm_wday]);
@@ -2750,14 +2750,14 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
INVALID_FOR_INTERVAL;
if (S_TM(n->suffix))
{
- char *str = str_tolower_z(localized_abbrev_days[tm->tm_wday], collid);
+ char *str = str_tolower_z(localized_abbrev_days[tm->tm_wday], collid);
if (strlen(str) <= (n->key->len + TM_SUFFIX_LEN) * DCH_MAX_ITEM_SIZ)
strcpy(s, str);
else
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
- errmsg("localized string format value too long")));
+ errmsg("localized string format value too long")));
}
else
strcpy(s, asc_tolower_z(days_short[tm->tm_wday]));
@@ -4572,7 +4572,7 @@ NUM_numpart_to_char(NUMProc *Np, int id)
static char *
NUM_processor(FormatNode *node, NUMDesc *Num, char *inout,
- char *number, int from_char_input_len, int to_char_out_pre_spaces,
+ char *number, int from_char_input_len, int to_char_out_pre_spaces,
int sign, bool is_to_char, Oid collid)
{
FormatNode *n;
diff --git a/src/backend/utils/adt/json.c b/src/backend/utils/adt/json.c
index f08e288c21d..26d38433693 100644
--- a/src/backend/utils/adt/json.c
+++ b/src/backend/utils/adt/json.c
@@ -1442,7 +1442,7 @@ datum_to_json(Datum val, bool is_null, StringInfo result,
if (DATE_NOT_FINITE(date))
{
/* we have to format infinity ourselves */
- appendStringInfoString(result,DT_INFINITY);
+ appendStringInfoString(result, DT_INFINITY);
}
else
{
@@ -1465,7 +1465,7 @@ datum_to_json(Datum val, bool is_null, StringInfo result,
if (TIMESTAMP_NOT_FINITE(timestamp))
{
/* we have to format infinity ourselves */
- appendStringInfoString(result,DT_INFINITY);
+ appendStringInfoString(result, DT_INFINITY);
}
else if (timestamp2tm(timestamp, NULL, &tm, &fsec, NULL, NULL) == 0)
{
@@ -1492,7 +1492,7 @@ datum_to_json(Datum val, bool is_null, StringInfo result,
if (TIMESTAMP_NOT_FINITE(timestamp))
{
/* we have to format infinity ourselves */
- appendStringInfoString(result,DT_INFINITY);
+ appendStringInfoString(result, DT_INFINITY);
}
else if (timestamp2tm(timestamp, &tz, &tm, &fsec, &tzn, NULL) == 0)
{
diff --git a/src/backend/utils/adt/jsonb.c b/src/backend/utils/adt/jsonb.c
index bccc6696a4f..c0959a0ee2a 100644
--- a/src/backend/utils/adt/jsonb.c
+++ b/src/backend/utils/adt/jsonb.c
@@ -57,7 +57,7 @@ typedef enum /* type categories for datum_to_jsonb */
JSONBTYPE_COMPOSITE, /* composite */
JSONBTYPE_JSONCAST, /* something with an explicit cast to JSON */
JSONBTYPE_OTHER /* all else */
-} JsonbTypeCategory;
+} JsonbTypeCategory;
static inline Datum jsonb_from_cstring(char *json, int len);
static size_t checkStringLen(size_t len);
@@ -69,7 +69,7 @@ static void jsonb_in_object_field_start(void *pstate, char *fname, bool isnull);
static void jsonb_put_escaped_value(StringInfo out, JsonbValue *scalarVal);
static void jsonb_in_scalar(void *pstate, char *token, JsonTokenType tokentype);
static void jsonb_categorize_type(Oid typoid,
- JsonbTypeCategory * tcategory,
+ JsonbTypeCategory *tcategory,
Oid *outfuncoid);
static void composite_to_jsonb(Datum composite, JsonbInState *result);
static void array_dim_to_jsonb(JsonbInState *result, int dim, int ndims, int *dims,
@@ -77,14 +77,14 @@ static void array_dim_to_jsonb(JsonbInState *result, int dim, int ndims, int *di
JsonbTypeCategory tcategory, Oid outfuncoid);
static void array_to_jsonb_internal(Datum array, JsonbInState *result);
static void jsonb_categorize_type(Oid typoid,
- JsonbTypeCategory * tcategory,
+ JsonbTypeCategory *tcategory,
Oid *outfuncoid);
static void datum_to_jsonb(Datum val, bool is_null, JsonbInState *result,
JsonbTypeCategory tcategory, Oid outfuncoid,
bool key_scalar);
static void add_jsonb(Datum val, bool is_null, JsonbInState *result,
Oid val_type, bool key_scalar);
-static JsonbParseState * clone_parse_state(JsonbParseState * state);
+static JsonbParseState *clone_parse_state(JsonbParseState *state);
static char *JsonbToCStringWorker(StringInfo out, JsonbContainer *in, int estimated_len, bool indent);
static void add_indent(StringInfo out, bool indent, int level);
@@ -365,10 +365,12 @@ jsonb_in_scalar(void *pstate, char *token, JsonTokenType tokentype)
case JSON_TOKEN_TRUE:
v.type = jbvBool;
v.val.boolean = true;
+
break;
case JSON_TOKEN_FALSE:
v.type = jbvBool;
v.val.boolean = false;
+
break;
case JSON_TOKEN_NULL:
v.type = jbvNull;
@@ -448,15 +450,17 @@ JsonbToCStringWorker(StringInfo out, JsonbContainer *in, int estimated_len, bool
JsonbValue v;
int level = 0;
bool redo_switch = false;
+
/* If we are indenting, don't add a space after a comma */
int ispaces = indent ? 1 : 2;
+
/*
- * Don't indent the very first item. This gets set to the indent flag
- * at the bottom of the loop.
+ * Don't indent the very first item. This gets set to the indent flag at
+ * the bottom of the loop.
*/
- bool use_indent = false;
- bool raw_scalar = false;
- bool last_was_key = false;
+ bool use_indent = false;
+ bool raw_scalar = false;
+ bool last_was_key = false;
if (out == NULL)
out = makeStringInfo();
@@ -530,13 +534,13 @@ JsonbToCStringWorker(StringInfo out, JsonbContainer *in, int estimated_len, bool
appendBinaryStringInfo(out, ", ", ispaces);
first = false;
- if (! raw_scalar)
+ if (!raw_scalar)
add_indent(out, use_indent, level);
jsonb_put_escaped_value(out, &v);
break;
case WJB_END_ARRAY:
level--;
- if (! raw_scalar)
+ if (!raw_scalar)
{
add_indent(out, use_indent, level);
appendStringInfoCharMacro(out, ']');
@@ -580,11 +584,11 @@ add_indent(StringInfo out, bool indent, int level)
*
* Given the datatype OID, return its JsonbTypeCategory, as well as the type's
* output function OID. If the returned category is JSONBTYPE_JSONCAST,
- * we return the OID of the relevant cast function instead.
+ * we return the OID of the relevant cast function instead.
*/
static void
jsonb_categorize_type(Oid typoid,
- JsonbTypeCategory * tcategory,
+ JsonbTypeCategory *tcategory,
Oid *outfuncoid)
{
bool typisvarlena;
@@ -649,16 +653,16 @@ jsonb_categorize_type(Oid typoid,
*tcategory = JSONBTYPE_OTHER;
/*
- * but first let's look for a cast to json (note: not to jsonb)
- * if it's not built-in.
+ * but first let's look for a cast to json (note: not to
+ * jsonb) if it's not built-in.
*/
if (typoid >= FirstNormalObjectId)
{
- Oid castfunc;
+ Oid castfunc;
CoercionPathType ctype;
ctype = find_coercion_pathway(JSONOID, typoid,
- COERCION_EXPLICIT, &castfunc);
+ COERCION_EXPLICIT, &castfunc);
if (ctype == COERCION_PATH_FUNC && OidIsValid(castfunc))
{
*tcategory = JSONBTYPE_JSONCAST;
@@ -774,30 +778,30 @@ datum_to_jsonb(Datum val, bool is_null, JsonbInState *result,
}
}
break;
- case JSONBTYPE_DATE:
- {
- DateADT date;
- struct pg_tm tm;
- char buf[MAXDATELEN + 1];
+ case JSONBTYPE_DATE:
+ {
+ DateADT date;
+ struct pg_tm tm;
+ char buf[MAXDATELEN + 1];
- date = DatumGetDateADT(val);
- jb.type = jbvString;
+ date = DatumGetDateADT(val);
+ jb.type = jbvString;
- if (DATE_NOT_FINITE(date))
- {
- jb.val.string.len = strlen(DT_INFINITY);
- jb.val.string.val = pstrdup(DT_INFINITY);
- }
- else
- {
- j2date(date + POSTGRES_EPOCH_JDATE,
- &(tm.tm_year), &(tm.tm_mon), &(tm.tm_mday));
- EncodeDateOnly(&tm, USE_XSD_DATES, buf);
- jb.val.string.len = strlen(buf);
- jb.val.string.val = pstrdup(buf);
+ if (DATE_NOT_FINITE(date))
+ {
+ jb.val.string.len = strlen(DT_INFINITY);
+ jb.val.string.val = pstrdup(DT_INFINITY);
+ }
+ else
+ {
+ j2date(date + POSTGRES_EPOCH_JDATE,
+ &(tm.tm_year), &(tm.tm_mon), &(tm.tm_mday));
+ EncodeDateOnly(&tm, USE_XSD_DATES, buf);
+ jb.val.string.len = strlen(buf);
+ jb.val.string.val = pstrdup(buf);
+ }
}
- }
- break;
+ break;
case JSONBTYPE_TIMESTAMP:
{
Timestamp timestamp;
@@ -1534,9 +1538,11 @@ jsonb_object_two_arg(PG_FUNCTION_ARGS)
* change them.
*/
static JsonbParseState *
-clone_parse_state(JsonbParseState * state)
+clone_parse_state(JsonbParseState *state)
{
- JsonbParseState *result, *icursor, *ocursor;
+ JsonbParseState *result,
+ *icursor,
+ *ocursor;
if (state == NULL)
return NULL;
@@ -1544,14 +1550,14 @@ clone_parse_state(JsonbParseState * state)
result = palloc(sizeof(JsonbParseState));
icursor = state;
ocursor = result;
- for(;;)
+ for (;;)
{
ocursor->contVal = icursor->contVal;
ocursor->size = icursor->size;
icursor = icursor->next;
if (icursor == NULL)
break;
- ocursor->next= palloc(sizeof(JsonbParseState));
+ ocursor->next = palloc(sizeof(JsonbParseState));
ocursor = ocursor->next;
}
ocursor->next = NULL;
@@ -1652,15 +1658,16 @@ jsonb_agg_transfn(PG_FUNCTION_ARGS)
{
/* copy string values in the aggregate context */
char *buf = palloc(v.val.string.len + 1);
+
snprintf(buf, v.val.string.len + 1, "%s", v.val.string.val);
v.val.string.val = buf;
}
else if (v.type == jbvNumeric)
{
/* same for numeric */
- v.val.numeric =
+ v.val.numeric =
DatumGetNumeric(DirectFunctionCall1(numeric_uplus,
- NumericGetDatum(v.val.numeric)));
+ NumericGetDatum(v.val.numeric)));
}
result->res = pushJsonbValue(&result->parseState,
@@ -1693,15 +1700,15 @@ jsonb_agg_finalfn(PG_FUNCTION_ARGS)
/*
* We need to do a shallow clone of the argument in case the final
- * function is called more than once, so we avoid changing the argument.
- * A shallow clone is sufficient as we aren't going to change any of the
+ * function is called more than once, so we avoid changing the argument. A
+ * shallow clone is sufficient as we aren't going to change any of the
* values, just add the final array end marker.
*/
result.parseState = clone_parse_state(arg->parseState);
result.res = pushJsonbValue(&result.parseState,
- WJB_END_ARRAY, NULL);
+ WJB_END_ARRAY, NULL);
out = JsonbValueToJsonb(result.res);
@@ -1813,6 +1820,7 @@ jsonb_object_agg_transfn(PG_FUNCTION_ARGS)
{
/* copy string values in the aggregate context */
char *buf = palloc(v.val.string.len + 1);
+
snprintf(buf, v.val.string.len + 1, "%s", v.val.string.val);
v.val.string.val = buf;
}
@@ -1871,6 +1879,7 @@ jsonb_object_agg_transfn(PG_FUNCTION_ARGS)
{
/* copy string values in the aggregate context */
char *buf = palloc(v.val.string.len + 1);
+
snprintf(buf, v.val.string.len + 1, "%s", v.val.string.val);
v.val.string.val = buf;
}
@@ -1878,8 +1887,8 @@ jsonb_object_agg_transfn(PG_FUNCTION_ARGS)
{
/* same for numeric */
v.val.numeric =
- DatumGetNumeric(DirectFunctionCall1(numeric_uplus,
- NumericGetDatum(v.val.numeric)));
+ DatumGetNumeric(DirectFunctionCall1(numeric_uplus,
+ NumericGetDatum(v.val.numeric)));
}
result->res = pushJsonbValue(&result->parseState,
@@ -1900,7 +1909,7 @@ Datum
jsonb_object_agg_finalfn(PG_FUNCTION_ARGS)
{
JsonbInState *arg;
- JsonbInState result;
+ JsonbInState result;
Jsonb *out;
/* cannot be called directly because of internal-type argument */
@@ -1913,15 +1922,15 @@ jsonb_object_agg_finalfn(PG_FUNCTION_ARGS)
/*
* We need to do a shallow clone of the argument in case the final
- * function is called more than once, so we avoid changing the argument.
- * A shallow clone is sufficient as we aren't going to change any of the
+ * function is called more than once, so we avoid changing the argument. A
+ * shallow clone is sufficient as we aren't going to change any of the
* values, just add the final object end marker.
*/
result.parseState = clone_parse_state(arg->parseState);
result.res = pushJsonbValue(&result.parseState,
- WJB_END_OBJECT, NULL);
+ WJB_END_OBJECT, NULL);
out = JsonbValueToJsonb(result.res);
diff --git a/src/backend/utils/adt/jsonb_util.c b/src/backend/utils/adt/jsonb_util.c
index 974e3865249..4d733159d06 100644
--- a/src/backend/utils/adt/jsonb_util.c
+++ b/src/backend/utils/adt/jsonb_util.c
@@ -58,8 +58,8 @@ static int lengthCompareJsonbStringValue(const void *a, const void *b);
static int lengthCompareJsonbPair(const void *a, const void *b, void *arg);
static void uniqueifyJsonbObject(JsonbValue *object);
static JsonbValue *pushJsonbValueScalar(JsonbParseState **pstate,
- JsonbIteratorToken seq,
- JsonbValue *scalarVal);
+ JsonbIteratorToken seq,
+ JsonbValue *scalarVal);
/*
* Turn an in-memory JsonbValue into a Jsonb for on-disk storage.
@@ -518,7 +518,7 @@ pushJsonbValue(JsonbParseState **pstate, JsonbIteratorToken seq,
{
JsonbIterator *it;
JsonbValue *res = NULL;
- JsonbValue v;
+ JsonbValue v;
JsonbIteratorToken tok;
if (!jbval || (seq != WJB_ELEM && seq != WJB_VALUE) ||
@@ -543,7 +543,7 @@ pushJsonbValue(JsonbParseState **pstate, JsonbIteratorToken seq,
*/
static JsonbValue *
pushJsonbValueScalar(JsonbParseState **pstate, JsonbIteratorToken seq,
- JsonbValue *scalarVal)
+ JsonbValue *scalarVal)
{
JsonbValue *result = NULL;
@@ -1231,6 +1231,7 @@ JsonbHashScalarValue(const JsonbValue *scalarVal, uint32 *hash)
break;
case jbvBool:
tmp = scalarVal->val.boolean ? 0x02 : 0x04;
+
break;
default:
elog(ERROR, "invalid jsonb scalar type");
@@ -1304,7 +1305,7 @@ compareJsonbScalarValue(JsonbValue *aScalar, JsonbValue *bScalar)
case jbvBool:
if (aScalar->val.boolean == bScalar->val.boolean)
return 0;
- else if (aScalar->val.boolean > bScalar->val.boolean)
+ else if (aScalar->val.boolean >bScalar->val.boolean)
return 1;
else
return -1;
diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c
index 9987c73784c..2f755744c13 100644
--- a/src/backend/utils/adt/jsonfuncs.c
+++ b/src/backend/utils/adt/jsonfuncs.c
@@ -110,8 +110,8 @@ static void sn_object_start(void *state);
static void sn_object_end(void *state);
static void sn_array_start(void *state);
static void sn_array_end(void *state);
-static void sn_object_field_start (void *state, char *fname, bool isnull);
-static void sn_array_element_start (void *state, bool isnull);
+static void sn_object_field_start(void *state, char *fname, bool isnull);
+static void sn_array_element_start(void *state, bool isnull);
static void sn_scalar(void *state, char *token, JsonTokenType tokentype);
/* worker function for populate_recordset and to_recordset */
@@ -126,18 +126,18 @@ static JsonbValue *findJsonbValueFromContainerLen(JsonbContainer *container,
/* functions supporting jsonb_delete, jsonb_replace and jsonb_concat */
static JsonbValue *IteratorConcat(JsonbIterator **it1, JsonbIterator **it2,
- JsonbParseState **state);
+ JsonbParseState **state);
static JsonbValue *walkJsonb(JsonbIterator **it, JsonbParseState **state, bool stop_at_level_zero);
static JsonbValue *replacePath(JsonbIterator **it, Datum *path_elems,
- bool *path_nulls, int path_len,
- JsonbParseState **st, int level, Jsonb *newval);
+ bool *path_nulls, int path_len,
+ JsonbParseState **st, int level, Jsonb *newval);
static void replacePathObject(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
- int path_len, JsonbParseState **st, int level,
- Jsonb *newval, uint32 nelems);
+ int path_len, JsonbParseState **st, int level,
+ Jsonb *newval, uint32 nelems);
static void replacePathArray(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
- int path_len, JsonbParseState **st, int level,
- Jsonb *newval, uint32 npairs);
-static void addJsonbToParseState(JsonbParseState **jbps, Jsonb * jb);
+ int path_len, JsonbParseState **st, int level,
+ Jsonb *newval, uint32 npairs);
+static void addJsonbToParseState(JsonbParseState **jbps, Jsonb *jb);
/* state for json_object_keys */
typedef struct OkeysState
@@ -250,10 +250,11 @@ typedef struct PopulateRecordsetState
} PopulateRecordsetState;
/* state for json_strip_nulls */
-typedef struct StripnullState{
+typedef struct StripnullState
+{
JsonLexContext *lex;
- StringInfo strval;
- bool skip_next_null;
+ StringInfo strval;
+ bool skip_next_null;
} StripnullState;
/* Turn a jsonb object into a record */
@@ -3045,6 +3046,7 @@ static void
sn_object_start(void *state)
{
StripnullState *_state = (StripnullState *) state;
+
appendStringInfoCharMacro(_state->strval, '{');
}
@@ -3052,6 +3054,7 @@ static void
sn_object_end(void *state)
{
StripnullState *_state = (StripnullState *) state;
+
appendStringInfoCharMacro(_state->strval, '}');
}
@@ -3059,6 +3062,7 @@ static void
sn_array_start(void *state)
{
StripnullState *_state = (StripnullState *) state;
+
appendStringInfoCharMacro(_state->strval, '[');
}
@@ -3066,21 +3070,21 @@ static void
sn_array_end(void *state)
{
StripnullState *_state = (StripnullState *) state;
+
appendStringInfoCharMacro(_state->strval, ']');
}
static void
-sn_object_field_start (void *state, char *fname, bool isnull)
+sn_object_field_start(void *state, char *fname, bool isnull)
{
StripnullState *_state = (StripnullState *) state;
if (isnull)
{
/*
- * The next thing must be a scalar or isnull couldn't be true,
- * so there is no danger of this state being carried down
- * into a nested object or array. The flag will be reset in the
- * scalar action.
+ * The next thing must be a scalar or isnull couldn't be true, so
+ * there is no danger of this state being carried down into a nested
+ * object or array. The flag will be reset in the scalar action.
*/
_state->skip_next_null = true;
return;
@@ -3090,16 +3094,16 @@ sn_object_field_start (void *state, char *fname, bool isnull)
appendStringInfoCharMacro(_state->strval, ',');
/*
- * Unfortunately we don't have the quoted and escaped string any more,
- * so we have to re-escape it.
+ * Unfortunately we don't have the quoted and escaped string any more, so
+ * we have to re-escape it.
*/
- escape_json(_state->strval,fname);
+ escape_json(_state->strval, fname);
appendStringInfoCharMacro(_state->strval, ':');
}
static void
-sn_array_element_start (void *state, bool isnull)
+sn_array_element_start(void *state, bool isnull)
{
StripnullState *_state = (StripnullState *) state;
@@ -3114,7 +3118,7 @@ sn_scalar(void *state, char *token, JsonTokenType tokentype)
if (_state->skip_next_null)
{
- Assert (tokentype == JSON_TOKEN_NULL);
+ Assert(tokentype == JSON_TOKEN_NULL);
_state->skip_next_null = false;
return;
}
@@ -3132,7 +3136,7 @@ Datum
json_strip_nulls(PG_FUNCTION_ARGS)
{
text *json = PG_GETARG_TEXT_P(0);
- StripnullState *state;
+ StripnullState *state;
JsonLexContext *lex;
JsonSemAction *sem;
@@ -3166,13 +3170,14 @@ json_strip_nulls(PG_FUNCTION_ARGS)
Datum
jsonb_strip_nulls(PG_FUNCTION_ARGS)
{
- Jsonb * jb = PG_GETARG_JSONB(0);
+ Jsonb *jb = PG_GETARG_JSONB(0);
JsonbIterator *it;
JsonbParseState *parseState = NULL;
JsonbValue *res = NULL;
- int type;
- JsonbValue v,k;
- bool last_was_key = false;
+ int type;
+ JsonbValue v,
+ k;
+ bool last_was_key = false;
if (JB_ROOT_IS_SCALAR(jb))
PG_RETURN_POINTER(jb);
@@ -3181,7 +3186,7 @@ jsonb_strip_nulls(PG_FUNCTION_ARGS)
while ((type = JsonbIteratorNext(&it, &v, false)) != WJB_DONE)
{
- Assert( ! (type == WJB_KEY && last_was_key));
+ Assert(!(type == WJB_KEY && last_was_key));
if (type == WJB_KEY)
{
@@ -3225,13 +3230,12 @@ jsonb_strip_nulls(PG_FUNCTION_ARGS)
* like getting jbvBinary values, so we can't just push jb as a whole.
*/
static void
-addJsonbToParseState(JsonbParseState **jbps, Jsonb * jb)
+addJsonbToParseState(JsonbParseState **jbps, Jsonb *jb)
{
-
JsonbIterator *it;
- JsonbValue *o = &(*jbps)->contVal;
- int type;
- JsonbValue v;
+ JsonbValue *o = &(*jbps)->contVal;
+ int type;
+ JsonbValue v;
it = JsonbIteratorInit(&jb->root);
@@ -3239,8 +3243,8 @@ addJsonbToParseState(JsonbParseState **jbps, Jsonb * jb)
if (JB_ROOT_IS_SCALAR(jb))
{
- (void) JsonbIteratorNext(&it, &v, false); /* skip array header */
- (void) JsonbIteratorNext(&it, &v, false); /* fetch scalar value */
+ (void) JsonbIteratorNext(&it, &v, false); /* skip array header */
+ (void) JsonbIteratorNext(&it, &v, false); /* fetch scalar value */
switch (o->type)
{
@@ -3297,8 +3301,8 @@ jsonb_concat(PG_FUNCTION_ARGS)
Jsonb *out = palloc(VARSIZE(jb1) + VARSIZE(jb2));
JsonbParseState *state = NULL;
JsonbValue *res;
- JsonbIterator *it1,
- *it2;
+ JsonbIterator *it1,
+ *it2;
/*
* If one of the jsonb is empty, just return other.
@@ -3453,7 +3457,7 @@ jsonb_delete_idx(PG_FUNCTION_ARGS)
res = pushJsonbValue(&state, r, r < WJB_BEGIN_ARRAY ? &v : NULL);
}
- Assert (res != NULL);
+ Assert(res != NULL);
PG_RETURN_JSONB(JsonbValueToJsonb(res));
}
@@ -3497,7 +3501,7 @@ jsonb_replace(PG_FUNCTION_ARGS)
res = replacePath(&it, path_elems, path_nulls, path_len, &st, 0, newval);
- Assert (res != NULL);
+ Assert(res != NULL);
PG_RETURN_JSONB(JsonbValueToJsonb(res));
}
@@ -3541,7 +3545,7 @@ jsonb_delete_path(PG_FUNCTION_ARGS)
res = replacePath(&it, path_elems, path_nulls, path_len, &st, 0, NULL);
- Assert (res != NULL);
+ Assert(res != NULL);
PG_RETURN_JSONB(JsonbValueToJsonb(res));
}
@@ -3687,7 +3691,7 @@ walkJsonb(JsonbIterator **it, JsonbParseState **state, bool stop_at_level_zero)
{
uint32 r,
level = 1;
- JsonbValue v;
+ JsonbValue v;
JsonbValue *res = NULL;
while ((r = JsonbIteratorNext(it, &v, false)) != WJB_DONE)
@@ -3758,7 +3762,7 @@ replacePath(JsonbIterator **it, Datum *path_elems,
static void
replacePathObject(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
int path_len, JsonbParseState **st, int level,
- Jsonb *newval, uint32 nelems)
+ Jsonb *newval, uint32 nelems)
{
JsonbValue v;
int i;
@@ -3770,7 +3774,8 @@ replacePathObject(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
for (i = 0; i < nelems; i++)
{
- int r = JsonbIteratorNext(it, &k, true);
+ int r = JsonbIteratorNext(it, &k, true);
+
Assert(r == WJB_KEY);
if (!done &&
@@ -3780,7 +3785,7 @@ replacePathObject(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
{
if (level == path_len - 1)
{
- r = JsonbIteratorNext(it, &v, true); /* skip */
+ r = JsonbIteratorNext(it, &v, true); /* skip */
if (newval != NULL)
{
(void) pushJsonbValue(st, WJB_KEY, &k);
@@ -3801,7 +3806,7 @@ replacePathObject(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
(void) pushJsonbValue(st, r, r < WJB_BEGIN_ARRAY ? &v : NULL);
if (r == WJB_BEGIN_ARRAY || r == WJB_BEGIN_OBJECT)
{
- int walking_level = 1;
+ int walking_level = 1;
while (walking_level != 0)
{
@@ -3859,13 +3864,13 @@ replacePathArray(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
/* iterate over the array elements */
for (i = 0; i < npairs; i++)
{
- int r;
+ int r;
if (i == idx && level < path_len)
{
if (level == path_len - 1)
{
- r = JsonbIteratorNext(it, &v, true); /* skip */
+ r = JsonbIteratorNext(it, &v, true); /* skip */
if (newval != NULL)
addJsonbToParseState(st, newval);
}
@@ -3881,7 +3886,7 @@ replacePathArray(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
if (r == WJB_BEGIN_ARRAY || r == WJB_BEGIN_OBJECT)
{
- int walking_level = 1;
+ int walking_level = 1;
while (walking_level != 0)
{
diff --git a/src/backend/utils/adt/levenshtein.c b/src/backend/utils/adt/levenshtein.c
index f6e2ca6452a..2c30b6c8e9d 100644
--- a/src/backend/utils/adt/levenshtein.c
+++ b/src/backend/utils/adt/levenshtein.c
@@ -96,8 +96,8 @@ varstr_levenshtein(const char *source, int slen, const char *target, int tlen,
#endif
/*
- * A common use for Levenshtein distance is to match attributes when building
- * diagnostic, user-visible messages. Restrict the size of
+ * A common use for Levenshtein distance is to match attributes when
+ * building diagnostic, user-visible messages. Restrict the size of
* MAX_LEVENSHTEIN_STRLEN at compile time so that this is guaranteed to
* work.
*/
diff --git a/src/backend/utils/adt/lockfuncs.c b/src/backend/utils/adt/lockfuncs.c
index 9d53a8b6a32..1705ff0d118 100644
--- a/src/backend/utils/adt/lockfuncs.c
+++ b/src/backend/utils/adt/lockfuncs.c
@@ -419,7 +419,7 @@ PreventAdvisoryLocksInParallelMode(void)
if (IsInParallelMode())
ereport(ERROR,
(errcode(ERRCODE_INVALID_TRANSACTION_STATE),
- errmsg("cannot use advisory locks during a parallel operation")));
+ errmsg("cannot use advisory locks during a parallel operation")));
}
/*
diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c
index 61d609f9181..de68cdddf1d 100644
--- a/src/backend/utils/adt/misc.c
+++ b/src/backend/utils/adt/misc.c
@@ -187,7 +187,7 @@ pg_terminate_backend(PG_FUNCTION_ARGS)
if (r == SIGNAL_BACKEND_NOSUPERUSER)
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- (errmsg("must be a superuser to terminate superuser process"))));
+ (errmsg("must be a superuser to terminate superuser process"))));
if (r == SIGNAL_BACKEND_NOPERMISSION)
ereport(ERROR,
diff --git a/src/backend/utils/adt/network_gist.c b/src/backend/utils/adt/network_gist.c
index 0fdb17f947f..756237e751c 100644
--- a/src/backend/utils/adt/network_gist.c
+++ b/src/backend/utils/adt/network_gist.c
@@ -595,10 +595,10 @@ inet_gist_decompress(PG_FUNCTION_ARGS)
Datum
inet_gist_fetch(PG_FUNCTION_ARGS)
{
- GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
- GistInetKey *key = DatumGetInetKeyP(entry->key);
- GISTENTRY *retval;
- inet *dst;
+ GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
+ GistInetKey *key = DatumGetInetKeyP(entry->key);
+ GISTENTRY *retval;
+ inet *dst;
dst = (inet *) palloc0(sizeof(inet));
diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c
index 3cef3048eb3..7ce41b78888 100644
--- a/src/backend/utils/adt/numeric.c
+++ b/src/backend/utils/adt/numeric.c
@@ -1731,7 +1731,7 @@ numeric_abbrev_abort(int memtupcount, SortSupport ssup)
if (trace_sort)
elog(LOG,
"numeric_abbrev: aborting abbreviation at cardinality %f"
- " below threshold %f after " INT64_FORMAT " values (%d rows)",
+ " below threshold %f after " INT64_FORMAT " values (%d rows)",
abbr_card, nss->input_count / 10000.0 + 0.5,
nss->input_count, memtupcount);
#endif
@@ -3408,10 +3408,10 @@ numeric_accum_inv(PG_FUNCTION_ARGS)
#ifdef HAVE_INT128
typedef struct Int128AggState
{
- bool calcSumX2; /* if true, calculate sumX2 */
- int64 N; /* count of processed numbers */
- int128 sumX; /* sum of processed numbers */
- int128 sumX2; /* sum of squares of processed numbers */
+ bool calcSumX2; /* if true, calculate sumX2 */
+ int64 N; /* count of processed numbers */
+ int128 sumX; /* sum of processed numbers */
+ int128 sumX2; /* sum of squares of processed numbers */
} Int128AggState;
/*
@@ -3703,9 +3703,9 @@ Datum
numeric_poly_sum(PG_FUNCTION_ARGS)
{
#ifdef HAVE_INT128
- PolyNumAggState *state;
- Numeric res;
- NumericVar result;
+ PolyNumAggState *state;
+ Numeric res;
+ NumericVar result;
state = PG_ARGISNULL(0) ? NULL : (PolyNumAggState *) PG_GETARG_POINTER(0);
@@ -3731,9 +3731,10 @@ Datum
numeric_poly_avg(PG_FUNCTION_ARGS)
{
#ifdef HAVE_INT128
- PolyNumAggState *state;
- NumericVar result;
- Datum countd, sumd;
+ PolyNumAggState *state;
+ NumericVar result;
+ Datum countd,
+ sumd;
state = PG_ARGISNULL(0) ? NULL : (PolyNumAggState *) PG_GETARG_POINTER(0);
@@ -3962,8 +3963,8 @@ numeric_stddev_pop(PG_FUNCTION_ARGS)
#ifdef HAVE_INT128
static Numeric
numeric_poly_stddev_internal(Int128AggState *state,
- bool variance, bool sample,
- bool *is_null)
+ bool variance, bool sample,
+ bool *is_null)
{
NumericAggState numstate;
Numeric res;
@@ -3997,9 +3998,9 @@ Datum
numeric_poly_var_samp(PG_FUNCTION_ARGS)
{
#ifdef HAVE_INT128
- PolyNumAggState *state;
- Numeric res;
- bool is_null;
+ PolyNumAggState *state;
+ Numeric res;
+ bool is_null;
state = PG_ARGISNULL(0) ? NULL : (PolyNumAggState *) PG_GETARG_POINTER(0);
@@ -4018,9 +4019,9 @@ Datum
numeric_poly_stddev_samp(PG_FUNCTION_ARGS)
{
#ifdef HAVE_INT128
- PolyNumAggState *state;
- Numeric res;
- bool is_null;
+ PolyNumAggState *state;
+ Numeric res;
+ bool is_null;
state = PG_ARGISNULL(0) ? NULL : (PolyNumAggState *) PG_GETARG_POINTER(0);
@@ -4039,9 +4040,9 @@ Datum
numeric_poly_var_pop(PG_FUNCTION_ARGS)
{
#ifdef HAVE_INT128
- PolyNumAggState *state;
- Numeric res;
- bool is_null;
+ PolyNumAggState *state;
+ Numeric res;
+ bool is_null;
state = PG_ARGISNULL(0) ? NULL : (PolyNumAggState *) PG_GETARG_POINTER(0);
@@ -4060,9 +4061,9 @@ Datum
numeric_poly_stddev_pop(PG_FUNCTION_ARGS)
{
#ifdef HAVE_INT128
- PolyNumAggState *state;
- Numeric res;
- bool is_null;
+ PolyNumAggState *state;
+ Numeric res;
+ bool is_null;
state = PG_ARGISNULL(0) ? NULL : (PolyNumAggState *) PG_GETARG_POINTER(0);
@@ -5306,10 +5307,10 @@ int64_to_numericvar(int64 val, NumericVar *var)
static void
int128_to_numericvar(int128 val, NumericVar *var)
{
- uint128 uval,
- newuval;
- NumericDigit *ptr;
- int ndigits;
+ uint128 uval,
+ newuval;
+ NumericDigit *ptr;
+ int ndigits;
/* int128 can require at most 39 decimal digits; add one for safety */
alloc_var(var, 40 / DEC_DIGITS);
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index d84969f770b..4be735e918d 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -635,7 +635,7 @@ cache_single_time(char **dst, const char *format, const struct tm * tm)
/*
* MAX_L10N_DATA is sufficient buffer space for every known locale, and
* POSIX defines no strftime() errors. (Buffer space exhaustion is not an
- * error.) An implementation might report errors (e.g. ENOMEM) by
+ * error.) An implementation might report errors (e.g. ENOMEM) by
* returning 0 (or, less plausibly, a negative value) and setting errno.
* Report errno just in case the implementation did that, but clear it in
* advance of the call so we don't emit a stale, unrelated errno.
diff --git a/src/backend/utils/adt/pg_upgrade_support.c b/src/backend/utils/adt/pg_upgrade_support.c
index d69fa53567b..883378e5240 100644
--- a/src/backend/utils/adt/pg_upgrade_support.c
+++ b/src/backend/utils/adt/pg_upgrade_support.c
@@ -20,19 +20,19 @@
#include "utils/builtins.h"
-Datum binary_upgrade_set_next_pg_type_oid(PG_FUNCTION_ARGS);
-Datum binary_upgrade_set_next_array_pg_type_oid(PG_FUNCTION_ARGS);
-Datum binary_upgrade_set_next_toast_pg_type_oid(PG_FUNCTION_ARGS);
-Datum binary_upgrade_set_next_heap_pg_class_oid(PG_FUNCTION_ARGS);
-Datum binary_upgrade_set_next_index_pg_class_oid(PG_FUNCTION_ARGS);
-Datum binary_upgrade_set_next_toast_pg_class_oid(PG_FUNCTION_ARGS);
-Datum binary_upgrade_set_next_pg_enum_oid(PG_FUNCTION_ARGS);
-Datum binary_upgrade_set_next_pg_authid_oid(PG_FUNCTION_ARGS);
-Datum binary_upgrade_create_empty_extension(PG_FUNCTION_ARGS);
-
-
-#define CHECK_IS_BINARY_UPGRADE \
-do { \
+Datum binary_upgrade_set_next_pg_type_oid(PG_FUNCTION_ARGS);
+Datum binary_upgrade_set_next_array_pg_type_oid(PG_FUNCTION_ARGS);
+Datum binary_upgrade_set_next_toast_pg_type_oid(PG_FUNCTION_ARGS);
+Datum binary_upgrade_set_next_heap_pg_class_oid(PG_FUNCTION_ARGS);
+Datum binary_upgrade_set_next_index_pg_class_oid(PG_FUNCTION_ARGS);
+Datum binary_upgrade_set_next_toast_pg_class_oid(PG_FUNCTION_ARGS);
+Datum binary_upgrade_set_next_pg_enum_oid(PG_FUNCTION_ARGS);
+Datum binary_upgrade_set_next_pg_authid_oid(PG_FUNCTION_ARGS);
+Datum binary_upgrade_create_empty_extension(PG_FUNCTION_ARGS);
+
+
+#define CHECK_IS_BINARY_UPGRADE \
+do { \
if (!IsBinaryUpgrade) \
ereport(ERROR, \
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM), \
diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c
index 2b3778b03ad..f7c9bf63338 100644
--- a/src/backend/utils/adt/pgstatfuncs.c
+++ b/src/backend/utils/adt/pgstatfuncs.c
@@ -531,14 +531,14 @@ Datum
pg_stat_get_activity(PG_FUNCTION_ARGS)
{
#define PG_STAT_GET_ACTIVITY_COLS 22
- int num_backends = pgstat_fetch_stat_numbackends();
- int curr_backend;
- int pid = PG_ARGISNULL(0) ? -1 : PG_GETARG_INT32(0);
- ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
- TupleDesc tupdesc;
- Tuplestorestate *tupstore;
- MemoryContext per_query_ctx;
- MemoryContext oldcontext;
+ int num_backends = pgstat_fetch_stat_numbackends();
+ int curr_backend;
+ int pid = PG_ARGISNULL(0) ? -1 : PG_GETARG_INT32(0);
+ ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
+ TupleDesc tupdesc;
+ Tuplestorestate *tupstore;
+ MemoryContext per_query_ctx;
+ MemoryContext oldcontext;
/* check to see if caller supports us returning a tuplestore */
if (rsinfo == NULL || !IsA(rsinfo, ReturnSetInfo))
@@ -628,7 +628,7 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
if (beentry->st_ssl)
{
- values[16] = BoolGetDatum(true); /* ssl */
+ values[16] = BoolGetDatum(true); /* ssl */
values[17] = CStringGetTextDatum(beentry->st_sslstatus->ssl_version);
values[18] = CStringGetTextDatum(beentry->st_sslstatus->ssl_cipher);
values[19] = Int32GetDatum(beentry->st_sslstatus->ssl_bits);
@@ -637,7 +637,7 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
}
else
{
- values[16] = BoolGetDatum(false); /* ssl */
+ values[16] = BoolGetDatum(false); /* ssl */
nulls[17] = nulls[18] = nulls[19] = nulls[20] = nulls[21] = true;
}
diff --git a/src/backend/utils/adt/rangetypes_spgist.c b/src/backend/utils/adt/rangetypes_spgist.c
index 9281529d7a1..3b5529eb302 100644
--- a/src/backend/utils/adt/rangetypes_spgist.c
+++ b/src/backend/utils/adt/rangetypes_spgist.c
@@ -583,7 +583,7 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
*/
cmp = adjacent_inner_consistent(typcache, &lower,
&centroidUpper,
- prevCentroid ? &prevUpper : NULL);
+ prevCentroid ? &prevUpper : NULL);
if (cmp > 0)
which1 = (1 << 1) | (1 << 4);
else if (cmp < 0)
@@ -594,12 +594,12 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
/*
* Also search for ranges's adjacent to argument's upper
* bound. They will be found along the line adjacent to
- * (and just right of) X=upper, which falls in quadrants
- * 3 and 4, or 1 and 2.
+ * (and just right of) X=upper, which falls in quadrants 3
+ * and 4, or 1 and 2.
*/
cmp = adjacent_inner_consistent(typcache, &upper,
&centroidLower,
- prevCentroid ? &prevLower : NULL);
+ prevCentroid ? &prevLower : NULL);
if (cmp > 0)
which2 = (1 << 1) | (1 << 2);
else if (cmp < 0)
@@ -782,7 +782,7 @@ adjacent_cmp_bounds(TypeCacheEntry *typcache, RangeBound *arg,
Assert(arg->lower != centroid->lower);
- cmp = range_cmp_bounds(typcache, arg, centroid);
+ cmp = range_cmp_bounds(typcache, arg, centroid);
if (centroid->lower)
{
@@ -799,11 +799,11 @@ adjacent_cmp_bounds(TypeCacheEntry *typcache, RangeBound *arg,
* With the argument range [..., 500), the adjacent range we're
* searching for is [500, ...):
*
- * ARGUMENT CENTROID CMP ADJ
- * [..., 500) [498, ...) > (N) [500, ...) is to the right
- * [..., 500) [499, ...) = (N) [500, ...) is to the right
- * [..., 500) [500, ...) < Y [500, ...) is to the right
- * [..., 500) [501, ...) < N [500, ...) is to the left
+ * ARGUMENT CENTROID CMP ADJ
+ * [..., 500) [498, ...) > (N) [500, ...) is to the right
+ * [..., 500) [499, ...) = (N) [500, ...) is to the right
+ * [..., 500) [500, ...) < Y [500, ...) is to the right
+ * [..., 500) [501, ...) < N [500, ...) is to the left
*
* So, we must search left when the argument is smaller than, and not
* adjacent, to the centroid. Otherwise search right.
@@ -821,11 +821,11 @@ adjacent_cmp_bounds(TypeCacheEntry *typcache, RangeBound *arg,
* bounds. A matching adjacent upper bound must be *smaller* than the
* argument, but only just.
*
- * ARGUMENT CENTROID CMP ADJ
- * [500, ...) [..., 499) > (N) [..., 500) is to the right
- * [500, ...) [..., 500) > (Y) [..., 500) is to the right
- * [500, ...) [..., 501) = (N) [..., 500) is to the left
- * [500, ...) [..., 502) < (N) [..., 500) is to the left
+ * ARGUMENT CENTROID CMP ADJ
+ * [500, ...) [..., 499) > (N) [..., 500) is to the right
+ * [500, ...) [..., 500) > (Y) [..., 500) is to the right
+ * [500, ...) [..., 501) = (N) [..., 500) is to the left
+ * [500, ...) [..., 502) < (N) [..., 500) is to the left
*
* We must search left when the argument is smaller than or equal to
* the centroid. Otherwise search right. We don't need to check
diff --git a/src/backend/utils/adt/regexp.c b/src/backend/utils/adt/regexp.c
index 4f35992629e..6a0fcc20dab 100644
--- a/src/backend/utils/adt/regexp.c
+++ b/src/backend/utils/adt/regexp.c
@@ -696,7 +696,7 @@ similar_escape(PG_FUNCTION_ARGS)
ereport(ERROR,
(errcode(ERRCODE_INVALID_ESCAPE_SEQUENCE),
errmsg("invalid escape string"),
- errhint("Escape string must be empty or one character.")));
+ errhint("Escape string must be empty or one character.")));
}
}
@@ -742,7 +742,8 @@ similar_escape(PG_FUNCTION_ARGS)
if (elen > 1)
{
- int mblen = pg_mblen(p);
+ int mblen = pg_mblen(p);
+
if (mblen > 1)
{
/* slow, multi-byte path */
diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c
index f27131edd16..0bfeb5e3fd7 100644
--- a/src/backend/utils/adt/regproc.c
+++ b/src/backend/utils/adt/regproc.c
@@ -466,7 +466,7 @@ format_procedure_parts(Oid procedure_oid, List **objnames, List **objargs)
*objargs = NIL;
for (i = 0; i < nargs; i++)
{
- Oid thisargtype = procform->proargtypes.values[i];
+ Oid thisargtype = procform->proargtypes.values[i];
*objargs = lappend(*objargs, format_type_be_qualified(thisargtype));
}
@@ -1637,7 +1637,7 @@ regroleout(PG_FUNCTION_ARGS)
}
/*
- * regrolerecv - converts external binary format to regrole
+ * regrolerecv - converts external binary format to regrole
*/
Datum
regrolerecv(PG_FUNCTION_ARGS)
@@ -1647,7 +1647,7 @@ regrolerecv(PG_FUNCTION_ARGS)
}
/*
- * regrolesend - converts regrole to binary format
+ * regrolesend - converts regrole to binary format
*/
Datum
regrolesend(PG_FUNCTION_ARGS)
@@ -1680,7 +1680,7 @@ regnamespacein(PG_FUNCTION_ARGS)
strspn(nsp_name_or_oid, "0123456789") == strlen(nsp_name_or_oid))
{
result = DatumGetObjectId(DirectFunctionCall1(oidin,
- CStringGetDatum(nsp_name_or_oid)));
+ CStringGetDatum(nsp_name_or_oid)));
PG_RETURN_OID(result);
}
diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c
index f6bec8be9bc..88dd3faf2d9 100644
--- a/src/backend/utils/adt/ri_triggers.c
+++ b/src/backend/utils/adt/ri_triggers.c
@@ -3274,7 +3274,7 @@ ri_ReportViolation(const RI_ConstraintInfo *riinfo,
{
int fnum = attnums[idx];
char *name,
- *val;
+ *val;
name = SPI_fname(tupdesc, fnum);
val = SPI_getvalue(violator, tupdesc, fnum);
@@ -3298,11 +3298,11 @@ ri_ReportViolation(const RI_ConstraintInfo *riinfo,
RelationGetRelationName(fk_rel),
NameStr(riinfo->conname)),
has_perm ?
- errdetail("Key (%s)=(%s) is not present in table \"%s\".",
- key_names.data, key_values.data,
- RelationGetRelationName(pk_rel)) :
- errdetail("Key is not present in table \"%s\".",
- RelationGetRelationName(pk_rel)),
+ errdetail("Key (%s)=(%s) is not present in table \"%s\".",
+ key_names.data, key_values.data,
+ RelationGetRelationName(pk_rel)) :
+ errdetail("Key is not present in table \"%s\".",
+ RelationGetRelationName(pk_rel)),
errtableconstraint(fk_rel, NameStr(riinfo->conname))));
else
ereport(ERROR,
@@ -3315,8 +3315,8 @@ ri_ReportViolation(const RI_ConstraintInfo *riinfo,
errdetail("Key (%s)=(%s) is still referenced from table \"%s\".",
key_names.data, key_values.data,
RelationGetRelationName(fk_rel)) :
- errdetail("Key is still referenced from table \"%s\".",
- RelationGetRelationName(fk_rel)),
+ errdetail("Key is still referenced from table \"%s\".",
+ RelationGetRelationName(fk_rel)),
errtableconstraint(fk_rel, NameStr(riinfo->conname))));
}
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 0585251d8fe..c404ae5e4c8 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -106,8 +106,8 @@ typedef struct
int wrapColumn; /* max line length, or -1 for no limit */
int indentLevel; /* current indent level for prettyprint */
bool varprefix; /* TRUE to print prefixes on Vars */
- ParseExprKind special_exprkind; /* set only for exprkinds needing */
- /* special handling */
+ ParseExprKind special_exprkind; /* set only for exprkinds needing */
+ /* special handling */
} deparse_context;
/*
@@ -350,7 +350,7 @@ static void make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
static void make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
int prettyFlags, int wrapColumn);
static void get_tablesample_def(TableSampleClause *tablesample,
- deparse_context *context);
+ deparse_context *context);
static void get_query_def(Query *query, StringInfo buf, List *parentnamespace,
TupleDesc resultDesc,
int prettyFlags, int wrapColumn, int startIndent);
@@ -361,8 +361,8 @@ static void get_select_query_def(Query *query, deparse_context *context,
static void get_insert_query_def(Query *query, deparse_context *context);
static void get_update_query_def(Query *query, deparse_context *context);
static void get_update_query_targetlist_def(Query *query, List *targetList,
- deparse_context *context,
- RangeTblEntry *rte);
+ deparse_context *context,
+ RangeTblEntry *rte);
static void get_delete_query_def(Query *query, deparse_context *context);
static void get_utility_query_def(Query *query, deparse_context *context);
static void get_basic_select_query(Query *query, deparse_context *context,
@@ -376,7 +376,7 @@ static Node *get_rule_sortgroupclause(Index ref, List *tlist,
bool force_colno,
deparse_context *context);
static void get_rule_groupingset(GroupingSet *gset, List *targetlist,
- bool omit_parens, deparse_context *context);
+ bool omit_parens, deparse_context *context);
static void get_rule_orderby(List *orderList, List *targetList,
bool force_colno, deparse_context *context);
static void get_rule_windowclause(Query *query, deparse_context *context);
@@ -424,9 +424,9 @@ static void printSubscripts(ArrayRef *aref, deparse_context *context);
static char *get_relation_name(Oid relid);
static char *generate_relation_name(Oid relid, List *namespaces);
static char *generate_function_name(Oid funcid, int nargs,
- List *argnames, Oid *argtypes,
- bool has_variadic, bool *use_variadic_p,
- ParseExprKind special_exprkind);
+ List *argnames, Oid *argtypes,
+ bool has_variadic, bool *use_variadic_p,
+ ParseExprKind special_exprkind);
static char *generate_operator_name(Oid operid, Oid arg1, Oid arg2);
static text *string_to_text(char *str);
static char *flatten_reloptions(Oid relid);
@@ -1963,7 +1963,7 @@ pg_get_functiondef(PG_FUNCTION_ARGS)
print_function_trftypes(&buf, proctup);
appendStringInfo(&buf, "\n LANGUAGE %s\n",
- quote_identifier(get_language_name(proc->prolang, false)));
+ quote_identifier(get_language_name(proc->prolang, false)));
/* Emit some miscellaneous options on one line */
oldlen = buf.len;
@@ -2364,13 +2364,13 @@ is_input_argument(int nth, const char *argmodes)
static void
print_function_trftypes(StringInfo buf, HeapTuple proctup)
{
- Oid *trftypes;
- int ntypes;
+ Oid *trftypes;
+ int ntypes;
ntypes = get_func_trftypes(proctup, &trftypes);
if (ntypes > 0)
{
- int i;
+ int i;
appendStringInfoString(buf, "\n TRANSFORM ");
for (i = 0; i < ntypes; i++)
@@ -4714,7 +4714,7 @@ get_basic_select_query(Query *query, deparse_context *context,
/* Add the GROUP BY clause if given */
if (query->groupClause != NULL || query->groupingSets != NULL)
{
- ParseExprKind save_exprkind;
+ ParseExprKind save_exprkind;
appendContextKeyword(context, " GROUP BY ",
-PRETTYINDENT_STD, PRETTYINDENT_STD, 1);
@@ -5045,13 +5045,13 @@ get_rule_sortgroupclause(Index ref, List *tlist, bool force_colno,
expr = (Node *) tle->expr;
/*
- * 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. If it's anything more complex than a simple Var, then force
- * extra parens around it, to ensure it can't be misinterpreted as a cube()
- * or rollup() construct.
+ * 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. If it's anything more complex than a
+ * simple Var, then force extra parens around it, to ensure it can't be
+ * misinterpreted as a cube() or rollup() construct.
*/
if (force_colno)
{
@@ -5067,14 +5067,15 @@ get_rule_sortgroupclause(Index ref, List *tlist, bool force_colno,
/*
* We must force parens for function-like expressions even if
* PRETTY_PAREN is off, since those are the ones in danger of
- * misparsing. For other expressions we need to force them
- * only if PRETTY_PAREN is on, since otherwise the expression
- * will output them itself. (We can't skip the parens.)
+ * misparsing. For other expressions we need to force them only if
+ * PRETTY_PAREN is on, since otherwise the expression will output them
+ * itself. (We can't skip the parens.)
*/
- bool need_paren = (PRETTY_PAREN(context)
- || IsA(expr, FuncExpr)
- || IsA(expr, Aggref)
- || IsA(expr, WindowFunc));
+ bool need_paren = (PRETTY_PAREN(context)
+ || IsA(expr, FuncExpr)
+ ||IsA(expr, Aggref)
+ ||IsA(expr, WindowFunc));
+
if (need_paren)
appendStringInfoString(context->buf, "(");
get_rule_expr(expr, context, true);
@@ -5110,7 +5111,7 @@ get_rule_groupingset(GroupingSet *gset, List *targetlist,
foreach(l, gset->content)
{
- Index ref = lfirst_int(l);
+ Index ref = lfirst_int(l);
appendStringInfoString(buf, sep);
get_rule_sortgroupclause(ref, targetlist,
@@ -5502,7 +5503,7 @@ get_insert_query_def(Query *query, deparse_context *context)
}
else if (confl->constraint != InvalidOid)
{
- char *constraint = get_constraint_name(confl->constraint);
+ char *constraint = get_constraint_name(confl->constraint);
appendStringInfo(buf, " ON CONSTRAINT %s",
quote_qualified_identifier(NULL, constraint));
@@ -7917,9 +7918,9 @@ get_rule_expr(Node *node, deparse_context *context,
case T_InferenceElem:
{
- InferenceElem *iexpr = (InferenceElem *) node;
- bool varprefix = context->varprefix;
- bool need_parens;
+ InferenceElem *iexpr = (InferenceElem *) node;
+ bool varprefix = context->varprefix;
+ bool need_parens;
/*
* InferenceElem can only refer to target relation, so a
@@ -7948,13 +7949,13 @@ get_rule_expr(Node *node, deparse_context *context,
if (iexpr->infercollid)
appendStringInfo(buf, " COLLATE %s",
- generate_collation_name(iexpr->infercollid));
+ generate_collation_name(iexpr->infercollid));
/* Add the operator class name, if not default */
if (iexpr->inferopclass)
{
- Oid inferopclass = iexpr->inferopclass;
- Oid inferopcinputtype = get_opclass_input_type(iexpr->inferopclass);
+ Oid inferopclass = iexpr->inferopclass;
+ Oid inferopcinputtype = get_opclass_input_type(iexpr->inferopclass);
get_opclass_name(inferopclass, inferopcinputtype, buf);
}
diff --git a/src/backend/utils/adt/tsquery_op.c b/src/backend/utils/adt/tsquery_op.c
index bd6fc250990..8afd558db33 100644
--- a/src/backend/utils/adt/tsquery_op.c
+++ b/src/backend/utils/adt/tsquery_op.c
@@ -249,6 +249,7 @@ cmp_string(const void *a, const void *b)
{
const char *sa = *((const char **) a);
const char *sb = *((const char **) b);
+
return strcmp(sa, sb);
}
@@ -300,8 +301,8 @@ tsq_mcontains(PG_FUNCTION_ARGS)
result = false;
else
{
- int i;
- int j = 0;
+ int i;
+ int j = 0;
for (i = 0; i < ex_nvalues; i++)
{
diff --git a/src/backend/utils/adt/txid.c b/src/backend/utils/adt/txid.c
index 1d7bb02ca46..ce1d9abddea 100644
--- a/src/backend/utils/adt/txid.c
+++ b/src/backend/utils/adt/txid.c
@@ -142,8 +142,10 @@ cmp_txid(const void *aa, const void *bb)
static void
sort_snapshot(TxidSnapshot *snap)
{
- txid last = 0;
- int nxip, idx1, idx2;
+ txid last = 0;
+ int nxip,
+ idx1,
+ idx2;
if (snap->nxip > 1)
{
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 5fd2bef617f..779729d724a 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -56,14 +56,15 @@ typedef struct
typedef struct
{
- char *buf1; /* 1st string, or abbreviation original string buf */
- char *buf2; /* 2nd string, or abbreviation strxfrm() buf */
- int buflen1;
- int buflen2;
- bool collate_c;
- hyperLogLogState abbr_card; /* Abbreviated key cardinality state */
- hyperLogLogState full_card; /* Full key cardinality state */
- double prop_card; /* Required cardinality proportion */
+ char *buf1; /* 1st string, or abbreviation original string
+ * buf */
+ char *buf2; /* 2nd string, or abbreviation strxfrm() buf */
+ int buflen1;
+ int buflen2;
+ bool collate_c;
+ hyperLogLogState abbr_card; /* Abbreviated key cardinality state */
+ hyperLogLogState full_card; /* Full key cardinality state */
+ double prop_card; /* Required cardinality proportion */
#ifdef HAVE_LOCALE_T
pg_locale_t locale;
#endif
@@ -82,9 +83,9 @@ typedef struct
#define PG_RETURN_UNKNOWN_P(x) PG_RETURN_POINTER(x)
static void btsortsupport_worker(SortSupport ssup, Oid collid);
-static int bttextfastcmp_c(Datum x, Datum y, SortSupport ssup);
-static int bttextfastcmp_locale(Datum x, Datum y, SortSupport ssup);
-static int bttextcmp_abbrev(Datum x, Datum y, SortSupport ssup);
+static int bttextfastcmp_c(Datum x, Datum y, SortSupport ssup);
+static int bttextfastcmp_locale(Datum x, Datum y, SortSupport ssup);
+static int bttextcmp_abbrev(Datum x, Datum y, SortSupport ssup);
static Datum bttext_abbrev_convert(Datum original, SortSupport ssup);
static bool bttext_abbrev_abort(int memtupcount, SortSupport ssup);
static int32 text_length(Datum str);
@@ -1415,8 +1416,8 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid)
}
/*
- * memcmp() can't tell us which of two unequal strings sorts first, but
- * it's a cheap way to tell if they're equal. Testing shows that
+ * memcmp() can't tell us which of two unequal strings sorts first,
+ * but it's a cheap way to tell if they're equal. Testing shows that
* memcmp() followed by strcoll() is only trivially slower than
* strcoll() by itself, so we don't lose much if this doesn't work out
* very often, and if it does - for example, because there are many
@@ -1726,9 +1727,9 @@ bttextcmp(PG_FUNCTION_ARGS)
Datum
bttextsortsupport(PG_FUNCTION_ARGS)
{
- SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
- Oid collid = ssup->ssup_collation;
- MemoryContext oldcontext;
+ SortSupport ssup = (SortSupport) PG_GETARG_POINTER(0);
+ Oid collid = ssup->ssup_collation;
+ MemoryContext oldcontext;
oldcontext = MemoryContextSwitchTo(ssup->ssup_cxt);
@@ -1742,30 +1743,30 @@ bttextsortsupport(PG_FUNCTION_ARGS)
static void
btsortsupport_worker(SortSupport ssup, Oid collid)
{
- bool abbreviate = ssup->abbreviate;
- bool collate_c = false;
- TextSortSupport *tss;
+ bool abbreviate = ssup->abbreviate;
+ bool collate_c = false;
+ TextSortSupport *tss;
#ifdef HAVE_LOCALE_T
- pg_locale_t locale = 0;
+ pg_locale_t locale = 0;
#endif
/*
* If possible, set ssup->comparator to a function which can be used to
* directly compare two datums. If we can do this, we'll avoid the
- * overhead of a trip through the fmgr layer for every comparison,
- * which can be substantial.
+ * overhead of a trip through the fmgr layer for every comparison, which
+ * can be substantial.
*
- * Most typically, we'll set the comparator to bttextfastcmp_locale,
- * which uses strcoll() to perform comparisons. However, if LC_COLLATE
- * = C, we can make things quite a bit faster with bttextfastcmp_c,
- * which uses memcmp() rather than strcoll().
+ * Most typically, we'll set the comparator to bttextfastcmp_locale, which
+ * uses strcoll() to perform comparisons. However, if LC_COLLATE = C, we
+ * can make things quite a bit faster with bttextfastcmp_c, which uses
+ * memcmp() rather than strcoll().
*
- * There is a further exception on Windows. When the database encoding
- * is UTF-8 and we are not using the C collation, complex hacks are
- * required. We don't currently have a comparator that handles that case,
- * so we fall back on the slow method of having the sort code invoke
- * bttextcmp() via the fmgr trampoline.
+ * There is a further exception on Windows. When the database encoding is
+ * UTF-8 and we are not using the C collation, complex hacks are required.
+ * We don't currently have a comparator that handles that case, so we fall
+ * back on the slow method of having the sort code invoke bttextcmp() via
+ * the fmgr trampoline.
*/
if (lc_collate_is_c(collid))
{
@@ -1808,13 +1809,13 @@ btsortsupport_worker(SortSupport ssup, Oid collid)
* It's possible that there are platforms where the use of abbreviated
* keys should be disabled at compile time. Having only 4 byte datums
* could make worst-case performance drastically more likely, for example.
- * Moreover, Darwin's strxfrm() implementations is known to not effectively
- * concentrate a significant amount of entropy from the original string in
- * earlier transformed blobs. It's possible that other supported platforms
- * are similarly encumbered. However, even in those cases, the abbreviated
- * keys optimization may win, and if it doesn't, the "abort abbreviation"
- * code may rescue us. So, for now, we don't disable this anywhere on the
- * basis of performance.
+ * Moreover, Darwin's strxfrm() implementations is known to not
+ * effectively concentrate a significant amount of entropy from the
+ * original string in earlier transformed blobs. It's possible that other
+ * supported platforms are similarly encumbered. However, even in those
+ * cases, the abbreviated keys optimization may win, and if it doesn't,
+ * the "abort abbreviation" code may rescue us. So, for now, we don't
+ * disable this anywhere on the basis of performance.
*/
/*
@@ -1893,16 +1894,16 @@ bttextfastcmp_c(Datum x, Datum y, SortSupport ssup)
static int
bttextfastcmp_locale(Datum x, Datum y, SortSupport ssup)
{
- text *arg1 = DatumGetTextPP(x);
- text *arg2 = DatumGetTextPP(y);
- TextSortSupport *tss = (TextSortSupport *) ssup->ssup_extra;
+ text *arg1 = DatumGetTextPP(x);
+ text *arg2 = DatumGetTextPP(y);
+ TextSortSupport *tss = (TextSortSupport *) ssup->ssup_extra;
/* working state */
- char *a1p,
- *a2p;
- int len1,
- len2,
- result;
+ char *a1p,
+ *a2p;
+ int len1,
+ len2,
+ result;
a1p = VARDATA_ANY(arg1);
a2p = VARDATA_ANY(arg2);
@@ -1943,9 +1944,9 @@ bttextfastcmp_locale(Datum x, Datum y, SortSupport ssup)
result = strcoll(tss->buf1, tss->buf2);
/*
- * In some locales strcoll() can claim that nonidentical strings are equal.
- * Believing that would be bad news for a number of reasons, so we follow
- * Perl's lead and sort "equal" strings according to strcmp().
+ * In some locales strcoll() can claim that nonidentical strings are
+ * equal. Believing that would be bad news for a number of reasons, so we
+ * follow Perl's lead and sort "equal" strings according to strcmp().
*/
if (result == 0)
result = strcmp(tss->buf1, tss->buf2);
@@ -1966,9 +1967,9 @@ done:
static int
bttextcmp_abbrev(Datum x, Datum y, SortSupport ssup)
{
- char *a = (char *) &x;
- char *b = (char *) &y;
- int result;
+ char *a = (char *) &x;
+ char *b = (char *) &y;
+ int result;
result = memcmp(a, b, sizeof(Datum));
@@ -1989,15 +1990,15 @@ bttextcmp_abbrev(Datum x, Datum y, SortSupport ssup)
static Datum
bttext_abbrev_convert(Datum original, SortSupport ssup)
{
- TextSortSupport *tss = (TextSortSupport *) ssup->ssup_extra;
- text *authoritative = DatumGetTextPP(original);
- char *authoritative_data = VARDATA_ANY(authoritative);
+ TextSortSupport *tss = (TextSortSupport *) ssup->ssup_extra;
+ text *authoritative = DatumGetTextPP(original);
+ char *authoritative_data = VARDATA_ANY(authoritative);
/* working state */
- Datum res;
- char *pres;
- int len;
- uint32 hash;
+ Datum res;
+ char *pres;
+ int len;
+ uint32 hash;
/*
* Abbreviated key representation is a pass-by-value Datum that is treated
@@ -2009,8 +2010,8 @@ bttext_abbrev_convert(Datum original, SortSupport ssup)
len = VARSIZE_ANY_EXHDR(authoritative);
/*
- * If we're using the C collation, use memcmp(), rather than strxfrm(),
- * to abbreviate keys. The full comparator for the C locale is always
+ * If we're using the C collation, use memcmp(), rather than strxfrm(), to
+ * abbreviate keys. The full comparator for the C locale is always
* memcmp(), and we can't risk having this give a different answer.
* Besides, this should be faster, too.
*/
@@ -2018,7 +2019,7 @@ bttext_abbrev_convert(Datum original, SortSupport ssup)
memcpy(pres, authoritative_data, Min(len, sizeof(Datum)));
else
{
- Size bsize;
+ Size bsize;
/*
* We're not using the C collation, so fall back on strxfrm.
@@ -2075,8 +2076,8 @@ bttext_abbrev_convert(Datum original, SortSupport ssup)
/*
* Maintain approximate cardinality of both abbreviated keys and original,
* authoritative keys using HyperLogLog. Used as cheap insurance against
- * the worst case, where we do many string transformations for no saving in
- * full strcoll()-based comparisons. These statistics are used by
+ * the worst case, where we do many string transformations for no saving
+ * in full strcoll()-based comparisons. These statistics are used by
* bttext_abbrev_abort().
*
* First, Hash key proper, or a significant fraction of it. Mix in length
@@ -2094,8 +2095,8 @@ bttext_abbrev_convert(Datum original, SortSupport ssup)
/* Hash abbreviated key */
#if SIZEOF_DATUM == 8
{
- uint32 lohalf,
- hihalf;
+ uint32 lohalf,
+ hihalf;
lohalf = (uint32) res;
hihalf = (uint32) (res >> 32);
@@ -2118,8 +2119,9 @@ bttext_abbrev_convert(Datum original, SortSupport ssup)
static bool
bttext_abbrev_abort(int memtupcount, SortSupport ssup)
{
- TextSortSupport *tss = (TextSortSupport *) ssup->ssup_extra;
- double abbrev_distinct, key_distinct;
+ TextSortSupport *tss = (TextSortSupport *) ssup->ssup_extra;
+ double abbrev_distinct,
+ key_distinct;
Assert(ssup->abbreviate);
@@ -2131,9 +2133,9 @@ bttext_abbrev_abort(int memtupcount, SortSupport ssup)
key_distinct = estimateHyperLogLog(&tss->full_card);
/*
- * Clamp cardinality estimates to at least one distinct value. While NULLs
- * are generally disregarded, if only NULL values were seen so far, that
- * might misrepresent costs if we failed to clamp.
+ * Clamp cardinality estimates to at least one distinct value. While
+ * NULLs are generally disregarded, if only NULL values were seen so far,
+ * that might misrepresent costs if we failed to clamp.
*/
if (abbrev_distinct <= 1.0)
abbrev_distinct = 1.0;
@@ -2149,7 +2151,7 @@ bttext_abbrev_abort(int memtupcount, SortSupport ssup)
#ifdef TRACE_SORT
if (trace_sort)
{
- double norm_abbrev_card = abbrev_distinct / (double) memtupcount;
+ double norm_abbrev_card = abbrev_distinct / (double) memtupcount;
elog(LOG, "bttext_abbrev: abbrev_distinct after %d: %f "
"(key_distinct: %f, norm_abbrev_card: %f, prop_card: %f)",
@@ -2180,26 +2182,26 @@ bttext_abbrev_abort(int memtupcount, SortSupport ssup)
* When we have exceeded 10,000 tuples, decay required cardinality
* aggressively for next call.
*
- * This is useful because the number of comparisons required on average
- * increases at a linearithmic rate, and at roughly 10,000 tuples that
- * factor will start to dominate over the linear costs of string
- * transformation (this is a conservative estimate). The decay rate is
- * chosen to be a little less aggressive than halving -- which (since
- * we're called at points at which memtupcount has doubled) would never
- * see the cost model actually abort past the first call following a
- * decay. This decay rate is mostly a precaution against a sudden,
- * violent swing in how well abbreviated cardinality tracks full key
- * cardinality. The decay also serves to prevent a marginal case from
- * being aborted too late, when too much has already been invested in
- * string transformation.
+ * This is useful because the number of comparisons required on
+ * average increases at a linearithmic rate, and at roughly 10,000
+ * tuples that factor will start to dominate over the linear costs of
+ * string transformation (this is a conservative estimate). The decay
+ * rate is chosen to be a little less aggressive than halving -- which
+ * (since we're called at points at which memtupcount has doubled)
+ * would never see the cost model actually abort past the first call
+ * following a decay. This decay rate is mostly a precaution against
+ * a sudden, violent swing in how well abbreviated cardinality tracks
+ * full key cardinality. The decay also serves to prevent a marginal
+ * case from being aborted too late, when too much has already been
+ * invested in string transformation.
*
- * It's possible for sets of several million distinct strings with mere
- * tens of thousands of distinct abbreviated keys to still benefit very
- * significantly. This will generally occur provided each abbreviated
- * key is a proxy for a roughly uniform number of the set's full keys.
- * If it isn't so, we hope to catch that early and abort. If it isn't
- * caught early, by the time the problem is apparent it's probably not
- * worth aborting.
+ * It's possible for sets of several million distinct strings with
+ * mere tens of thousands of distinct abbreviated keys to still
+ * benefit very significantly. This will generally occur provided
+ * each abbreviated key is a proxy for a roughly uniform number of the
+ * set's full keys. If it isn't so, we hope to catch that early and
+ * abort. If it isn't caught early, by the time the problem is
+ * apparent it's probably not worth aborting.
*/
if (memtupcount > 10000)
tss->prop_card *= 0.65;
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c
index 8bb7144ecf9..99bc832ab82 100644
--- a/src/backend/utils/adt/xml.c
+++ b/src/backend/utils/adt/xml.c
@@ -1405,7 +1405,7 @@ xml_parse(text *data, XmlOptionType xmloption_arg, bool preserve_whitespace,
if (*(utf8string + count))
{
res_code = xmlParseBalancedChunkMemory(doc, NULL, NULL, 0,
- utf8string + count, NULL);
+ utf8string + count, NULL);
if (res_code != 0 || xmlerrcxt->err_occurred)
xml_ereport(xmlerrcxt, ERROR, ERRCODE_INVALID_XML_CONTENT,
"invalid XML content");
@@ -3697,7 +3697,7 @@ xml_xpathobjtoxmlarray(xmlXPathObjectPtr xpathobj,
for (i = 0; i < result; i++)
{
datum = PointerGetDatum(xml_xmlnodetoxmltype(xpathobj->nodesetval->nodeTab[i],
- xmlerrcxt));
+ xmlerrcxt));
(void) accumArrayResult(astate, datum, false,
XMLOID, CurrentMemoryContext);
}
diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c
index 1907a874588..c5cc4011bf8 100644
--- a/src/backend/utils/cache/inval.c
+++ b/src/backend/utils/cache/inval.c
@@ -226,7 +226,7 @@ AddInvalidationMessage(InvalidationChunk **listHdr,
chunk = (InvalidationChunk *)
MemoryContextAlloc(CurTransactionContext,
offsetof(InvalidationChunk, msgs) +
- FIRSTCHUNKSIZE * sizeof(SharedInvalidationMessage));
+ FIRSTCHUNKSIZE * sizeof(SharedInvalidationMessage));
chunk->nitems = 0;
chunk->maxitems = FIRSTCHUNKSIZE;
chunk->next = *listHdr;
@@ -240,7 +240,7 @@ AddInvalidationMessage(InvalidationChunk **listHdr,
chunk = (InvalidationChunk *)
MemoryContextAlloc(CurTransactionContext,
offsetof(InvalidationChunk, msgs) +
- chunksize * sizeof(SharedInvalidationMessage));
+ chunksize * sizeof(SharedInvalidationMessage));
chunk->nitems = 0;
chunk->maxitems = chunksize;
chunk->next = *listHdr;
@@ -333,6 +333,7 @@ AddCatcacheInvalidationMessage(InvalidationListHeader *hdr,
msg.cc.id = (int8) id;
msg.cc.dbId = dbId;
msg.cc.hashValue = hashValue;
+
/*
* Define padding bytes in SharedInvalidationMessage structs to be
* defined. Otherwise the sinvaladt.c ringbuffer, which is accessed by
@@ -712,11 +713,11 @@ PrepareInvalidationState(void)
myInfo->my_level = GetCurrentTransactionNestLevel();
/*
- * If there's any previous entry, this one should be for a deeper
- * nesting level.
+ * If there's any previous entry, this one should be for a deeper nesting
+ * level.
*/
Assert(transInvalInfo == NULL ||
- myInfo->my_level > transInvalInfo->my_level);
+ myInfo->my_level > transInvalInfo->my_level);
transInvalInfo = myInfo;
}
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index f259751e157..7b32247d34e 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -3012,8 +3012,8 @@ get_tablesample_method_name(Oid tsmid)
tuple = SearchSysCache1(TABLESAMPLEMETHODOID, ObjectIdGetDatum(tsmid));
if (HeapTupleIsValid(tuple))
{
- Form_pg_tablesample_method tup =
- (Form_pg_tablesample_method) GETSTRUCT(tuple);
+ Form_pg_tablesample_method tup =
+ (Form_pg_tablesample_method) GETSTRUCT(tuple);
char *result;
result = pstrdup(NameStr(tup->tsmname));
diff --git a/src/backend/utils/cache/plancache.c b/src/backend/utils/cache/plancache.c
index 9a26a4efc5a..e6808e75763 100644
--- a/src/backend/utils/cache/plancache.c
+++ b/src/backend/utils/cache/plancache.c
@@ -153,8 +153,8 @@ CreateCachedPlan(Node *raw_parse_tree,
CachedPlanSource *plansource;
MemoryContext source_context;
MemoryContext oldcxt;
- Oid user_id;
- int security_context;
+ Oid user_id;
+ int security_context;
Assert(query_string != NULL); /* required as of 8.4 */
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index e745006b73b..f60f3cb234b 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -873,7 +873,7 @@ equalPolicy(RowSecurityPolicy *policy1, RowSecurityPolicy *policy2)
return false;
if (policy1->hassublinks != policy2->hassublinks)
return false;
- if (strcmp(policy1->policy_name,policy2->policy_name) != 0)
+ if (strcmp(policy1->policy_name, policy2->policy_name) != 0)
return false;
if (ARR_DIMS(policy1->roles)[0] != ARR_DIMS(policy2->roles)[0])
return false;
@@ -906,8 +906,8 @@ equalPolicy(RowSecurityPolicy *policy1, RowSecurityPolicy *policy2)
static bool
equalRSDesc(RowSecurityDesc *rsdesc1, RowSecurityDesc *rsdesc2)
{
- ListCell *lc,
- *rc;
+ ListCell *lc,
+ *rc;
if (rsdesc1 == NULL && rsdesc2 == NULL)
return true;
@@ -922,10 +922,10 @@ equalRSDesc(RowSecurityDesc *rsdesc1, RowSecurityDesc *rsdesc2)
/* RelationBuildRowSecurity should build policies in order */
forboth(lc, rsdesc1->policies, rc, rsdesc2->policies)
{
- RowSecurityPolicy *l = (RowSecurityPolicy *) lfirst(lc);
- RowSecurityPolicy *r = (RowSecurityPolicy *) lfirst(rc);
+ RowSecurityPolicy *l = (RowSecurityPolicy *) lfirst(lc);
+ RowSecurityPolicy *r = (RowSecurityPolicy *) lfirst(rc);
- if (!equalPolicy(l,r))
+ if (!equalPolicy(l, r))
return false;
}
@@ -3460,7 +3460,7 @@ RelationCacheInitializePhase3(void)
{
RelationBuildRowSecurity(relation);
- Assert (relation->rd_rsdesc != NULL);
+ Assert(relation->rd_rsdesc != NULL);
restart = true;
}
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c
index 7def1be32ae..58f90f672e0 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -634,7 +634,7 @@ static const struct cachedesc cacheinfo[] = {
},
16
},
- {ReplicationOriginRelationId, /* REPLORIGNAME */
+ {ReplicationOriginRelationId, /* REPLORIGNAME */
ReplicationOriginNameIndex,
1,
{
@@ -701,26 +701,26 @@ static const struct cachedesc cacheinfo[] = {
4
},
{TransformRelationId, /* TRFOID */
- TransformOidIndexId,
- 1,
- {
- ObjectIdAttributeNumber,
- 0,
- 0,
- 0,
- },
- 16
+ TransformOidIndexId,
+ 1,
+ {
+ ObjectIdAttributeNumber,
+ 0,
+ 0,
+ 0,
+ },
+ 16
},
{TransformRelationId, /* TRFTYPELANG */
- TransformTypeLangIndexId,
- 2,
- {
- Anum_pg_transform_trftype,
- Anum_pg_transform_trflang,
- 0,
- 0,
- },
- 16
+ TransformTypeLangIndexId,
+ 2,
+ {
+ Anum_pg_transform_trftype,
+ Anum_pg_transform_trflang,
+ 0,
+ 0,
+ },
+ 16
},
{TSConfigMapRelationId, /* TSCONFIGMAP */
TSConfigMapIndexId,
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index dfd102a1fbd..088c714821b 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -1592,8 +1592,8 @@ FlushErrorState(void)
void
ThrowErrorData(ErrorData *edata)
{
- ErrorData *newedata;
- MemoryContext oldcontext;
+ ErrorData *newedata;
+ MemoryContext oldcontext;
if (!errstart(edata->elevel, edata->filename, edata->lineno,
edata->funcname, NULL))
diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c
index 46bc1f238f2..cd3db871e0b 100644
--- a/src/backend/utils/fmgr/dfmgr.c
+++ b/src/backend/utils/fmgr/dfmgr.c
@@ -702,7 +702,7 @@ Size
EstimateLibraryStateSpace(void)
{
DynamicFileList *file_scanner;
- Size size = 1;
+ Size size = 1;
for (file_scanner = file_list;
file_scanner != NULL;
@@ -724,7 +724,7 @@ SerializeLibraryState(Size maxsize, char *start_address)
file_scanner != NULL;
file_scanner = file_scanner->next)
{
- Size len;
+ Size len;
len = strlcpy(start_address, file_scanner->filename, maxsize) + 1;
Assert(len < maxsize);
diff --git a/src/backend/utils/fmgr/funcapi.c b/src/backend/utils/fmgr/funcapi.c
index fccef382497..2b09076b61a 100644
--- a/src/backend/utils/fmgr/funcapi.c
+++ b/src/backend/utils/fmgr/funcapi.c
@@ -886,15 +886,14 @@ int
get_func_trftypes(HeapTuple procTup,
Oid **p_trftypes)
{
-
Datum protrftypes;
ArrayType *arr;
int nelems;
- bool isNull;
+ bool isNull;
protrftypes = SysCacheGetAttr(PROCOID, procTup,
- Anum_pg_proc_protrftypes,
- &isNull);
+ Anum_pg_proc_protrftypes,
+ &isNull);
if (!isNull)
{
/*
@@ -903,7 +902,7 @@ get_func_trftypes(HeapTuple procTup,
* deconstruct_array() since the array data is just going to look like
* a C array of values.
*/
- arr = DatumGetArrayTypeP(protrftypes); /* ensure not toasted */
+ arr = DatumGetArrayTypeP(protrftypes); /* ensure not toasted */
nelems = ARR_DIMS(arr)[0];
if (ARR_NDIM(arr) != 1 ||
nelems < 0 ||
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index b0d85af14db..2b53c19fb97 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -246,6 +246,7 @@ SwitchToSharedLatch(void)
Assert(MyProc != NULL);
MyLatch = &MyProc->procLatch;
+
/*
* Set the shared latch as the local one might have been set. This
* shouldn't normally be necessary as code is supposed to check the
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index debadf0f94c..aa67f75c0ca 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -1107,7 +1107,7 @@ ShutdownPostgres(int code, Datum arg)
static void
StatementTimeoutHandler(void)
{
- int sig = SIGINT;
+ int sig = SIGINT;
/*
* During authentication the timeout is used to deal with
diff --git a/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl b/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
index fa60cdc55a0..e73ed4d865e 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
@@ -23,7 +23,7 @@ open(FILE, $in_file) || die("cannot open $in_file");
while (<FILE>)
{
- next if (! m/<a u="([0-9A-F]+)" b="([0-9A-F ]+)"/);
+ next if (!m/<a u="([0-9A-F]+)" b="([0-9A-F ]+)"/);
$u = $1;
$c = $2;
$c =~ s/ //g;
@@ -42,7 +42,7 @@ while (<FILE>)
printf STDERR "Warning: duplicate GB18030: %08x\n", $code;
next;
}
- $arrayu{$utf} = $code;
+ $arrayu{$utf} = $code;
$arrayc{$code} = $utf;
$count++;
}
diff --git a/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl b/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
index edfb61bcd93..33d108e0251 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
@@ -99,7 +99,7 @@ print FILE "/*\n";
print FILE " * This file was generated by UCS_to_SHIFT_JIS_2004.pl\n";
print FILE " */\n";
print FILE
- "static const pg_utf_to_local_combined ULmapSHIFT_JIS_2004_combined[] = {\n";
+"static const pg_utf_to_local_combined ULmapSHIFT_JIS_2004_combined[] = {\n";
for $index (sort { $a cmp $b } keys(%array1))
{
@@ -212,7 +212,7 @@ print FILE "/*\n";
print FILE " * This file was generated by UCS_to_SHIFT_JIS_2004.pl\n";
print FILE " */\n";
print FILE
- "static const pg_local_to_utf_combined LUmapSHIFT_JIS_2004_combined[] = {\n";
+"static const pg_local_to_utf_combined LUmapSHIFT_JIS_2004_combined[] = {\n";
for $index (sort { $a <=> $b } keys(%array1))
{
diff --git a/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c b/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c
index 1d9b10f8a7a..09002a77d8a 100644
--- a/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c
+++ b/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c
@@ -22,7 +22,7 @@ typedef struct
} codes_t;
/* map Big5 Level 1 to CNS 11643-1992 Plane 1 */
-static const codes_t big5Level1ToCnsPlane1[25] = { /* range */
+static const codes_t big5Level1ToCnsPlane1[25] = { /* range */
{0xA140, 0x2121},
{0xA1F6, 0x2258},
{0xA1F7, 0x2257},
@@ -51,7 +51,7 @@ static const codes_t big5Level1ToCnsPlane1[25] = { /* range */
};
/* map CNS 11643-1992 Plane 1 to Big5 Level 1 */
-static const codes_t cnsPlane1ToBig5Level1[26] = { /* range */
+static const codes_t cnsPlane1ToBig5Level1[26] = { /* range */
{0x2121, 0xA140},
{0x2257, 0xA1F7},
{0x2258, 0xA1F6},
@@ -81,7 +81,7 @@ static const codes_t cnsPlane1ToBig5Level1[26] = { /* range */
};
/* map Big5 Level 2 to CNS 11643-1992 Plane 2 */
-static const codes_t big5Level2ToCnsPlane2[48] = { /* range */
+static const codes_t big5Level2ToCnsPlane2[48] = { /* range */
{0xC940, 0x2121},
{0xc94a, 0x0000},
{0xC94B, 0x212B},
@@ -133,7 +133,7 @@ static const codes_t big5Level2ToCnsPlane2[48] = { /* range */
};
/* map CNS 11643-1992 Plane 2 to Big5 Level 2 */
-static const codes_t cnsPlane2ToBig5Level2[49] = { /* range */
+static const codes_t cnsPlane2ToBig5Level2[49] = { /* range */
{0x2121, 0xC940},
{0x212B, 0xC94B},
{0x214C, 0xC9BE},
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 3038d7c9dda..be7ba4f29d8 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -666,11 +666,12 @@ const char *const config_type_names[] =
typedef struct
{
- char unit[MAX_UNIT_LEN + 1]; /* unit, as a string, like "kB" or "min" */
- int base_unit; /* GUC_UNIT_XXX */
- int multiplier; /* If positive, multiply the value with this for
- * unit -> base_unit conversion. If negative,
- * divide (with the absolute value) */
+ char unit[MAX_UNIT_LEN + 1]; /* unit, as a string, like "kB" or
+ * "min" */
+ int base_unit; /* GUC_UNIT_XXX */
+ int multiplier; /* If positive, multiply the value with this
+ * for unit -> base_unit conversion. If
+ * negative, divide (with the absolute value) */
} unit_conversion;
/* Ensure that the constants in the tables don't overflow or underflow */
@@ -684,58 +685,56 @@ typedef struct
#error XLOG_SEG_SIZE must be between 1MB and 1GB
#endif
-static const char *memory_units_hint =
- gettext_noop("Valid units for this parameter are \"kB\", \"MB\", \"GB\", and \"TB\".");
+static const char *memory_units_hint = gettext_noop("Valid units for this parameter are \"kB\", \"MB\", \"GB\", and \"TB\".");
static const unit_conversion memory_unit_conversion_table[] =
{
- { "TB", GUC_UNIT_KB, 1024*1024*1024 },
- { "GB", GUC_UNIT_KB, 1024*1024 },
- { "MB", GUC_UNIT_KB, 1024 },
- { "kB", GUC_UNIT_KB, 1 },
+ {"TB", GUC_UNIT_KB, 1024 * 1024 * 1024},
+ {"GB", GUC_UNIT_KB, 1024 * 1024},
+ {"MB", GUC_UNIT_KB, 1024},
+ {"kB", GUC_UNIT_KB, 1},
- { "TB", GUC_UNIT_BLOCKS, (1024*1024*1024) / (BLCKSZ / 1024) },
- { "GB", GUC_UNIT_BLOCKS, (1024*1024) / (BLCKSZ / 1024) },
- { "MB", GUC_UNIT_BLOCKS, 1024 / (BLCKSZ / 1024) },
- { "kB", GUC_UNIT_BLOCKS, -(BLCKSZ / 1024) },
+ {"TB", GUC_UNIT_BLOCKS, (1024 * 1024 * 1024) / (BLCKSZ / 1024)},
+ {"GB", GUC_UNIT_BLOCKS, (1024 * 1024) / (BLCKSZ / 1024)},
+ {"MB", GUC_UNIT_BLOCKS, 1024 / (BLCKSZ / 1024)},
+ {"kB", GUC_UNIT_BLOCKS, -(BLCKSZ / 1024)},
- { "TB", GUC_UNIT_XBLOCKS, (1024*1024*1024) / (XLOG_BLCKSZ / 1024) },
- { "GB", GUC_UNIT_XBLOCKS, (1024*1024) / (XLOG_BLCKSZ / 1024) },
- { "MB", GUC_UNIT_XBLOCKS, 1024 / (XLOG_BLCKSZ / 1024) },
- { "kB", GUC_UNIT_XBLOCKS, -(XLOG_BLCKSZ / 1024) },
+ {"TB", GUC_UNIT_XBLOCKS, (1024 * 1024 * 1024) / (XLOG_BLCKSZ / 1024)},
+ {"GB", GUC_UNIT_XBLOCKS, (1024 * 1024) / (XLOG_BLCKSZ / 1024)},
+ {"MB", GUC_UNIT_XBLOCKS, 1024 / (XLOG_BLCKSZ / 1024)},
+ {"kB", GUC_UNIT_XBLOCKS, -(XLOG_BLCKSZ / 1024)},
- { "TB", GUC_UNIT_XSEGS, (1024*1024*1024) / (XLOG_SEG_SIZE / 1024) },
- { "GB", GUC_UNIT_XSEGS, (1024*1024) / (XLOG_SEG_SIZE / 1024) },
- { "MB", GUC_UNIT_XSEGS, -(XLOG_SEG_SIZE / (1024 * 1024)) },
- { "kB", GUC_UNIT_XSEGS, -(XLOG_SEG_SIZE / 1024) },
+ {"TB", GUC_UNIT_XSEGS, (1024 * 1024 * 1024) / (XLOG_SEG_SIZE / 1024)},
+ {"GB", GUC_UNIT_XSEGS, (1024 * 1024) / (XLOG_SEG_SIZE / 1024)},
+ {"MB", GUC_UNIT_XSEGS, -(XLOG_SEG_SIZE / (1024 * 1024))},
+ {"kB", GUC_UNIT_XSEGS, -(XLOG_SEG_SIZE / 1024)},
- { "" } /* end of table marker */
+ {""} /* end of table marker */
};
-static const char *time_units_hint =
- gettext_noop("Valid units for this parameter are \"ms\", \"s\", \"min\", \"h\", and \"d\".");
+static const char *time_units_hint = gettext_noop("Valid units for this parameter are \"ms\", \"s\", \"min\", \"h\", and \"d\".");
static const unit_conversion time_unit_conversion_table[] =
{
- { "d", GUC_UNIT_MS, 1000 * 60 * 60 * 24 },
- { "h", GUC_UNIT_MS, 1000 * 60 * 60 },
- { "min", GUC_UNIT_MS, 1000 * 60},
- { "s", GUC_UNIT_MS, 1000 },
- { "ms", GUC_UNIT_MS, 1 },
-
- { "d", GUC_UNIT_S, 60 * 60 * 24 },
- { "h", GUC_UNIT_S, 60 * 60 },
- { "min", GUC_UNIT_S, 60 },
- { "s", GUC_UNIT_S, 1 },
- { "ms", GUC_UNIT_S, -1000 },
-
- { "d", GUC_UNIT_MIN, 60 * 24 },
- { "h", GUC_UNIT_MIN, 60 },
- { "min", GUC_UNIT_MIN, 1 },
- { "s", GUC_UNIT_MIN, -60 },
- { "ms", GUC_UNIT_MIN, -1000 * 60 },
-
- { "" } /* end of table marker */
+ {"d", GUC_UNIT_MS, 1000 * 60 * 60 * 24},
+ {"h", GUC_UNIT_MS, 1000 * 60 * 60},
+ {"min", GUC_UNIT_MS, 1000 * 60},
+ {"s", GUC_UNIT_MS, 1000},
+ {"ms", GUC_UNIT_MS, 1},
+
+ {"d", GUC_UNIT_S, 60 * 60 * 24},
+ {"h", GUC_UNIT_S, 60 * 60},
+ {"min", GUC_UNIT_S, 60},
+ {"s", GUC_UNIT_S, 1},
+ {"ms", GUC_UNIT_S, -1000},
+
+ {"d", GUC_UNIT_MIN, 60 * 24},
+ {"h", GUC_UNIT_MIN, 60},
+ {"min", GUC_UNIT_MIN, 1},
+ {"s", GUC_UNIT_MIN, -60},
+ {"ms", GUC_UNIT_MIN, -1000 * 60},
+
+ {""} /* end of table marker */
};
/*
@@ -993,8 +992,8 @@ static struct config_bool ConfigureNamesBool[] =
{
{"wal_compression", PGC_USERSET, WAL_SETTINGS,
- gettext_noop("Compresses full-page writes written in WAL file."),
- NULL
+ gettext_noop("Compresses full-page writes written in WAL file."),
+ NULL
},
&wal_compression,
false,
@@ -3685,10 +3684,10 @@ static int num_guc_variables;
*/
typedef struct ConfigFileVariable
{
- char *name;
- char *value;
- char *filename;
- int sourceline;
+ char *name;
+ char *value;
+ char *filename;
+ int sourceline;
} ConfigFileVariable;
static struct ConfigFileVariable *guc_file_variables;
@@ -5160,7 +5159,7 @@ convert_to_base_unit(int64 value, const char *unit,
int base_unit, int64 *base_value)
{
const unit_conversion *table;
- int i;
+ int i;
if (base_unit & GUC_UNIT_MEMORY)
table = memory_unit_conversion_table;
@@ -5207,9 +5206,9 @@ convert_from_base_unit(int64 base_value, int base_unit,
if (base_unit == table[i].base_unit)
{
/*
- * Accept the first conversion that divides the value evenly.
- * We assume that the conversions for each base unit are ordered
- * from greatest unit to the smallest!
+ * Accept the first conversion that divides the value evenly. We
+ * assume that the conversions for each base unit are ordered from
+ * greatest unit to the smallest!
*/
if (table[i].multiplier < 0)
{
@@ -5278,7 +5277,7 @@ parse_int(const char *value, int *result, int flags, const char **hintmsg)
bool converted = false;
if ((flags & GUC_UNIT) == 0)
- return false; /* this setting does not accept a unit */
+ return false; /* this setting does not accept a unit */
unitlen = 0;
while (*endptr != '\0' && !isspace((unsigned char) *endptr) &&
@@ -5694,7 +5693,7 @@ set_config_option(const char *name, const char *value,
if (IsInParallelMode() && changeVal && action != GUC_ACTION_SAVE)
ereport(elevel,
(errcode(ERRCODE_INVALID_TRANSACTION_STATE),
- errmsg("cannot set parameters during a parallel operation")));
+ errmsg("cannot set parameters during a parallel operation")));
record = find_option(name, true, elevel);
if (record == NULL)
@@ -7017,7 +7016,7 @@ ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel)
if (IsInParallelMode())
ereport(ERROR,
(errcode(ERRCODE_INVALID_TRANSACTION_STATE),
- errmsg("cannot set parameters during a parallel operation")));
+ errmsg("cannot set parameters during a parallel operation")));
switch (stmt->kind)
{
diff --git a/src/backend/utils/misc/rls.c b/src/backend/utils/misc/rls.c
index 066ac21a58c..44cb3743034 100644
--- a/src/backend/utils/misc/rls.c
+++ b/src/backend/utils/misc/rls.c
@@ -1,14 +1,14 @@
/*-------------------------------------------------------------------------
*
* rls.c
- * RLS-related utility functions.
+ * RLS-related utility functions.
*
* Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
- * src/backend/utils/misc/rls.c
+ * src/backend/utils/misc/rls.c
*
*-------------------------------------------------------------------------
*/
@@ -24,7 +24,7 @@
#include "utils/syscache.h"
-extern int check_enable_rls(Oid relid, Oid checkAsUser, bool noError);
+extern int check_enable_rls(Oid relid, Oid checkAsUser, bool noError);
/*
* check_enable_rls
@@ -48,10 +48,10 @@ extern int check_enable_rls(Oid relid, Oid checkAsUser, bool noError);
int
check_enable_rls(Oid relid, Oid checkAsUser, bool noError)
{
- HeapTuple tuple;
- Form_pg_class classform;
- bool relrowsecurity;
- Oid user_id = checkAsUser ? checkAsUser : GetUserId();
+ HeapTuple tuple;
+ Form_pg_class classform;
+ bool relrowsecurity;
+ Oid user_id = checkAsUser ? checkAsUser : GetUserId();
tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
if (!HeapTupleIsValid(tuple))
@@ -88,25 +88,24 @@ check_enable_rls(Oid relid, Oid checkAsUser, bool noError)
/*
* If the row_security GUC is 'off' then check if the user has permission
- * to bypass it. Note that we have already handled the case where the user
- * is the table owner above.
+ * to bypass it. Note that we have already handled the case where the
+ * user is the table owner above.
*
- * Note that row_security is always considered 'on' when querying
- * through a view or other cases where checkAsUser is true, so skip this
- * if checkAsUser is in use.
+ * Note that row_security is always considered 'on' when querying through
+ * a view or other cases where checkAsUser is true, so skip this if
+ * checkAsUser is in use.
*/
if (!checkAsUser && row_security == ROW_SECURITY_OFF)
{
if (has_bypassrls_privilege(user_id))
/* OK to bypass */
return RLS_NONE_ENV;
+ else if (noError)
+ return RLS_ENABLED;
else
- if (noError)
- return RLS_ENABLED;
- else
- ereport(ERROR,
- (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("insufficient privilege to bypass row security.")));
+ ereport(ERROR,
+ (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+ errmsg("insufficient privilege to bypass row security.")));
}
/* RLS should be fully enabled for this relation. */
diff --git a/src/backend/utils/misc/sampling.c b/src/backend/utils/misc/sampling.c
index 69479a5fc8c..aaf1d6c4108 100644
--- a/src/backend/utils/misc/sampling.c
+++ b/src/backend/utils/misc/sampling.c
@@ -150,7 +150,7 @@ reservoir_get_next_S(ReservoirState rs, double t, int n)
double V,
quot;
- V = sampler_random_fract(rs->randstate); /* Generate V */
+ V = sampler_random_fract(rs->randstate); /* Generate V */
S = 0;
t += 1;
/* Note: "num" in Vitter's code is always equal to t - n */
@@ -276,7 +276,7 @@ anl_init_selection_state(int n)
double
anl_get_next_S(double t, int n, double *stateptr)
{
- double result;
+ double result;
oldrs.W = *stateptr;
result = reservoir_get_next_S(&oldrs, t, n);
diff --git a/src/backend/utils/sort/sortsupport.c b/src/backend/utils/sort/sortsupport.c
index a70966ec995..ffef9658e45 100644
--- a/src/backend/utils/sort/sortsupport.c
+++ b/src/backend/utils/sort/sortsupport.c
@@ -102,8 +102,8 @@ FinishSortSupportFunction(Oid opfamily, Oid opcintype, SortSupport ssup)
if (OidIsValid(sortSupportFunction))
{
/*
- * The sort support function can provide a comparator, but it can
- * also choose not to so (e.g. based on the selected collation).
+ * The sort support function can provide a comparator, but it can also
+ * choose not to so (e.g. based on the selected collation).
*/
OidFunctionCall1(sortSupportFunction, PointerGetDatum(ssup));
}
diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c
index 3d5da444a64..435041afa1c 100644
--- a/src/backend/utils/sort/tuplesort.c
+++ b/src/backend/utils/sort/tuplesort.c
@@ -356,11 +356,12 @@ struct Tuplesortstate
/*
* Additional state for managing "abbreviated key" sortsupport routines
- * (which currently may be used by all cases except the Datum sort case and
- * hash index case). Tracks the intervals at which the optimization's
+ * (which currently may be used by all cases except the Datum sort case
+ * and hash index case). Tracks the intervals at which the optimization's
* effectiveness is tested.
*/
- int64 abbrevNext; /* Tuple # at which to next check applicability */
+ int64 abbrevNext; /* Tuple # at which to next check
+ * applicability */
/*
* These variables are specific to the CLUSTER case; they are set by
@@ -660,9 +661,9 @@ tuplesort_begin_heap(TupleDesc tupDesc,
/*
* The "onlyKey" optimization cannot be used with abbreviated keys, since
- * tie-breaker comparisons may be required. Typically, the optimization is
- * only of value to pass-by-value types anyway, whereas abbreviated keys
- * are typically only of value to pass-by-reference types.
+ * tie-breaker comparisons may be required. Typically, the optimization
+ * is only of value to pass-by-value types anyway, whereas abbreviated
+ * keys are typically only of value to pass-by-reference types.
*/
if (nkeys == 1 && !state->sortKeys->abbrev_converter)
state->onlyKey = state->sortKeys;
@@ -678,9 +679,9 @@ tuplesort_begin_cluster(TupleDesc tupDesc,
int workMem, bool randomAccess)
{
Tuplesortstate *state = tuplesort_begin_common(workMem, randomAccess);
- ScanKey indexScanKey;
+ ScanKey indexScanKey;
MemoryContext oldcontext;
- int i;
+ int i;
Assert(indexRel->rd_rel->relam == BTREE_AM_OID);
@@ -771,9 +772,9 @@ tuplesort_begin_index_btree(Relation heapRel,
int workMem, bool randomAccess)
{
Tuplesortstate *state = tuplesort_begin_common(workMem, randomAccess);
- ScanKey indexScanKey;
+ ScanKey indexScanKey;
MemoryContext oldcontext;
- int i;
+ int i;
oldcontext = MemoryContextSwitchTo(state->sortcontext);
@@ -929,9 +930,9 @@ tuplesort_begin_datum(Oid datumType, Oid sortOperator, Oid sortCollation,
/*
* The "onlyKey" optimization cannot be used with abbreviated keys, since
- * tie-breaker comparisons may be required. Typically, the optimization is
- * only of value to pass-by-value types anyway, whereas abbreviated keys
- * are typically only of value to pass-by-reference types.
+ * tie-breaker comparisons may be required. Typically, the optimization
+ * is only of value to pass-by-value types anyway, whereas abbreviated
+ * keys are typically only of value to pass-by-reference types.
*/
if (!state->sortKeys->abbrev_converter)
state->onlyKey = state->sortKeys;
@@ -1277,7 +1278,7 @@ tuplesort_putindextuplevalues(Tuplesortstate *state, Relation rel,
else
{
/* Abort abbreviation */
- int i;
+ int i;
stup.datum1 = original;
@@ -1285,13 +1286,13 @@ tuplesort_putindextuplevalues(Tuplesortstate *state, Relation rel,
* Set state to be consistent with never trying abbreviation.
*
* Alter datum1 representation in already-copied tuples, so as to
- * ensure a consistent representation (current tuple was just handled).
- * Note that we rely on all tuples copied so far actually being
- * contained within memtuples array.
+ * ensure a consistent representation (current tuple was just
+ * handled). Note that we rely on all tuples copied so far actually
+ * being contained within memtuples array.
*/
for (i = 0; i < state->memtupcount; i++)
{
- SortTuple *mtup = &state->memtuples[i];
+ SortTuple *mtup = &state->memtuples[i];
tuple = mtup->tuple;
mtup->datum1 = index_getattr(tuple,
@@ -1325,8 +1326,8 @@ tuplesort_putdatum(Tuplesortstate *state, Datum val, bool isNull)
* control, and possibly abbreviated. The copied value is pointed to by
* stup.tuple and is treated as the canonical copy (e.g. to return via
* tuplesort_getdatum or when writing to tape); stup.datum1 gets the
- * abbreviated value if abbreviation is happening, otherwise it's identical
- * to stup.tuple.
+ * abbreviated value if abbreviation is happening, otherwise it's
+ * identical to stup.tuple.
*/
if (isNull || state->datumTypeByVal)
@@ -1337,7 +1338,7 @@ tuplesort_putdatum(Tuplesortstate *state, Datum val, bool isNull)
}
else
{
- Datum original = datumCopy(val, false, state->datumTypeLen);
+ Datum original = datumCopy(val, false, state->datumTypeLen);
stup.isnull1 = false;
stup.tuple = DatumGetPointer(original);
@@ -1356,7 +1357,7 @@ tuplesort_putdatum(Tuplesortstate *state, Datum val, bool isNull)
else
{
/* Abort abbreviation */
- int i;
+ int i;
stup.datum1 = original;
@@ -1364,13 +1365,13 @@ tuplesort_putdatum(Tuplesortstate *state, Datum val, bool isNull)
* Set state to be consistent with never trying abbreviation.
*
* Alter datum1 representation in already-copied tuples, so as to
- * ensure a consistent representation (current tuple was just handled).
- * Note that we rely on all tuples copied so far actually being
- * contained within memtuples array.
+ * ensure a consistent representation (current tuple was just
+ * handled). Note that we rely on all tuples copied so far
+ * actually being contained within memtuples array.
*/
for (i = 0; i < state->memtupcount; i++)
{
- SortTuple *mtup = &state->memtuples[i];
+ SortTuple *mtup = &state->memtuples[i];
mtup->datum1 = PointerGetDatum(mtup->tuple);
}
@@ -1524,8 +1525,8 @@ consider_abort_common(Tuplesortstate *state)
state->abbrevNext *= 2;
/*
- * Check opclass-supplied abbreviation abort routine. It may
- * indicate that abbreviation should not proceed.
+ * Check opclass-supplied abbreviation abort routine. It may indicate
+ * that abbreviation should not proceed.
*/
if (!state->sortKeys->abbrev_abort(state->memtupcount,
state->sortKeys))
@@ -2231,9 +2232,9 @@ mergeruns(Tuplesortstate *state)
{
/*
* If there are multiple runs to be merged, when we go to read back
- * tuples from disk, abbreviated keys will not have been stored, and we
- * don't care to regenerate them. Disable abbreviation from this point
- * on.
+ * tuples from disk, abbreviated keys will not have been stored, and
+ * we don't care to regenerate them. Disable abbreviation from this
+ * point on.
*/
state->sortKeys->abbrev_converter = NULL;
state->sortKeys->comparator = state->sortKeys->abbrev_full_comparator;
@@ -3121,7 +3122,7 @@ copytup_heap(Tuplesortstate *state, SortTuple *stup, void *tup)
* MinimalTuple using the exported interface for that.
*/
TupleTableSlot *slot = (TupleTableSlot *) tup;
- Datum original;
+ Datum original;
MinimalTuple tuple;
HeapTupleData htup;
@@ -3157,7 +3158,7 @@ copytup_heap(Tuplesortstate *state, SortTuple *stup, void *tup)
else
{
/* Abort abbreviation */
- int i;
+ int i;
stup->datum1 = original;
@@ -3165,18 +3166,18 @@ copytup_heap(Tuplesortstate *state, SortTuple *stup, void *tup)
* Set state to be consistent with never trying abbreviation.
*
* Alter datum1 representation in already-copied tuples, so as to
- * ensure a consistent representation (current tuple was just handled).
- * Note that we rely on all tuples copied so far actually being
- * contained within memtuples array.
+ * ensure a consistent representation (current tuple was just
+ * handled). Note that we rely on all tuples copied so far actually
+ * being contained within memtuples array.
*/
for (i = 0; i < state->memtupcount; i++)
{
- SortTuple *mtup = &state->memtuples[i];
+ SortTuple *mtup = &state->memtuples[i];
htup.t_len = ((MinimalTuple) mtup->tuple)->t_len +
- MINIMAL_TUPLE_OFFSET;
+ MINIMAL_TUPLE_OFFSET;
htup.t_data = (HeapTupleHeader) ((char *) mtup->tuple -
- MINIMAL_TUPLE_OFFSET);
+ MINIMAL_TUPLE_OFFSET);
mtup->datum1 = heap_getattr(&htup,
state->sortKeys[0].ssup_attno,
@@ -3247,7 +3248,7 @@ static int
comparetup_cluster(const SortTuple *a, const SortTuple *b,
Tuplesortstate *state)
{
- SortSupport sortKey = state->sortKeys;
+ SortSupport sortKey = state->sortKeys;
HeapTuple ltup;
HeapTuple rtup;
TupleDesc tupDesc;
@@ -3364,6 +3365,7 @@ copytup_cluster(Tuplesortstate *state, SortTuple *stup, void *tup)
tuple = heap_copytuple(tuple);
stup->tuple = (void *) tuple;
USEMEM(state, GetMemoryChunkSpace(tuple));
+
/*
* set up first-column key value, and potentially abbreviate, if it's a
* simple column
@@ -3396,7 +3398,7 @@ copytup_cluster(Tuplesortstate *state, SortTuple *stup, void *tup)
else
{
/* Abort abbreviation */
- int i;
+ int i;
stup->datum1 = original;
@@ -3404,17 +3406,17 @@ copytup_cluster(Tuplesortstate *state, SortTuple *stup, void *tup)
* Set state to be consistent with never trying abbreviation.
*
* Alter datum1 representation in already-copied tuples, so as to
- * ensure a consistent representation (current tuple was just handled).
- * Note that we rely on all tuples copied so far actually being
- * contained within memtuples array.
+ * ensure a consistent representation (current tuple was just
+ * handled). Note that we rely on all tuples copied so far actually
+ * being contained within memtuples array.
*/
for (i = 0; i < state->memtupcount; i++)
{
- SortTuple *mtup = &state->memtuples[i];
+ SortTuple *mtup = &state->memtuples[i];
tuple = (HeapTuple) mtup->tuple;
mtup->datum1 = heap_getattr(tuple,
- state->indexInfo->ii_KeyAttrNumbers[0],
+ state->indexInfo->ii_KeyAttrNumbers[0],
state->tupDesc,
&stup->isnull1);
}
@@ -3487,10 +3489,10 @@ comparetup_index_btree(const SortTuple *a, const SortTuple *b,
{
/*
* This is similar to comparetup_heap(), but expects index tuples. There
- * is also special handling for enforcing uniqueness, and special treatment
- * for equal keys at the end.
+ * is also special handling for enforcing uniqueness, and special
+ * treatment for equal keys at the end.
*/
- SortSupport sortKey = state->sortKeys;
+ SortSupport sortKey = state->sortKeys;
IndexTuple tuple1;
IndexTuple tuple2;
int keysz;
@@ -3582,7 +3584,7 @@ comparetup_index_btree(const SortTuple *a, const SortTuple *b,
errmsg("could not create unique index \"%s\"",
RelationGetRelationName(state->indexRel)),
key_desc ? errdetail("Key %s is duplicated.", key_desc) :
- errdetail("Duplicate keys exist."),
+ errdetail("Duplicate keys exist."),
errtableconstraint(state->heapRel,
RelationGetRelationName(state->indexRel))));
}
@@ -3698,7 +3700,7 @@ copytup_index(Tuplesortstate *state, SortTuple *stup, void *tup)
else
{
/* Abort abbreviation */
- int i;
+ int i;
stup->datum1 = original;
@@ -3706,13 +3708,13 @@ copytup_index(Tuplesortstate *state, SortTuple *stup, void *tup)
* Set state to be consistent with never trying abbreviation.
*
* Alter datum1 representation in already-copied tuples, so as to
- * ensure a consistent representation (current tuple was just handled).
- * Note that we rely on all tuples copied so far actually being
- * contained within memtuples array.
+ * ensure a consistent representation (current tuple was just
+ * handled). Note that we rely on all tuples copied so far actually
+ * being contained within memtuples array.
*/
for (i = 0; i < state->memtupcount; i++)
{
- SortTuple *mtup = &state->memtuples[i];
+ SortTuple *mtup = &state->memtuples[i];
tuple = (IndexTuple) mtup->tuple;
mtup->datum1 = index_getattr(tuple,
@@ -3770,7 +3772,7 @@ readtup_index(Tuplesortstate *state, SortTuple *stup,
static int
comparetup_datum(const SortTuple *a, const SortTuple *b, Tuplesortstate *state)
{
- int compare;
+ int compare;
compare = ApplySortComparator(a->datum1, a->isnull1,
b->datum1, b->isnull1,
@@ -3782,7 +3784,7 @@ comparetup_datum(const SortTuple *a, const SortTuple *b, Tuplesortstate *state)
if (state->sortKeys->abbrev_converter)
compare = ApplySortAbbrevFullComparator(PointerGetDatum(a->tuple), a->isnull1,
- PointerGetDatum(b->tuple), b->isnull1,
+ PointerGetDatum(b->tuple), b->isnull1,
state->sortKeys);
return compare;
diff --git a/src/backend/utils/time/combocid.c b/src/backend/utils/time/combocid.c
index cc5409b8803..bb2f3295a44 100644
--- a/src/backend/utils/time/combocid.c
+++ b/src/backend/utils/time/combocid.c
@@ -121,6 +121,7 @@ HeapTupleHeaderGetCmax(HeapTupleHeader tup)
CommandId cid = HeapTupleHeaderGetRawCommandId(tup);
Assert(!(tup->t_infomask & HEAP_MOVED));
+
/*
* Because GetUpdateXid() performs memory allocations if xmax is a
* multixact we can't Assert() if we're inside a critical section. This
@@ -128,7 +129,7 @@ HeapTupleHeaderGetCmax(HeapTupleHeader tup)
* things too much.
*/
Assert(CritSectionCount > 0 ||
- TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetUpdateXid(tup)));
+ TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetUpdateXid(tup)));
if (tup->t_infomask & HEAP_COMBOCID)
return GetRealCmax(cid);
@@ -317,7 +318,7 @@ SerializeComboCIDState(Size maxsize, char *start_address)
char *endptr;
/* First, we store the number of currently-existing ComboCIDs. */
- * (int *) start_address = usedComboCids;
+ *(int *) start_address = usedComboCids;
/* If maxsize is too small, throw an error. */
endptr = start_address + sizeof(int) +
@@ -347,7 +348,7 @@ RestoreComboCIDState(char *comboCIDstate)
Assert(!comboCids && !comboHash);
/* First, we retrieve the number of ComboCIDs that were serialized. */
- num_elements = * (int *) comboCIDstate;
+ num_elements = *(int *) comboCIDstate;
keydata = (ComboCidKeyData *) (comboCIDstate + sizeof(int));
/* Use GetComboCommandId to restore each ComboCID. */
diff --git a/src/backend/utils/time/snapmgr.c b/src/backend/utils/time/snapmgr.c
index f4bdabfd791..2f0e9cda8c3 100644
--- a/src/backend/utils/time/snapmgr.c
+++ b/src/backend/utils/time/snapmgr.c
@@ -131,7 +131,7 @@ static ActiveSnapshotElt *ActiveSnapshot = NULL;
static int xmin_cmp(const pairingheap_node *a, const pairingheap_node *b,
void *arg);
-static pairingheap RegisteredSnapshots = { &xmin_cmp, NULL, NULL };
+static pairingheap RegisteredSnapshots = {&xmin_cmp, NULL, NULL};
/* first GetTransactionSnapshot call in a transaction? */
bool FirstSnapshotSet = false;
@@ -313,10 +313,10 @@ GetNonHistoricCatalogSnapshot(Oid relid)
{
/*
* If the caller is trying to scan a relation that has no syscache, no
- * catcache invalidations will be sent when it is updated. For a few
- * key relations, snapshot invalidations are sent instead. If we're
- * trying to scan a relation for which neither catcache nor snapshot
- * invalidations are sent, we must refresh the snapshot every time.
+ * catcache invalidations will be sent when it is updated. For a few key
+ * relations, snapshot invalidations are sent instead. If we're trying to
+ * scan a relation for which neither catcache nor snapshot invalidations
+ * are sent, we must refresh the snapshot every time.
*/
if (!CatalogSnapshotStale && !RelationInvalidatesSnapshotsOnly(relid) &&
!RelationHasSysCache(relid))
@@ -587,7 +587,9 @@ PushCopiedSnapshot(Snapshot snapshot)
void
UpdateActiveSnapshotCommandId(void)
{
- CommandId save_curcid, curcid;
+ CommandId save_curcid,
+ curcid;
+
Assert(ActiveSnapshot != NULL);
Assert(ActiveSnapshot->as_snap->active_count == 1);
Assert(ActiveSnapshot->as_snap->regd_count == 0);
@@ -772,7 +774,7 @@ xmin_cmp(const pairingheap_node *a, const pairingheap_node *b, void *arg)
static void
SnapshotResetXmin(void)
{
- Snapshot minSnapshot;
+ Snapshot minSnapshot;
if (ActiveSnapshot != NULL)
return;
@@ -897,7 +899,8 @@ AtEOXact_Snapshot(bool isCommit)
*/
foreach(lc, exportedSnapshots)
{
- Snapshot snap = (Snapshot) lfirst(lc);
+ Snapshot snap = (Snapshot) lfirst(lc);
+
pairingheap_remove(&RegisteredSnapshots, &snap->ph_node);
}
@@ -1472,8 +1475,8 @@ EstimateSnapshotSpace(Snapshot snap)
/*
* SerializeSnapshot
- * Dumps the serialized snapshot (extracted from given snapshot) onto the
- * memory location at start_address.
+ * Dumps the serialized snapshot (extracted from given snapshot) onto the
+ * memory location at start_address.
*/
void
SerializeSnapshot(Snapshot snapshot, char *start_address)
@@ -1494,9 +1497,9 @@ SerializeSnapshot(Snapshot snapshot, char *start_address)
serialized_snapshot->curcid = snapshot->curcid;
/*
- * Ignore the SubXID array if it has overflowed, unless the snapshot
- * was taken during recovey - in that case, top-level XIDs are in subxip
- * as well, and we mustn't lose them.
+ * Ignore the SubXID array if it has overflowed, unless the snapshot was
+ * taken during recovey - in that case, top-level XIDs are in subxip as
+ * well, and we mustn't lose them.
*/
if (serialized_snapshot->suboverflowed && !snapshot->takenDuringRecovery)
serialized_snapshot->subxcnt = 0;
@@ -1514,8 +1517,8 @@ SerializeSnapshot(Snapshot snapshot, char *start_address)
*/
if (snapshot->subxcnt > 0)
{
- Size subxipoff = sizeof(SerializedSnapshotData) +
- snapshot->xcnt * sizeof(TransactionId);
+ Size subxipoff = sizeof(SerializedSnapshotData) +
+ snapshot->xcnt * sizeof(TransactionId);
memcpy((TransactionId *) ((char *) serialized_snapshot + subxipoff),
snapshot->subxip, snapshot->subxcnt * sizeof(TransactionId));
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
index b4284d6d94f..de7b3fc80cf 100644
--- a/src/backend/utils/time/tqual.c
+++ b/src/backend/utils/time/tqual.c
@@ -405,6 +405,7 @@ HeapTupleSatisfiesToast(HeapTuple htup, Snapshot snapshot,
}
}
}
+
/*
* An invalid Xmin can be left behind by a speculative insertion that
* is cancelled by super-deleting the tuple. We shouldn't see any of
@@ -550,7 +551,7 @@ HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid,
if (!TransactionIdIsCurrentTransactionId(xmax))
{
if (MultiXactIdIsRunning(HeapTupleHeaderGetRawXmax(tuple),
- false))
+ false))
return HeapTupleBeingUpdated;
return HeapTupleMayBeUpdated;
}
@@ -820,10 +821,10 @@ HeapTupleSatisfiesDirty(HeapTuple htup, Snapshot snapshot,
else if (TransactionIdIsInProgress(HeapTupleHeaderGetRawXmin(tuple)))
{
/*
- * Return the speculative token to caller. Caller can worry
- * about xmax, since it requires a conclusively locked row
- * version, and a concurrent update to this tuple is a conflict
- * of its purposes.
+ * Return the speculative token to caller. Caller can worry about
+ * xmax, since it requires a conclusively locked row version, and
+ * a concurrent update to this tuple is a conflict of its
+ * purposes.
*/
if (HeapTupleHeaderIsSpeculative(tuple))
{