aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt')
-rw-r--r--src/backend/utils/adt/array_typanalyze.c4
-rw-r--r--src/backend/utils/adt/arrayfuncs.c12
-rw-r--r--src/backend/utils/adt/date.c4
-rw-r--r--src/backend/utils/adt/datetime.c5
-rw-r--r--src/backend/utils/adt/formatting.c11
-rw-r--r--src/backend/utils/adt/json.c2
-rw-r--r--src/backend/utils/adt/jsonfuncs.c10
-rw-r--r--src/backend/utils/adt/misc.c10
-rw-r--r--src/backend/utils/adt/numeric.c2
-rw-r--r--src/backend/utils/adt/pg_locale.c10
-rw-r--r--src/backend/utils/adt/pseudotypes.c2
-rw-r--r--src/backend/utils/adt/rangetypes.c10
-rw-r--r--src/backend/utils/adt/rangetypes_gist.c41
-rw-r--r--src/backend/utils/adt/rangetypes_selfuncs.c165
-rw-r--r--src/backend/utils/adt/rangetypes_spgist.c74
-rw-r--r--src/backend/utils/adt/rangetypes_typanalyze.c50
-rw-r--r--src/backend/utils/adt/regproc.c5
-rw-r--r--src/backend/utils/adt/ri_triggers.c44
-rw-r--r--src/backend/utils/adt/ruleutils.c18
-rw-r--r--src/backend/utils/adt/selfuncs.c80
-rw-r--r--src/backend/utils/adt/timestamp.c12
-rw-r--r--src/backend/utils/adt/tsquery_rewrite.c2
-rw-r--r--src/backend/utils/adt/varlena.c6
-rw-r--r--src/backend/utils/adt/xml.c7
24 files changed, 308 insertions, 278 deletions
diff --git a/src/backend/utils/adt/array_typanalyze.c b/src/backend/utils/adt/array_typanalyze.c
index fca47d2e257..ae7bb8a8b81 100644
--- a/src/backend/utils/adt/array_typanalyze.c
+++ b/src/backend/utils/adt/array_typanalyze.c
@@ -388,8 +388,8 @@ compute_array_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
/*
* If element type is pass-by-reference, we must copy it into
- * palloc'd space, so that we can release the array below.
- * (We do this so that the space needed for element values is
+ * palloc'd space, so that we can release the array below. (We
+ * do this so that the space needed for element values is
* limited by the size of the hashtable; if we kept all the
* array values around, it could be much more.)
*/
diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c
index f53a0d248a6..1d61d5c7c8d 100644
--- a/src/backend/utils/adt/arrayfuncs.c
+++ b/src/backend/utils/adt/arrayfuncs.c
@@ -5187,7 +5187,7 @@ array_unnest(PG_FUNCTION_ARGS)
*
* Find all array entries matching (not distinct from) search/search_isnull,
* and delete them if remove is true, else replace them with
- * replace/replace_isnull. Comparisons are done using the specified
+ * replace/replace_isnull. Comparisons are done using the specified
* collation. fcinfo is passed only for caching purposes.
*/
static ArrayType *
@@ -5250,8 +5250,8 @@ array_replace_internal(ArrayType *array,
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))));
fcinfo->flinfo->fn_extra = (void *) typentry;
}
typlen = typentry->typlen;
@@ -5259,7 +5259,7 @@ array_replace_internal(ArrayType *array,
typalign = typentry->typalign;
/*
- * Detoast values if they are toasted. The replacement value must be
+ * Detoast values if they are toasted. The replacement value must be
* detoasted for insertion into the result array, while detoasting the
* search value only once saves cycles.
*/
@@ -5370,8 +5370,8 @@ array_replace_internal(ArrayType *array,
if (!AllocSizeIsValid(nbytes))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxAllocSize)));
+ errmsg("array size exceeds the maximum allowed (%d)",
+ (int) MaxAllocSize)));
}
nresult++;
}
diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c
index 5dd27c4d650..8677520cb6f 100644
--- a/src/backend/utils/adt/date.c
+++ b/src/backend/utils/adt/date.c
@@ -2699,8 +2699,8 @@ timetz_izone(PG_FUNCTION_ARGS)
if (zone->month != 0 || zone->day != 0)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("interval time zone \"%s\" must not include months or days",
- DatumGetCString(DirectFunctionCall1(interval_out,
+ errmsg("interval time zone \"%s\" must not include months or days",
+ DatumGetCString(DirectFunctionCall1(interval_out,
PointerGetDatum(zone))))));
#ifdef HAVE_INT64_TIMESTAMP
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index 59805047b20..7a08b9279d9 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -945,6 +945,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
break;
case DTK_TIME:
+
/*
* This might be an ISO time following a "t" field.
*/
@@ -2180,7 +2181,7 @@ DecodeDate(char *str, int fmask, int *tmask, bool *is2digits,
str++;
if (*str == '\0')
- return DTERR_BAD_FORMAT; /* end of string after separator */
+ return DTERR_BAD_FORMAT; /* end of string after separator */
field[nf] = str;
if (isdigit((unsigned char) *str))
@@ -2894,7 +2895,7 @@ DecodeInterval(char **field, int *ftype, int nf, int range,
Assert(*field[i] == '-' || *field[i] == '+');
/*
- * Check for signed hh:mm or hh:mm:ss. If so, process exactly
+ * Check for signed hh:mm or hh:mm:ss. If so, process exactly
* like DTK_TIME case above, plus handling the sign.
*/
if (strchr(field[i] + 1, ':') != NULL &&
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index 81e3329ef60..7b854062f0d 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -1045,7 +1045,6 @@ suff_search(char *str, KeySuffix *suf, int type)
static void
NUMDesc_prepare(NUMDesc *num, FormatNode *n)
{
-
if (n->type != NODE_TYPE_ACTION)
return;
@@ -2535,7 +2534,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
strcpy(s, str_toupper_z(localized_full_months[tm->tm_mon - 1], collid));
else
sprintf(s, "%*s", S_FM(n->suffix) ? 0 : -9,
- asc_toupper_z(months_full[tm->tm_mon - 1]));
+ asc_toupper_z(months_full[tm->tm_mon - 1]));
s += strlen(s);
break;
case DCH_Month:
@@ -3561,17 +3560,17 @@ do_to_timestamp(text *date_txt, text *fmt,
}
else
/* find century year for dates ending in "00" */
- tm->tm_year = tmfc.cc * 100 + ((tmfc.cc >= 0) ? 0 : 1);
+ tm->tm_year = tmfc.cc * 100 + ((tmfc.cc >= 0) ? 0 : 1);
}
else
- /* If a 4-digit year is provided, we use that and ignore CC. */
+ /* If a 4-digit year is provided, we use that and ignore CC. */
{
tm->tm_year = tmfc.year;
if (tmfc.bc && tm->tm_year > 0)
tm->tm_year = -(tm->tm_year - 1);
}
}
- else if (tmfc.cc) /* use first year of century */
+ else if (tmfc.cc) /* use first year of century */
{
if (tmfc.bc)
tmfc.cc = -tmfc.cc;
@@ -3606,7 +3605,7 @@ do_to_timestamp(text *date_txt, text *fmt,
if (tmfc.w)
tmfc.dd = (tmfc.w - 1) * 7 + 1;
if (tmfc.d)
- tm->tm_wday = tmfc.d - 1; /* convert to native numbering */
+ tm->tm_wday = tmfc.d - 1; /* convert to native numbering */
if (tmfc.dd)
tm->tm_mday = tmfc.dd;
if (tmfc.ddd)
diff --git a/src/backend/utils/adt/json.c b/src/backend/utils/adt/json.c
index 507c91ff97b..aaf99bddf27 100644
--- a/src/backend/utils/adt/json.c
+++ b/src/backend/utils/adt/json.c
@@ -46,7 +46,7 @@ typedef enum /* contexts of JSON parser */
JSON_PARSE_OBJECT_NEXT, /* saw object value, expecting ',' or '}' */
JSON_PARSE_OBJECT_COMMA, /* saw object ',', expecting next label */
JSON_PARSE_END /* saw the end of a document, expect nothing */
-} JsonParseContext;
+} JsonParseContext;
static inline void json_lex(JsonLexContext *lex);
static inline void json_lex_string(JsonLexContext *lex);
diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c
index 03378a3ea9b..dd625a4e47f 100644
--- a/src/backend/utils/adt/jsonfuncs.c
+++ b/src/backend/utils/adt/jsonfuncs.c
@@ -96,7 +96,7 @@ typedef enum
JSON_SEARCH_OBJECT = 1,
JSON_SEARCH_ARRAY,
JSON_SEARCH_PATH
-} JsonSearch;
+} JsonSearch;
/* state for json_object_keys */
typedef struct okeysState
@@ -682,10 +682,10 @@ get_array_start(void *state)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("cannot extract field from a non-object")));
- /*
- * initialize array count for this nesting level
- * Note: the lex_level seen by array_start is one less than that seen by
- * the elements of the array.
+
+ /*
+ * initialize array count for this nesting level Note: the lex_level seen
+ * by array_start is one less than that seen by the elements of the array.
*/
if (_state->search_type == JSON_SEARCH_PATH &&
lex_level < _state->npath)
diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c
index 4e38d7c06c2..829ce59888c 100644
--- a/src/backend/utils/adt/misc.c
+++ b/src/backend/utils/adt/misc.c
@@ -95,11 +95,11 @@ pg_signal_backend(int pid, int sig)
/*
* BackendPidGetProc returns NULL if the pid isn't valid; but by the time
- * we reach kill(), a process for which we get a valid proc here might have
- * terminated on its own. There's no way to acquire a lock on an arbitrary
- * process to prevent that. But since so far all the callers of this
- * mechanism involve some request for ending the process anyway, that it
- * might end on its own first is not a problem.
+ * we reach kill(), a process for which we get a valid proc here might
+ * have terminated on its own. There's no way to acquire a lock on an
+ * arbitrary process to prevent that. But since so far all the callers of
+ * this mechanism involve some request for ending the process anyway, that
+ * it might end on its own first is not a problem.
*/
if (proc == NULL)
{
diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c
index b343b5fe0f6..b4d639428ac 100644
--- a/src/backend/utils/adt/numeric.c
+++ b/src/backend/utils/adt/numeric.c
@@ -3402,7 +3402,7 @@ init_var_from_num(Numeric num, NumericVar *dest)
dest->sign = NUMERIC_SIGN(num);
dest->dscale = NUMERIC_DSCALE(num);
dest->digits = NUMERIC_DIGITS(num);
- dest->buf = NULL; /* digits array is not palloc'd */
+ dest->buf = NULL; /* digits array is not palloc'd */
}
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index 890aa198167..7081b00500b 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -718,13 +718,13 @@ cache_locale_time(void)
* Convert a Windows setlocale() argument to a Unix-style one.
*
* Regardless of platform, we install message catalogs under a Unix-style
- * LL[_CC][.ENCODING][@VARIANT] naming convention. Only LC_MESSAGES settings
+ * LL[_CC][.ENCODING][@VARIANT] naming convention. Only LC_MESSAGES settings
* following that style will elicit localized interface strings.
*
* Before Visual Studio 2012 (msvcr110.dll), Windows setlocale() accepted "C"
* (but not "c") and strings of the form <Language>[_<Country>][.<CodePage>],
* case-insensitive. setlocale() returns the fully-qualified form; for
- * example, setlocale("thaI") returns "Thai_Thailand.874". Internally,
+ * example, setlocale("thaI") returns "Thai_Thailand.874". Internally,
* setlocale() and _create_locale() select a "locale identifier"[1] and store
* it in an undocumented _locale_t field. From that LCID, we can retrieve the
* ISO 639 language and the ISO 3166 country. Character encoding does not
@@ -735,12 +735,12 @@ cache_locale_time(void)
* Studio 2012, setlocale() accepts locale names in addition to the strings it
* accepted historically. It does not standardize them; setlocale("Th-tH")
* returns "Th-tH". setlocale(category, "") still returns a traditional
- * string. Furthermore, msvcr110.dll changed the undocumented _locale_t
+ * string. Furthermore, msvcr110.dll changed the undocumented _locale_t
* content to carry locale names instead of locale identifiers.
*
* MinGW headers declare _create_locale(), but msvcrt.dll lacks that symbol.
* IsoLocaleName() always fails in a MinGW-built postgres.exe, so only
- * Unix-style values of the lc_messages GUC can elicit localized messages. In
+ * Unix-style values of the lc_messages GUC can elicit localized messages. In
* particular, every lc_messages setting that initdb can select automatically
* will yield only C-locale messages. XXX This could be fixed by running the
* fully-qualified locale name through a lookup table.
@@ -784,7 +784,7 @@ IsoLocaleName(const char *winlocname)
* need not standardize letter case here. So long as we do not ship
* message catalogs for which it would matter, we also need not
* translate the script/variant portion, e.g. uz-Cyrl-UZ to
- * uz_UZ@cyrillic. Simply replace the hyphen with an underscore.
+ * uz_UZ@cyrillic. Simply replace the hyphen with an underscore.
*
* Note that the locale name can be less-specific than the value we
* would derive under earlier Visual Studio releases. For example,
diff --git a/src/backend/utils/adt/pseudotypes.c b/src/backend/utils/adt/pseudotypes.c
index fe9d18d0f44..04650d8ba4a 100644
--- a/src/backend/utils/adt/pseudotypes.c
+++ b/src/backend/utils/adt/pseudotypes.c
@@ -293,7 +293,7 @@ trigger_out(PG_FUNCTION_ARGS)
/*
- * event_trigger_in - input routine for pseudo-type event_trigger.
+ * event_trigger_in - input routine for pseudo-type event_trigger.
*/
Datum
event_trigger_in(PG_FUNCTION_ARGS)
diff --git a/src/backend/utils/adt/rangetypes.c b/src/backend/utils/adt/rangetypes.c
index 84a4aca16c0..cd5c5f6621c 100644
--- a/src/backend/utils/adt/rangetypes.c
+++ b/src/backend/utils/adt/rangetypes.c
@@ -737,7 +737,7 @@ bounds_adjacent(TypeCacheEntry *typcache, RangeBound boundA, RangeBound boundB)
cmp = range_cmp_bound_values(typcache, &boundA, &boundB);
if (cmp < 0)
{
- RangeType *r;
+ RangeType *r;
/*
* Bounds do not overlap; see if there are points in between.
@@ -764,7 +764,7 @@ bounds_adjacent(TypeCacheEntry *typcache, RangeBound boundA, RangeBound boundB)
else if (cmp == 0)
return boundA.inclusive != boundB.inclusive;
else
- return false; /* bounds overlap */
+ return false; /* bounds overlap */
}
/* adjacent to (but not overlapping)? (internal version) */
@@ -1877,7 +1877,7 @@ range_parse_flags(const char *flags_str)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("invalid range bound flags"),
- errhint("Valid values are \"[]\", \"[)\", \"(]\", and \"()\".")));
+ errhint("Valid values are \"[]\", \"[)\", \"(]\", and \"()\".")));
switch (flags_str[0])
{
@@ -1890,7 +1890,7 @@ range_parse_flags(const char *flags_str)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("invalid range bound flags"),
- errhint("Valid values are \"[]\", \"[)\", \"(]\", and \"()\".")));
+ errhint("Valid values are \"[]\", \"[)\", \"(]\", and \"()\".")));
}
switch (flags_str[1])
@@ -1904,7 +1904,7 @@ range_parse_flags(const char *flags_str)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("invalid range bound flags"),
- errhint("Valid values are \"[]\", \"[)\", \"(]\", and \"()\".")));
+ errhint("Valid values are \"[]\", \"[)\", \"(]\", and \"()\".")));
}
return flags;
diff --git a/src/backend/utils/adt/rangetypes_gist.c b/src/backend/utils/adt/rangetypes_gist.c
index ea1251a5e65..464b37fe1fd 100644
--- a/src/backend/utils/adt/rangetypes_gist.c
+++ b/src/backend/utils/adt/rangetypes_gist.c
@@ -677,6 +677,7 @@ range_gist_same(PG_FUNCTION_ARGS)
else
{
TypeCacheEntry *typcache;
+
typcache = range_get_typcache(fcinfo, RangeTypeGetOid(r1));
*result = range_eq_internal(typcache, r1, r2);
@@ -781,36 +782,36 @@ range_gist_consistent_int(TypeCacheEntry *typcache, StrategyNumber strategy,
if (RangeIsEmpty(key) || RangeIsEmpty(DatumGetRangeType(query)))
return false;
return (!range_overright_internal(typcache, key,
- DatumGetRangeType(query)));
+ DatumGetRangeType(query)));
case RANGESTRAT_OVERLEFT:
if (RangeIsEmpty(key) || RangeIsEmpty(DatumGetRangeType(query)))
return false;
return (!range_after_internal(typcache, key,
- DatumGetRangeType(query)));
+ DatumGetRangeType(query)));
case RANGESTRAT_OVERLAPS:
return range_overlaps_internal(typcache, key,
- DatumGetRangeType(query));
+ DatumGetRangeType(query));
case RANGESTRAT_OVERRIGHT:
if (RangeIsEmpty(key) || RangeIsEmpty(DatumGetRangeType(query)))
return false;
return (!range_before_internal(typcache, key,
- DatumGetRangeType(query)));
+ DatumGetRangeType(query)));
case RANGESTRAT_AFTER:
if (RangeIsEmpty(key) || RangeIsEmpty(DatumGetRangeType(query)))
return false;
return (!range_overleft_internal(typcache, key,
- DatumGetRangeType(query)));
+ DatumGetRangeType(query)));
case RANGESTRAT_ADJACENT:
if (RangeIsEmpty(key) || RangeIsEmpty(DatumGetRangeType(query)))
return false;
if (range_adjacent_internal(typcache, key,
- DatumGetRangeType(query)))
+ DatumGetRangeType(query)))
return true;
return range_overlaps_internal(typcache, key,
- DatumGetRangeType(query));
+ DatumGetRangeType(query));
case RANGESTRAT_CONTAINS:
return range_contains_internal(typcache, key,
- DatumGetRangeType(query));
+ DatumGetRangeType(query));
case RANGESTRAT_CONTAINED_BY:
/*
@@ -821,7 +822,7 @@ range_gist_consistent_int(TypeCacheEntry *typcache, StrategyNumber strategy,
if (RangeIsOrContainsEmpty(key))
return true;
return range_overlaps_internal(typcache, key,
- DatumGetRangeType(query));
+ DatumGetRangeType(query));
case RANGESTRAT_CONTAINS_ELEM:
return range_contains_elem_internal(typcache, key, query);
case RANGESTRAT_EQ:
@@ -833,10 +834,10 @@ range_gist_consistent_int(TypeCacheEntry *typcache, StrategyNumber strategy,
if (RangeIsEmpty(DatumGetRangeType(query)))
return RangeIsOrContainsEmpty(key);
return range_contains_internal(typcache, key,
- DatumGetRangeType(query));
+ DatumGetRangeType(query));
default:
elog(ERROR, "unrecognized range strategy: %d", strategy);
- return false; /* keep compiler quiet */
+ return false; /* keep compiler quiet */
}
}
@@ -851,35 +852,35 @@ range_gist_consistent_leaf(TypeCacheEntry *typcache, StrategyNumber strategy,
{
case RANGESTRAT_BEFORE:
return range_before_internal(typcache, key,
- DatumGetRangeType(query));
+ DatumGetRangeType(query));
case RANGESTRAT_OVERLEFT:
return range_overleft_internal(typcache, key,
- DatumGetRangeType(query));
+ DatumGetRangeType(query));
case RANGESTRAT_OVERLAPS:
return range_overlaps_internal(typcache, key,
- DatumGetRangeType(query));
+ DatumGetRangeType(query));
case RANGESTRAT_OVERRIGHT:
return range_overright_internal(typcache, key,
- DatumGetRangeType(query));
+ DatumGetRangeType(query));
case RANGESTRAT_AFTER:
return range_after_internal(typcache, key,
- DatumGetRangeType(query));
+ DatumGetRangeType(query));
case RANGESTRAT_ADJACENT:
return range_adjacent_internal(typcache, key,
- DatumGetRangeType(query));
+ DatumGetRangeType(query));
case RANGESTRAT_CONTAINS:
return range_contains_internal(typcache, key,
- DatumGetRangeType(query));
+ DatumGetRangeType(query));
case RANGESTRAT_CONTAINED_BY:
return range_contained_by_internal(typcache, key,
- DatumGetRangeType(query));
+ DatumGetRangeType(query));
case RANGESTRAT_CONTAINS_ELEM:
return range_contains_elem_internal(typcache, key, query);
case RANGESTRAT_EQ:
return range_eq_internal(typcache, key, DatumGetRangeType(query));
default:
elog(ERROR, "unrecognized range strategy: %d", strategy);
- return false; /* keep compiler quiet */
+ return false; /* keep compiler quiet */
}
}
diff --git a/src/backend/utils/adt/rangetypes_selfuncs.c b/src/backend/utils/adt/rangetypes_selfuncs.c
index c450c6a1580..074d326b121 100644
--- a/src/backend/utils/adt/rangetypes_selfuncs.c
+++ b/src/backend/utils/adt/rangetypes_selfuncs.c
@@ -42,19 +42,19 @@ static float8 get_position(TypeCacheEntry *typcache, RangeBound *value,
RangeBound *hist1, RangeBound *hist2);
static float8 get_len_position(double value, double hist1, double hist2);
static float8 get_distance(TypeCacheEntry *typcache, RangeBound *bound1,
- RangeBound *bound2);
+ RangeBound *bound2);
static int length_hist_bsearch(Datum *length_hist_values,
int length_hist_nvalues, double value, bool equal);
static double calc_length_hist_frac(Datum *length_hist_values,
- int length_hist_nvalues, double length1, double length2, bool equal);
+ int length_hist_nvalues, double length1, double length2, bool equal);
static double calc_hist_selectivity_contained(TypeCacheEntry *typcache,
RangeBound *lower, RangeBound *upper,
RangeBound *hist_lower, int hist_nvalues,
- Datum *length_hist_values, int length_hist_nvalues);
+ Datum *length_hist_values, int length_hist_nvalues);
static double calc_hist_selectivity_contains(TypeCacheEntry *typcache,
RangeBound *lower, RangeBound *upper,
RangeBound *hist_lower, int hist_nvalues,
- Datum *length_hist_values, int length_hist_nvalues);
+ Datum *length_hist_values, int length_hist_nvalues);
/*
* Returns a default selectivity estimate for given operator, when we don't
@@ -73,6 +73,7 @@ default_range_selectivity(Oid operator)
return 0.005;
case OID_RANGE_CONTAINS_ELEM_OP:
+
/*
* "range @> elem" is more or less identical to a scalar
* inequality "A >= b AND A <= c".
@@ -162,8 +163,8 @@ rangesel(PG_FUNCTION_ARGS)
*
* If the operator is "range @> element", the constant should be of the
* element type of the range column. Convert it to a range that includes
- * only that single point, so that we don't need special handling for
- * that in what follows.
+ * only that single point, so that we don't need special handling for that
+ * in what follows.
*/
if (operator == OID_RANGE_CONTAINS_ELEM_OP)
{
@@ -171,7 +172,9 @@ rangesel(PG_FUNCTION_ARGS)
if (((Const *) other)->consttype == typcache->rngelemtype->type_id)
{
- RangeBound lower, upper;
+ RangeBound lower,
+ upper;
+
lower.inclusive = true;
lower.val = ((Const *) other)->constvalue;
lower.infinite = false;
@@ -193,8 +196,8 @@ rangesel(PG_FUNCTION_ARGS)
/*
* If we got a valid constant on one side of the operator, proceed to
- * estimate using statistics. Otherwise punt and return a default
- * constant estimate.
+ * estimate using statistics. Otherwise punt and return a default constant
+ * estimate.
*/
if (constrange)
selec = calc_rangesel(typcache, &vardata, constrange, operator);
@@ -214,7 +217,8 @@ calc_rangesel(TypeCacheEntry *typcache, VariableStatData *vardata,
{
double hist_selec;
double selec;
- float4 empty_frac, null_frac;
+ float4 empty_frac,
+ null_frac;
/*
* First look up the fraction of NULLs and empty ranges from pg_statistic.
@@ -231,13 +235,13 @@ calc_rangesel(TypeCacheEntry *typcache, VariableStatData *vardata,
/* Try to get fraction of empty ranges */
if (get_attstatsslot(vardata->statsTuple,
vardata->atttype, vardata->atttypmod,
- STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM, InvalidOid,
+ STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM, InvalidOid,
NULL,
NULL, NULL,
&numbers, &nnumbers))
{
if (nnumbers != 1)
- elog(ERROR, "invalid empty fraction statistic"); /* shouldn't happen */
+ elog(ERROR, "invalid empty fraction statistic"); /* shouldn't happen */
empty_frac = numbers[0];
}
else
@@ -250,8 +254,8 @@ calc_rangesel(TypeCacheEntry *typcache, VariableStatData *vardata,
{
/*
* No stats are available. Follow through the calculations below
- * anyway, assuming no NULLs and no empty ranges. This still allows
- * us to give a better-than-nothing estimate based on whether the
+ * anyway, assuming no NULLs and no empty ranges. This still allows us
+ * to give a better-than-nothing estimate based on whether the
* constant is an empty range or not.
*/
null_frac = 0.0;
@@ -278,6 +282,7 @@ calc_rangesel(TypeCacheEntry *typcache, VariableStatData *vardata,
case OID_RANGE_CONTAINED_OP:
case OID_RANGE_LESS_EQUAL_OP:
case OID_RANGE_GREATER_EQUAL_OP:
+
/*
* these return true when both args are empty, false if only
* one is empty
@@ -293,7 +298,7 @@ calc_rangesel(TypeCacheEntry *typcache, VariableStatData *vardata,
case OID_RANGE_CONTAINS_ELEM_OP:
default:
elog(ERROR, "unexpected operator %u", operator);
- selec = 0.0; /* keep compiler quiet */
+ selec = 0.0; /* keep compiler quiet */
break;
}
}
@@ -406,7 +411,7 @@ calc_hist_selectivity(TypeCacheEntry *typcache, VariableStatData *vardata,
/* Extract the bounds of the constant value. */
range_deserialize(typcache, constval, &const_lower, &const_upper, &empty);
- Assert (!empty);
+ Assert(!empty);
/*
* Calculate selectivity comparing the lower or upper bound of the
@@ -415,6 +420,7 @@ calc_hist_selectivity(TypeCacheEntry *typcache, VariableStatData *vardata,
switch (operator)
{
case OID_RANGE_LESS_OP:
+
/*
* The regular b-tree comparison operators (<, <=, >, >=) compare
* the lower bounds first, and the upper bounds for values with
@@ -476,11 +482,13 @@ calc_hist_selectivity(TypeCacheEntry *typcache, VariableStatData *vardata,
case OID_RANGE_OVERLAP_OP:
case OID_RANGE_CONTAINS_ELEM_OP:
+
/*
* A && B <=> NOT (A << B OR A >> B).
*
- * Since A << B and A >> B are mutually exclusive events we can sum
- * their probabilities to find probability of (A << B OR A >> B).
+ * Since A << B and A >> B are mutually exclusive events we can
+ * sum their probabilities to find probability of (A << B OR A >>
+ * B).
*
* "range @> elem" is equivalent to "range && [elem,elem]". The
* caller already constructed the singular range from the element
@@ -491,15 +499,15 @@ calc_hist_selectivity(TypeCacheEntry *typcache, VariableStatData *vardata,
nhist, false);
hist_selec +=
(1.0 - calc_hist_selectivity_scalar(typcache, &const_upper, hist_lower,
- nhist, true));
+ nhist, true));
hist_selec = 1.0 - hist_selec;
break;
case OID_RANGE_CONTAINS_OP:
hist_selec =
calc_hist_selectivity_contains(typcache, &const_lower,
- &const_upper, hist_lower, nhist,
- length_hist_values, length_nhist);
+ &const_upper, hist_lower, nhist,
+ length_hist_values, length_nhist);
break;
case OID_RANGE_CONTAINED_OP:
@@ -517,20 +525,20 @@ calc_hist_selectivity(TypeCacheEntry *typcache, VariableStatData *vardata,
{
hist_selec =
1.0 - calc_hist_selectivity_scalar(typcache, &const_lower,
- hist_lower, nhist, false);
+ hist_lower, nhist, false);
}
else
{
hist_selec =
calc_hist_selectivity_contained(typcache, &const_lower,
- &const_upper, hist_lower, nhist,
- length_hist_values, length_nhist);
+ &const_upper, hist_lower, nhist,
+ length_hist_values, length_nhist);
}
break;
default:
elog(ERROR, "unknown range operator %u", operator);
- hist_selec = -1.0; /* keep compiler quiet */
+ hist_selec = -1.0; /* keep compiler quiet */
break;
}
@@ -546,7 +554,7 @@ static double
calc_hist_selectivity_scalar(TypeCacheEntry *typcache, RangeBound *constbound,
RangeBound *hist, int hist_nvalues, bool equal)
{
- Selectivity selec;
+ Selectivity selec;
int index;
/*
@@ -576,7 +584,7 @@ calc_hist_selectivity_scalar(TypeCacheEntry *typcache, RangeBound *constbound,
*/
static int
rbound_bsearch(TypeCacheEntry *typcache, RangeBound *value, RangeBound *hist,
- int hist_length, bool equal)
+ int hist_length, bool equal)
{
int lower = -1,
upper = hist_length - 1,
@@ -613,7 +621,7 @@ length_hist_bsearch(Datum *length_hist_values, int length_hist_nvalues,
while (lower < upper)
{
- double middleval;
+ double middleval;
middle = (lower + upper + 1) / 2;
@@ -659,7 +667,7 @@ get_position(TypeCacheEntry *typcache, RangeBound *value, RangeBound *hist1,
hist2->val,
hist1->val));
if (bin_width <= 0.0)
- return 0.5; /* zero width bin */
+ return 0.5; /* zero width bin */
position = DatumGetFloat8(FunctionCall2Coll(
&typcache->rng_subdiff_finfo,
@@ -724,9 +732,8 @@ get_len_position(double value, double hist1, double hist2)
else if (is_infinite(hist1) && !is_infinite(hist2))
{
/*
- * Lower bin boundary is -infinite, upper is finite.
- * Return 1.0 to indicate the value is infinitely far from the lower
- * bound.
+ * Lower bin boundary is -infinite, upper is finite. Return 1.0 to
+ * indicate the value is infinitely far from the lower bound.
*/
return 1.0;
}
@@ -740,8 +747,8 @@ get_len_position(double value, double hist1, double hist2)
/*
* If both bin boundaries are infinite, they should be equal to each
* other, and the value should also be infinite and equal to both
- * bounds. (But don't Assert that, to avoid crashing unnecessarily
- * if the caller messes up)
+ * bounds. (But don't Assert that, to avoid crashing unnecessarily if
+ * the caller messes up)
*
* Assume the value to lie in the middle of the infinite bounds.
*/
@@ -755,7 +762,7 @@ get_len_position(double value, double hist1, double hist2)
static float8
get_distance(TypeCacheEntry *typcache, RangeBound *bound1, RangeBound *bound2)
{
- bool has_subdiff = OidIsValid(typcache->rng_subdiff_finfo.fn_oid);
+ bool has_subdiff = OidIsValid(typcache->rng_subdiff_finfo.fn_oid);
if (!bound1->infinite && !bound2->infinite)
{
@@ -797,7 +804,10 @@ calc_length_hist_frac(Datum *length_hist_values, int length_hist_nvalues,
double length1, double length2, bool equal)
{
double frac;
- double A, B, PA, PB;
+ double A,
+ B,
+ PA,
+ PB;
double pos;
int i;
double area;
@@ -805,7 +815,7 @@ calc_length_hist_frac(Datum *length_hist_values, int length_hist_nvalues,
Assert(length2 >= length1);
if (length2 < 0.0)
- return 0.0; /* shouldn't happen, but doesn't hurt to check */
+ return 0.0; /* shouldn't happen, but doesn't hurt to check */
/* All lengths in the table are <= infinite. */
if (is_infinite(length2) && equal)
@@ -815,25 +825,25 @@ calc_length_hist_frac(Datum *length_hist_values, int length_hist_nvalues,
* The average of a function between A and B can be calculated by the
* formula:
*
- * B
- * 1 /
- * ------- | P(x)dx
- * B - A /
- * A
+ * B
+ * 1 /
+ * ------- | P(x)dx
+ * B - A /
+ * A
*
* The geometrical interpretation of the integral is the area under the
* graph of P(x). P(x) is defined by the length histogram. We calculate
* the area in a piecewise fashion, iterating through the length histogram
* bins. Each bin is a trapezoid:
*
- * P(x2)
- * /|
- * / |
+ * P(x2)
+ * /|
+ * / |
* P(x1)/ |
- * | |
- * | |
- * ---+---+--
- * x1 x2
+ * | |
+ * | |
+ * ---+---+--
+ * x1 x2
*
* where x1 and x2 are the boundaries of the current histogram, and P(x1)
* and P(x1) are the cumulative fraction of tuples at the boundaries.
@@ -845,7 +855,7 @@ calc_length_hist_frac(Datum *length_hist_values, int length_hist_nvalues,
* boundary to calculate P(x1). Likewise for the last bin: we use linear
* interpolation to calculate P(x2). For the bins in between, x1 and x2
* lie on histogram bin boundaries, so P(x1) and P(x2) are simply:
- * P(x1) = (bin index) / (number of bins)
+ * P(x1) = (bin index) / (number of bins)
* P(x2) = (bin index + 1 / (number of bins)
*/
@@ -870,9 +880,9 @@ calc_length_hist_frac(Datum *length_hist_values, int length_hist_nvalues,
B = length1;
/*
- * In the degenerate case that length1 == length2, simply return P(length1).
- * This is not merely an optimization: if length1 == length2, we'd divide
- * by zero later on.
+ * In the degenerate case that length1 == length2, simply return
+ * P(length1). This is not merely an optimization: if length1 == length2,
+ * we'd divide by zero later on.
*/
if (length2 == length1)
return PB;
@@ -885,32 +895,34 @@ calc_length_hist_frac(Datum *length_hist_values, int length_hist_nvalues,
area = 0.0;
for (; i < length_hist_nvalues - 1; i++)
{
- double bin_upper = DatumGetFloat8(length_hist_values[i + 1]);
+ double bin_upper = DatumGetFloat8(length_hist_values[i + 1]);
/* check if we've reached the last bin */
if (!(bin_upper < length2 || (equal && bin_upper <= length2)))
break;
/* the upper bound of previous bin is the lower bound of this bin */
- A = B; PA = PB;
+ A = B;
+ PA = PB;
B = bin_upper;
PB = (double) i / (double) (length_hist_nvalues - 1);
/*
* Add the area of this trapezoid to the total. The point of the
- * if-check is to avoid NaN, in the corner case that PA == PB == 0, and
- * B - A == Inf. The area of a zero-height trapezoid (PA == PB == 0) is
- * zero, regardless of the width (B - A).
+ * if-check is to avoid NaN, in the corner case that PA == PB == 0,
+ * and B - A == Inf. The area of a zero-height trapezoid (PA == PB ==
+ * 0) is zero, regardless of the width (B - A).
*/
if (PA > 0 || PB > 0)
area += 0.5 * (PB + PA) * (B - A);
}
/* Last bin */
- A = B; PA = PB;
+ A = B;
+ PA = PB;
- B = length2; /* last bin ends at the query upper bound */
+ B = length2; /* last bin ends at the query upper bound */
if (i >= length_hist_nvalues - 1)
pos = 0.0;
else
@@ -953,8 +965,8 @@ calc_length_hist_frac(Datum *length_hist_values, int length_hist_nvalues,
static double
calc_hist_selectivity_contained(TypeCacheEntry *typcache,
RangeBound *lower, RangeBound *upper,
- RangeBound *hist_lower, int hist_nvalues,
- Datum *length_hist_values, int length_hist_nvalues)
+ RangeBound *hist_lower, int hist_nvalues,
+ Datum *length_hist_values, int length_hist_nvalues)
{
int i,
upper_index;
@@ -1013,9 +1025,10 @@ calc_hist_selectivity_contained(TypeCacheEntry *typcache,
if (range_cmp_bounds(typcache, &hist_lower[i], lower) < 0)
{
dist = get_distance(typcache, lower, upper);
+
/*
- * Subtract from bin_width the portion of this bin that we want
- * to ignore.
+ * Subtract from bin_width the portion of this bin that we want to
+ * ignore.
*/
bin_width -= get_position(typcache, lower, &hist_lower[i],
&hist_lower[i + 1]);
@@ -1035,8 +1048,8 @@ calc_hist_selectivity_contained(TypeCacheEntry *typcache,
prev_dist, dist, true);
/*
- * Add the fraction of tuples in this bin, with a suitable length,
- * to the total.
+ * Add the fraction of tuples in this bin, with a suitable length, to
+ * the total.
*/
sum_frac += length_hist_frac * bin_width / (double) (hist_nvalues - 1);
@@ -1063,7 +1076,7 @@ static double
calc_hist_selectivity_contains(TypeCacheEntry *typcache,
RangeBound *lower, RangeBound *upper,
RangeBound *hist_lower, int hist_nvalues,
- Datum *length_hist_values, int length_hist_nvalues)
+ Datum *length_hist_values, int length_hist_nvalues)
{
int i,
lower_index;
@@ -1083,17 +1096,17 @@ calc_hist_selectivity_contains(TypeCacheEntry *typcache,
*/
if (lower_index >= 0 && lower_index < hist_nvalues - 1)
lower_bin_width = get_position(typcache, lower, &hist_lower[lower_index],
- &hist_lower[lower_index + 1]);
+ &hist_lower[lower_index + 1]);
else
lower_bin_width = 0.0;
/*
* Loop through all the lower bound bins, smaller than the query lower
- * bound. In the loop, dist and prev_dist are the distance of the "current"
- * bin's lower and upper bounds from the constant upper bound. We begin
- * from query lower bound, and walk backwards, so the first bin's upper
- * bound is the query lower bound, and its distance to the query upper
- * bound is the length of the query range.
+ * bound. In the loop, dist and prev_dist are the distance of the
+ * "current" bin's lower and upper bounds from the constant upper bound.
+ * We begin from query lower bound, and walk backwards, so the first bin's
+ * upper bound is the query lower bound, and its distance to the query
+ * upper bound is the length of the query range.
*
* bin_width represents the width of the current bin. Normally it is 1.0,
* meaning a full width bin, except for the first bin, which is only
@@ -1108,9 +1121,9 @@ calc_hist_selectivity_contains(TypeCacheEntry *typcache,
double length_hist_frac;
/*
- * dist -- distance from upper bound of query range to current
- * value of lower bound histogram or lower bound of query range (if
- * we've reach it).
+ * dist -- distance from upper bound of query range to current value
+ * of lower bound histogram or lower bound of query range (if we've
+ * reach it).
*/
dist = get_distance(typcache, &hist_lower[i], upper);
diff --git a/src/backend/utils/adt/rangetypes_spgist.c b/src/backend/utils/adt/rangetypes_spgist.c
index 9a7f20d9f37..0d47854974e 100644
--- a/src/backend/utils/adt/rangetypes_spgist.c
+++ b/src/backend/utils/adt/rangetypes_spgist.c
@@ -151,8 +151,8 @@ spg_range_quad_choose(PG_FUNCTION_ARGS)
/*
* A node with no centroid divides ranges purely on whether they're empty
- * or not. All empty ranges go to child node 0, all non-empty ranges go
- * to node 1.
+ * or not. All empty ranges go to child node 0, all non-empty ranges go to
+ * node 1.
*/
if (!in->hasPrefix)
{
@@ -307,8 +307,8 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
/*
* For adjacent search we need also previous centroid (if any) to improve
- * the precision of the consistent check. In this case needPrevious flag is
- * set and centroid is passed into reconstructedValues. This is not the
+ * the precision of the consistent check. In this case needPrevious flag
+ * is set and centroid is passed into reconstructedValues. This is not the
* intended purpose of reconstructedValues (because we already have the
* full value available at the leaf), but it's a convenient place to store
* state while traversing the tree.
@@ -370,18 +370,20 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
break;
case RANGESTRAT_CONTAINS:
+
/*
- * All ranges contain an empty range. Only non-empty ranges
- * can contain a non-empty range.
+ * All ranges contain an empty range. Only non-empty
+ * ranges can contain a non-empty range.
*/
if (!empty)
which &= (1 << 2);
break;
case RANGESTRAT_CONTAINED_BY:
+
/*
- * Only an empty range is contained by an empty range. Both
- * empty and non-empty ranges can be contained by a
+ * Only an empty range is contained by an empty range.
+ * Both empty and non-empty ranges can be contained by a
* non-empty range.
*/
if (empty)
@@ -438,11 +440,13 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
upper;
bool empty;
RangeType *range = NULL;
+
/* Restrictions on range bounds according to scan strategy */
RangeBound *minLower = NULL,
*maxLower = NULL,
*minUpper = NULL,
*maxUpper = NULL;
+
/* Are the restrictions on range bounds inclusive? */
bool inclusive = true;
bool strictEmpty = true;
@@ -482,9 +486,9 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
/*
* Most strategies are handled by forming a bounding box from the
- * search key, defined by a minLower, maxLower, minUpper, maxUpper.
- * Some modify 'which' directly, to specify exactly which quadrants
- * need to be visited.
+ * search key, defined by a minLower, maxLower, minUpper,
+ * maxUpper. Some modify 'which' directly, to specify exactly
+ * which quadrants need to be visited.
*
* For most strategies, nothing matches an empty search key, and
* an empty range never matches a non-empty key. If a strategy
@@ -494,6 +498,7 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
switch (strategy)
{
case RANGESTRAT_BEFORE:
+
/*
* Range A is before range B if upper bound of A is lower
* than lower bound of B.
@@ -503,6 +508,7 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
break;
case RANGESTRAT_OVERLEFT:
+
/*
* Range A is overleft to range B if upper bound of A is
* less or equal to upper bound of B.
@@ -511,6 +517,7 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
break;
case RANGESTRAT_OVERLAPS:
+
/*
* Non-empty ranges overlap, if lower bound of each range
* is lower or equal to upper bound of the other range.
@@ -520,6 +527,7 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
break;
case RANGESTRAT_OVERRIGHT:
+
/*
* Range A is overright to range B if lower bound of A is
* greater or equal to lower bound of B.
@@ -528,6 +536,7 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
break;
case RANGESTRAT_AFTER:
+
/*
* Range A is after range B if lower bound of A is greater
* than upper bound of B.
@@ -538,12 +547,13 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
case RANGESTRAT_ADJACENT:
if (empty)
- break; /* Skip to strictEmpty check. */
+ break; /* Skip to strictEmpty check. */
/*
* which1 is bitmask for possibility to be adjacent with
* lower bound of argument. which2 is bitmask for
- * possibility to be adjacent with upper bound of argument.
+ * possibility to be adjacent with upper bound of
+ * argument.
*/
which1 = which2 = (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4);
@@ -622,9 +632,9 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
/*
* For a range's lower bound to be adjacent to the
* argument's upper bound, it will be found along the
- * line adjacent to (and just right of)
- * X=upper. Therefore, if the argument's upper bound is
- * less than (and not adjacent to) the centroid's upper
+ * line adjacent to (and just right of) X=upper.
+ * Therefore, if the argument's upper bound is less
+ * than (and not adjacent to) the centroid's upper
* bound, the line falls in quadrants 3 and 4; if
* greater or equal to, the line falls in quadrants 1
* and 2.
@@ -649,6 +659,7 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
break;
case RANGESTRAT_CONTAINS:
+
/*
* Non-empty range A contains non-empty range B if lower
* bound of A is lower or equal to lower bound of range B
@@ -682,6 +693,7 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
break;
case RANGESTRAT_EQ:
+
/*
* Equal range can be only in the same quadrant where
* argument would be placed to.
@@ -717,10 +729,10 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
if (minLower)
{
/*
- * If the centroid's lower bound is less than or equal to
- * the minimum lower bound, anything in the 3rd and 4th
- * quadrants will have an even smaller lower bound, and thus
- * can't match.
+ * If the centroid's lower bound is less than or equal to the
+ * minimum lower bound, anything in the 3rd and 4th quadrants
+ * will have an even smaller lower bound, and thus can't
+ * match.
*/
if (range_cmp_bounds(typcache, &centroidLower, minLower) <= 0)
which &= (1 << 1) | (1 << 2) | (1 << 5);
@@ -731,9 +743,9 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
* If the centroid's lower bound is greater than the maximum
* lower bound, anything in the 1st and 2nd quadrants will
* also have a greater than or equal lower bound, and thus
- * can't match. If the centroid's lower bound is equal to
- * the maximum lower bound, we can still exclude the 1st and
- * 2nd quadrants if we're looking for a value strictly greater
+ * can't match. If the centroid's lower bound is equal to the
+ * maximum lower bound, we can still exclude the 1st and 2nd
+ * quadrants if we're looking for a value strictly greater
* than the maximum.
*/
int cmp;
@@ -745,10 +757,10 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
if (minUpper)
{
/*
- * If the centroid's upper bound is less than or equal to
- * the minimum upper bound, anything in the 2nd and 3rd
- * quadrants will have an even smaller upper bound, and thus
- * can't match.
+ * If the centroid's upper bound is less than or equal to the
+ * minimum upper bound, anything in the 2nd and 3rd quadrants
+ * will have an even smaller upper bound, and thus can't
+ * match.
*/
if (range_cmp_bounds(typcache, &centroidUpper, minUpper) <= 0)
which &= (1 << 1) | (1 << 4) | (1 << 5);
@@ -759,9 +771,9 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
* If the centroid's upper bound is greater than the maximum
* upper bound, anything in the 1st and 4th quadrants will
* also have a greater than or equal upper bound, and thus
- * can't match. If the centroid's upper bound is equal to
- * the maximum upper bound, we can still exclude the 1st and
- * 4th quadrants if we're looking for a value strictly greater
+ * can't match. If the centroid's upper bound is equal to the
+ * maximum upper bound, we can still exclude the 1st and 4th
+ * quadrants if we're looking for a value strictly greater
* than the maximum.
*/
int cmp;
@@ -848,7 +860,7 @@ spg_range_quad_leaf_consistent(PG_FUNCTION_ARGS)
break;
case RANGESTRAT_ADJACENT:
res = range_adjacent_internal(typcache, leafRange,
- DatumGetRangeType(keyDatum));
+ DatumGetRangeType(keyDatum));
break;
case RANGESTRAT_CONTAINS:
res = range_contains_internal(typcache, leafRange,
diff --git a/src/backend/utils/adt/rangetypes_typanalyze.c b/src/backend/utils/adt/rangetypes_typanalyze.c
index e111f8ff979..114bce015c6 100644
--- a/src/backend/utils/adt/rangetypes_typanalyze.c
+++ b/src/backend/utils/adt/rangetypes_typanalyze.c
@@ -29,8 +29,8 @@
#include "utils/builtins.h"
#include "utils/rangetypes.h"
-static int float8_qsort_cmp(const void *a1, const void *a2);
-static int range_bound_qsort_cmp(const void *a1, const void *a2, void *arg);
+static int float8_qsort_cmp(const void *a1, const void *a2);
+static int range_bound_qsort_cmp(const void *a1, const void *a2, void *arg);
static void compute_range_stats(VacAttrStats *stats,
AnalyzeAttrFetchFunc fetchfunc, int samplerows, double totalrows);
@@ -48,7 +48,7 @@ range_typanalyze(PG_FUNCTION_ARGS)
typcache = range_get_typcache(fcinfo, stats->attrtypid);
if (attr->attstattarget < 0)
- attr->attstattarget = default_statistics_target;
+ attr->attstattarget = default_statistics_target;
stats->compute_stats = compute_range_stats;
stats->extra_data = typcache;
@@ -81,9 +81,9 @@ float8_qsort_cmp(const void *a1, const void *a2)
static int
range_bound_qsort_cmp(const void *a1, const void *a2, void *arg)
{
- RangeBound *b1 = (RangeBound *)a1;
- RangeBound *b2 = (RangeBound *)a2;
- TypeCacheEntry *typcache = (TypeCacheEntry *)arg;
+ RangeBound *b1 = (RangeBound *) a1;
+ RangeBound *b2 = (RangeBound *) a2;
+ TypeCacheEntry *typcache = (TypeCacheEntry *) arg;
return range_cmp_bounds(typcache, b1, b2);
}
@@ -106,7 +106,8 @@ compute_range_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
int num_bins = stats->attr->attstattarget;
int num_hist;
float8 *lengths;
- RangeBound *lowers, *uppers;
+ RangeBound *lowers,
+ *uppers;
double total_width = 0;
/* Allocate memory to hold range bounds and lengths of the sample ranges. */
@@ -163,9 +164,9 @@ compute_range_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
* and lower bound values.
*/
length = DatumGetFloat8(FunctionCall2Coll(
- &typcache->rng_subdiff_finfo,
- typcache->rng_collation,
- upper.val, lower.val));
+ &typcache->rng_subdiff_finfo,
+ typcache->rng_collation,
+ upper.val, lower.val));
}
else
{
@@ -227,13 +228,13 @@ compute_range_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
/*
* The object of this loop is to construct ranges from first and
* last entries in lowers[] and uppers[] along with evenly-spaced
- * values in between. So the i'th value is a range of
- * lowers[(i * (nvals - 1)) / (num_hist - 1)] and
- * uppers[(i * (nvals - 1)) / (num_hist - 1)]. But computing that
- * subscript directly risks integer overflow when the stats target
- * is more than a couple thousand. Instead we add
- * (nvals - 1) / (num_hist - 1) to pos at each step, tracking the
- * integral and fractional parts of the sum separately.
+ * values in between. So the i'th value is a range of lowers[(i *
+ * (nvals - 1)) / (num_hist - 1)] and uppers[(i * (nvals - 1)) /
+ * (num_hist - 1)]. But computing that subscript directly risks
+ * integer overflow when the stats target is more than a couple
+ * thousand. Instead we add (nvals - 1) / (num_hist - 1) to pos
+ * at each step, tracking the integral and fractional parts of the
+ * sum separately.
*/
delta = (non_empty_cnt - 1) / (num_hist - 1);
deltafrac = (non_empty_cnt - 1) % (num_hist - 1);
@@ -242,7 +243,7 @@ compute_range_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
for (i = 0; i < num_hist; i++)
{
bound_hist_values[i] = PointerGetDatum(range_serialize(
- typcache, &lowers[pos], &uppers[pos], false));
+ typcache, &lowers[pos], &uppers[pos], false));
pos += delta;
posfrac += deltafrac;
if (posfrac >= (num_hist - 1))
@@ -281,10 +282,10 @@ compute_range_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
* The object of this loop is to copy the first and last lengths[]
* entries along with evenly-spaced values in between. So the i'th
* value is lengths[(i * (nvals - 1)) / (num_hist - 1)]. But
- * computing that subscript directly risks integer overflow when the
- * stats target is more than a couple thousand. Instead we add
- * (nvals - 1) / (num_hist - 1) to pos at each step, tracking the
- * integral and fractional parts of the sum separately.
+ * computing that subscript directly risks integer overflow when
+ * the stats target is more than a couple thousand. Instead we
+ * add (nvals - 1) / (num_hist - 1) to pos at each step, tracking
+ * the integral and fractional parts of the sum separately.
*/
delta = (non_empty_cnt - 1) / (num_hist - 1);
deltafrac = (non_empty_cnt - 1) % (num_hist - 1);
@@ -342,9 +343,10 @@ compute_range_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
/* We found only nulls; assume the column is entirely null */
stats->stats_valid = true;
stats->stanullfrac = 1.0;
- stats->stawidth = 0; /* "unknown" */
- stats->stadistinct = 0.0; /* "unknown" */
+ stats->stawidth = 0; /* "unknown" */
+ stats->stadistinct = 0.0; /* "unknown" */
}
+
/*
* We don't need to bother cleaning up any of our temporary palloc's. The
* hashtable should also go away, as it used a child memory context.
diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c
index 700247e4741..0d1ff61bf9f 100644
--- a/src/backend/utils/adt/regproc.c
+++ b/src/backend/utils/adt/regproc.c
@@ -319,7 +319,7 @@ format_procedure_qualified(Oid procedure_oid)
* Routine to produce regprocedure names; see format_procedure above.
*
* force_qualify says whether to schema-qualify; if true, the name is always
- * qualified regardless of search_path visibility. Otherwise the name is only
+ * qualified regardless of search_path visibility. Otherwise the name is only
* qualified if the function is not in path.
*/
static char *
@@ -698,7 +698,8 @@ format_operator_internal(Oid operator_oid, bool force_qualify)
/*
* Would this oper be found (given the right args) by regoperatorin?
- * If not, or if caller explicitely requests it, we need to qualify it.
+ * If not, or if caller explicitely requests it, we need to qualify
+ * it.
*/
if (force_qualify || !OperatorIsVisible(operator_oid))
{
diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c
index 43228447ea4..65edc1fb04e 100644
--- a/src/backend/utils/adt/ri_triggers.c
+++ b/src/backend/utils/adt/ri_triggers.c
@@ -81,8 +81,8 @@
#define RI_PLAN_RESTRICT_UPD_CHECKREF 6
#define RI_PLAN_SETNULL_DEL_DOUPDATE 7
#define RI_PLAN_SETNULL_UPD_DOUPDATE 8
-#define RI_PLAN_SETDEFAULT_DEL_DOUPDATE 9
-#define RI_PLAN_SETDEFAULT_UPD_DOUPDATE 10
+#define RI_PLAN_SETDEFAULT_DEL_DOUPDATE 9
+#define RI_PLAN_SETDEFAULT_UPD_DOUPDATE 10
#define MAX_QUOTED_NAME_LEN (NAMEDATALEN*2+3)
#define MAX_QUOTED_REL_NAME_LEN (MAX_QUOTED_NAME_LEN*2)
@@ -135,7 +135,7 @@ typedef struct RI_ConstraintInfo
typedef struct RI_QueryKey
{
Oid constr_id; /* OID of pg_constraint entry */
- int32 constr_queryno; /* query type ID, see RI_PLAN_XXX above */
+ int32 constr_queryno; /* query type ID, see RI_PLAN_XXX above */
} RI_QueryKey;
@@ -403,7 +403,7 @@ RI_FKey_check(TriggerData *trigdata)
/* ----------
* The query string built is
* SELECT 1 FROM ONLY <pktable> x WHERE pkatt1 = $1 [AND ...]
- * FOR KEY SHARE OF x
+ * FOR KEY SHARE OF x
* The type id's for the $ parameters are those of the
* corresponding FK attributes.
* ----------
@@ -539,7 +539,7 @@ ri_Check_Pk_Match(Relation pk_rel, Relation fk_rel,
/* ----------
* The query string built is
* SELECT 1 FROM ONLY <pktable> x WHERE pkatt1 = $1 [AND ...]
- * FOR KEY SHARE OF x
+ * FOR KEY SHARE OF x
* The type id's for the $ parameters are those of the
* PK attributes themselves.
* ----------
@@ -697,8 +697,8 @@ ri_restrict_del(TriggerData *trigdata, bool is_no_action)
}
/*
- * If another PK row now exists providing the old key values,
- * we should not do anything. However, this check should only be
+ * If another PK row now exists providing the old key values, we
+ * should not do anything. However, this check should only be
* made in the NO ACTION case; in RESTRICT cases we don't wish to
* allow another row to be substituted.
*/
@@ -729,7 +729,7 @@ ri_restrict_del(TriggerData *trigdata, bool is_no_action)
/* ----------
* The query string built is
* SELECT 1 FROM ONLY <fktable> x WHERE $1 = fkatt1 [AND ...]
- * FOR KEY SHARE OF x
+ * FOR KEY SHARE OF x
* The type id's for the $ parameters are those of the
* corresponding PK attributes.
* ----------
@@ -921,8 +921,8 @@ ri_restrict_upd(TriggerData *trigdata, bool is_no_action)
}
/*
- * If another PK row now exists providing the old key values,
- * we should not do anything. However, this check should only be
+ * If another PK row now exists providing the old key values, we
+ * should not do anything. However, this check should only be
* made in the NO ACTION case; in RESTRICT cases we don't wish to
* allow another row to be substituted.
*/
@@ -1850,7 +1850,7 @@ RI_FKey_setdefault_del(PG_FUNCTION_ARGS)
* believe no check is necessary. So we need to do another lookup
* now and in case a reference still exists, abort the operation.
* That is already implemented in the NO ACTION trigger, so just
- * run it. (This recheck is only needed in the SET DEFAULT case,
+ * run it. (This recheck is only needed in the SET DEFAULT case,
* since CASCADE would remove such rows, while SET NULL is certain
* to result in rows that satisfy the FK constraint.)
*/
@@ -2041,7 +2041,7 @@ RI_FKey_setdefault_upd(PG_FUNCTION_ARGS)
* believe no check is necessary. So we need to do another lookup
* now and in case a reference still exists, abort the operation.
* That is already implemented in the NO ACTION trigger, so just
- * run it. (This recheck is only needed in the SET DEFAULT case,
+ * run it. (This recheck is only needed in the SET DEFAULT case,
* since CASCADE must change the FK key values, while SET NULL is
* certain to result in rows that satisfy the FK constraint.)
*/
@@ -2150,6 +2150,7 @@ RI_FKey_fk_upd_check_required(Trigger *trigger, Relation fk_rel,
switch (riinfo->confmatchtype)
{
case FKCONSTR_MATCH_SIMPLE:
+
/*
* If any new key value is NULL, the row must satisfy the
* constraint, so no check is needed.
@@ -2176,6 +2177,7 @@ RI_FKey_fk_upd_check_required(Trigger *trigger, Relation fk_rel,
return true;
case FKCONSTR_MATCH_FULL:
+
/*
* If all new key values are NULL, the row must satisfy the
* constraint, so no check is needed. On the other hand, if only
@@ -2449,7 +2451,7 @@ RI_Initial_Check(Trigger *trigger, Relation fk_rel, Relation pk_rel)
/*
* The columns to look at in the result tuple are 1..N, not whatever
- * they are in the fk_rel. Hack up riinfo so that the subroutines
+ * they are in the fk_rel. Hack up riinfo so that the subroutines
* called here will behave properly.
*
* In addition to this, we have to pass the correct tupdesc to
@@ -2676,8 +2678,8 @@ ri_BuildQueryKey(RI_QueryKey *key, const RI_ConstraintInfo *riinfo,
int32 constr_queryno)
{
/*
- * We assume struct RI_QueryKey contains no padding bytes, else we'd
- * need to use memset to clear them.
+ * We assume struct RI_QueryKey contains no padding bytes, else we'd need
+ * to use memset to clear them.
*/
key->constr_id = riinfo->constraint_id;
key->constr_queryno = constr_queryno;
@@ -2812,14 +2814,14 @@ ri_LoadConstraintInfo(Oid constraintOid)
elog(ERROR, "cache lookup failed for constraint %u", constraintOid);
conForm = (Form_pg_constraint) GETSTRUCT(tup);
- if (conForm->contype != CONSTRAINT_FOREIGN) /* should not happen */
+ if (conForm->contype != CONSTRAINT_FOREIGN) /* should not happen */
elog(ERROR, "constraint %u is not a foreign key constraint",
constraintOid);
/* And extract data */
Assert(riinfo->constraint_id == constraintOid);
riinfo->oidHashValue = GetSysCacheHashValue1(CONSTROID,
- ObjectIdGetDatum(constraintOid));
+ ObjectIdGetDatum(constraintOid));
memcpy(&riinfo->conname, &conForm->conname, sizeof(NameData));
riinfo->pk_relid = conForm->confrelid;
riinfo->fk_relid = conForm->conrelid;
@@ -3020,10 +3022,10 @@ ri_PerformCheck(const RI_ConstraintInfo *riinfo,
/*
* The values for the query are taken from the table on which the trigger
- * is called - it is normally the other one with respect to query_rel.
- * An exception is ri_Check_Pk_Match(), which uses the PK table for both
- * (and sets queryno to RI_PLAN_CHECK_LOOKUPPK_FROM_PK). We might
- * eventually need some less klugy way to determine this.
+ * is called - it is normally the other one with respect to query_rel. An
+ * exception is ri_Check_Pk_Match(), which uses the PK table for both (and
+ * sets queryno to RI_PLAN_CHECK_LOOKUPPK_FROM_PK). We might eventually
+ * need some less klugy way to determine this.
*/
if (qkey->constr_queryno == RI_PLAN_CHECK_LOOKUPPK)
{
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 043baf3c790..a1ed7813f24 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -1258,7 +1258,7 @@ pg_get_constraintdef(PG_FUNCTION_ARGS)
prettyFlags = PRETTYFLAG_INDENT;
PG_RETURN_TEXT_P(string_to_text(pg_get_constraintdef_worker(constraintId,
false,
- prettyFlags)));
+ prettyFlags)));
}
Datum
@@ -1271,7 +1271,7 @@ pg_get_constraintdef_ext(PG_FUNCTION_ARGS)
prettyFlags = pretty ? PRETTYFLAG_PAREN | PRETTYFLAG_INDENT : PRETTYFLAG_INDENT;
PG_RETURN_TEXT_P(string_to_text(pg_get_constraintdef_worker(constraintId,
false,
- prettyFlags)));
+ prettyFlags)));
}
/* Internal version that returns a palloc'd C string; no pretty-printing */
@@ -4229,19 +4229,19 @@ get_select_query_def(Query *query, deparse_context *context,
{
case LCS_FORKEYSHARE:
appendContextKeyword(context, " FOR KEY SHARE",
- -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
+ -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
break;
case LCS_FORSHARE:
appendContextKeyword(context, " FOR SHARE",
- -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
+ -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
break;
case LCS_FORNOKEYUPDATE:
appendContextKeyword(context, " FOR NO KEY UPDATE",
- -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
+ -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
break;
case LCS_FORUPDATE:
appendContextKeyword(context, " FOR UPDATE",
- -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
+ -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
break;
}
@@ -5340,8 +5340,8 @@ get_variable(Var *var, int levelsup, bool istoplevel, deparse_context *context)
/*
* If it's an unnamed join, look at the expansion of the alias variable.
* If it's a simple reference to one of the input vars, then recursively
- * print the name of that var instead. When it's not a simple reference,
- * we have to just print the unqualified join column name. (This can only
+ * print the name of that var instead. When it's not a simple reference,
+ * we have to just print the unqualified join column name. (This can only
* happen with columns that were merged by USING or NATURAL clauses in a
* FULL JOIN; we took pains previously to make the unqualified column name
* unique in such cases.)
@@ -8550,7 +8550,7 @@ generate_relation_name(Oid relid, List *namespaces)
* means a FuncExpr and not some other way of calling the function), then
* was_variadic must specify whether VARIADIC appeared in the original call,
* and *use_variadic_p will be set to indicate whether to print VARIADIC in
- * the output. For non-FuncExpr cases, was_variadic should be FALSE and
+ * the output. For non-FuncExpr cases, was_variadic should be FALSE and
* use_variadic_p can be NULL.
*
* The result includes all necessary quoting and schema-prefixing.
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index 0d5cafba962..da66f347078 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -194,10 +194,10 @@ static Selectivity prefix_selectivity(PlannerInfo *root,
VariableStatData *vardata,
Oid vartype, Oid opfamily, Const *prefixcon);
static Selectivity like_selectivity(const char *patt, int pattlen,
- bool case_insensitive);
+ bool case_insensitive);
static Selectivity regex_selectivity(const char *patt, int pattlen,
- bool case_insensitive,
- int fixed_prefix_len);
+ bool case_insensitive,
+ int fixed_prefix_len);
static Datum string_to_datum(const char *str, Oid datatype);
static Const *string_to_const(const char *str, Oid datatype);
static Const *string_to_bytea_const(const char *str, size_t str_len);
@@ -1123,7 +1123,7 @@ patternsel(PG_FUNCTION_ARGS, Pattern_Type ptype, bool negate)
Pattern_Prefix_Status pstatus;
Const *patt;
Const *prefix = NULL;
- Selectivity rest_selec = 0;
+ Selectivity rest_selec = 0;
double result;
/*
@@ -1214,7 +1214,7 @@ patternsel(PG_FUNCTION_ARGS, Pattern_Type ptype, bool negate)
/*
* Pull out any fixed prefix implied by the pattern, and estimate the
- * fractional selectivity of the remainder of the pattern. Unlike many of
+ * fractional selectivity of the remainder of the pattern. Unlike many of
* the other functions in this file, we use the pattern operator's actual
* collation for this step. This is not because we expect the collation
* to make a big difference in the selectivity estimate (it seldom would),
@@ -1867,17 +1867,17 @@ scalararraysel(PlannerInfo *root,
s2 = DatumGetFloat8(FunctionCall5Coll(&oprselproc,
clause->inputcollid,
PointerGetDatum(root),
- ObjectIdGetDatum(operator),
+ ObjectIdGetDatum(operator),
PointerGetDatum(args),
Int16GetDatum(jointype),
- PointerGetDatum(sjinfo)));
+ PointerGetDatum(sjinfo)));
else
s2 = DatumGetFloat8(FunctionCall4Coll(&oprselproc,
clause->inputcollid,
PointerGetDatum(root),
- ObjectIdGetDatum(operator),
+ ObjectIdGetDatum(operator),
PointerGetDatum(args),
- Int32GetDatum(varRelid)));
+ Int32GetDatum(varRelid)));
if (useOr)
{
@@ -1934,17 +1934,17 @@ scalararraysel(PlannerInfo *root,
s2 = DatumGetFloat8(FunctionCall5Coll(&oprselproc,
clause->inputcollid,
PointerGetDatum(root),
- ObjectIdGetDatum(operator),
+ ObjectIdGetDatum(operator),
PointerGetDatum(args),
Int16GetDatum(jointype),
- PointerGetDatum(sjinfo)));
+ PointerGetDatum(sjinfo)));
else
s2 = DatumGetFloat8(FunctionCall4Coll(&oprselproc,
clause->inputcollid,
PointerGetDatum(root),
- ObjectIdGetDatum(operator),
+ ObjectIdGetDatum(operator),
PointerGetDatum(args),
- Int32GetDatum(varRelid)));
+ Int32GetDatum(varRelid)));
if (useOr)
{
@@ -5293,7 +5293,7 @@ regex_fixed_prefix(Const *patt_const, bool case_insensitive, Oid collation,
if (rest_selec != NULL)
{
- char *patt = TextDatumGetCString(patt_const->constvalue);
+ char *patt = TextDatumGetCString(patt_const->constvalue);
*rest_selec = regex_selectivity(patt, strlen(patt),
case_insensitive,
@@ -5315,7 +5315,7 @@ regex_fixed_prefix(Const *patt_const, bool case_insensitive, Oid collation,
}
else
{
- char *patt = TextDatumGetCString(patt_const->constvalue);
+ char *patt = TextDatumGetCString(patt_const->constvalue);
*rest_selec = regex_selectivity(patt, strlen(patt),
case_insensitive,
@@ -5928,7 +5928,7 @@ string_to_bytea_const(const char *str, size_t str_len)
* genericcostestimate is a general-purpose estimator that can be used for
* most index types. In some cases we use genericcostestimate as the base
* code and then incorporate additional index-type-specific knowledge in
- * the type-specific calling function. To avoid code duplication, we make
+ * the type-specific calling function. To avoid code duplication, we make
* genericcostestimate return a number of intermediate values as well as
* its preliminary estimates of the output cost values. The GenericCosts
* struct includes all these values.
@@ -5941,15 +5941,15 @@ typedef struct
{
/* These are the values the cost estimator must return to the planner */
Cost indexStartupCost; /* index-related startup cost */
- Cost indexTotalCost; /* total index-related scan cost */
- Selectivity indexSelectivity; /* selectivity of index */
+ Cost indexTotalCost; /* total index-related scan cost */
+ Selectivity indexSelectivity; /* selectivity of index */
double indexCorrelation; /* order correlation of index */
/* Intermediate values we obtain along the way */
- double numIndexPages; /* number of leaf pages visited */
- double numIndexTuples; /* number of leaf tuples visited */
+ double numIndexPages; /* number of leaf pages visited */
+ double numIndexTuples; /* number of leaf tuples visited */
double spc_random_page_cost; /* relevant random_page_cost value */
- double num_sa_scans; /* # indexscans from ScalarArrayOps */
+ double num_sa_scans; /* # indexscans from ScalarArrayOps */
} GenericCosts;
static void
@@ -5963,7 +5963,7 @@ genericcostestimate(PlannerInfo *root,
List *indexOrderBys = path->indexorderbys;
Cost indexStartupCost;
Cost indexTotalCost;
- Selectivity indexSelectivity;
+ Selectivity indexSelectivity;
double indexCorrelation;
double numIndexPages;
double numIndexTuples;
@@ -6048,7 +6048,7 @@ genericcostestimate(PlannerInfo *root,
*
* In practice access to upper index levels is often nearly free because
* those tend to stay in cache under load; moreover, the cost involved is
- * highly dependent on index type. We therefore ignore such costs here
+ * highly dependent on index type. We therefore ignore such costs here
* and leave it to the caller to add a suitable charge if needed.
*/
if (index->pages > 1 && index->tuples > 1)
@@ -6570,7 +6570,7 @@ hashcostestimate(PG_FUNCTION_ARGS)
* because the hash AM makes sure that's always one page.
*
* Likewise, we could consider charging some CPU for each index tuple in
- * the bucket, if we knew how many there were. But the per-tuple cost is
+ * the bucket, if we knew how many there were. But the per-tuple cost is
* just a hash value comparison, not a general datatype-dependent
* comparison, so any such charge ought to be quite a bit less than
* cpu_operator_cost; which makes it probably not worth worrying about.
@@ -6617,7 +6617,7 @@ gistcostestimate(PG_FUNCTION_ARGS)
* Although this computation isn't really expensive enough to require
* caching, we might as well use index->tree_height to cache it.
*/
- if (index->tree_height < 0) /* unknown? */
+ if (index->tree_height < 0) /* unknown? */
{
if (index->pages > 1) /* avoid computing log(0) */
index->tree_height = (int) (log(index->pages) / log(100.0));
@@ -6626,9 +6626,9 @@ gistcostestimate(PG_FUNCTION_ARGS)
}
/*
- * Add a CPU-cost component to represent the costs of initial descent.
- * We just use log(N) here not log2(N) since the branching factor isn't
- * necessarily two anyway. As for btree, charge once per SA scan.
+ * Add a CPU-cost component to represent the costs of initial descent. We
+ * just use log(N) here not log2(N) since the branching factor isn't
+ * necessarily two anyway. As for btree, charge once per SA scan.
*/
if (index->tuples > 1) /* avoid computing log(0) */
{
@@ -6679,7 +6679,7 @@ spgcostestimate(PG_FUNCTION_ARGS)
* Although this computation isn't really expensive enough to require
* caching, we might as well use index->tree_height to cache it.
*/
- if (index->tree_height < 0) /* unknown? */
+ if (index->tree_height < 0) /* unknown? */
{
if (index->pages > 1) /* avoid computing log(0) */
index->tree_height = (int) (log(index->pages) / log(100.0));
@@ -6688,9 +6688,9 @@ spgcostestimate(PG_FUNCTION_ARGS)
}
/*
- * Add a CPU-cost component to represent the costs of initial descent.
- * We just use log(N) here not log2(N) since the branching factor isn't
- * necessarily two anyway. As for btree, charge once per SA scan.
+ * Add a CPU-cost component to represent the costs of initial descent. We
+ * just use log(N) here not log2(N) since the branching factor isn't
+ * necessarily two anyway. As for btree, charge once per SA scan.
*/
if (index->tuples > 1) /* avoid computing log(0) */
{
@@ -6801,14 +6801,14 @@ gincost_pattern(IndexOptInfo *index, int indexcol,
collation = DEFAULT_COLLATION_OID;
OidFunctionCall7Coll(extractProcOid,
- collation,
- query,
- PointerGetDatum(&nentries),
- UInt16GetDatum(strategy_op),
- PointerGetDatum(&partial_matches),
- PointerGetDatum(&extra_data),
- PointerGetDatum(&nullFlags),
- PointerGetDatum(&searchMode));
+ collation,
+ query,
+ PointerGetDatum(&nentries),
+ UInt16GetDatum(strategy_op),
+ PointerGetDatum(&partial_matches),
+ PointerGetDatum(&extra_data),
+ PointerGetDatum(&nullFlags),
+ PointerGetDatum(&searchMode));
if (nentries <= 0 && searchMode == GIN_SEARCH_MODE_DEFAULT)
{
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c
index 60f29533b71..94b2a3608a6 100644
--- a/src/backend/utils/adt/timestamp.c
+++ b/src/backend/utils/adt/timestamp.c
@@ -1296,7 +1296,7 @@ GetCurrentTimestamp(void)
int64
GetCurrentIntegerTimestamp(void)
{
- int64 result;
+ int64 result;
struct timeval tp;
gettimeofday(&tp, NULL);
@@ -3759,7 +3759,7 @@ interval_trunc(PG_FUNCTION_ARGS)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("interval units \"%s\" not supported "
- "because months usually have fractional weeks",
+ "because months usually have fractional weeks",
lowunits)));
else
ereport(ERROR,
@@ -4608,8 +4608,8 @@ timestamp_izone(PG_FUNCTION_ARGS)
if (zone->month != 0 || zone->day != 0)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("interval time zone \"%s\" must not include months or days",
- DatumGetCString(DirectFunctionCall1(interval_out,
+ errmsg("interval time zone \"%s\" must not include months or days",
+ DatumGetCString(DirectFunctionCall1(interval_out,
PointerGetDatum(zone))))));
#ifdef HAVE_INT64_TIMESTAMP
@@ -4781,8 +4781,8 @@ timestamptz_izone(PG_FUNCTION_ARGS)
if (zone->month != 0 || zone->day != 0)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("interval time zone \"%s\" must not include months or days",
- DatumGetCString(DirectFunctionCall1(interval_out,
+ errmsg("interval time zone \"%s\" must not include months or days",
+ DatumGetCString(DirectFunctionCall1(interval_out,
PointerGetDatum(zone))))));
#ifdef HAVE_INT64_TIMESTAMP
diff --git a/src/backend/utils/adt/tsquery_rewrite.c b/src/backend/utils/adt/tsquery_rewrite.c
index 6d3f618e8fd..a301f8fc180 100644
--- a/src/backend/utils/adt/tsquery_rewrite.c
+++ b/src/backend/utils/adt/tsquery_rewrite.c
@@ -46,7 +46,6 @@ addone(int *counters, int last, int total)
static QTNode *
findeq(QTNode *node, QTNode *ex, QTNode *subs, bool *isfind)
{
-
if ((node->sign & ex->sign) != ex->sign ||
node->valnode->type != ex->valnode->type)
return node;
@@ -196,7 +195,6 @@ dofindsubquery(QTNode *root, QTNode *ex, QTNode *subs, bool *isfind)
static QTNode *
dropvoidsubtree(QTNode *root)
{
-
if (!root)
return NULL;
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index bb85faf1a7b..56349e7e2aa 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -4245,7 +4245,7 @@ text_format(PG_FUNCTION_ARGS)
/*
* Get the appropriate typOutput function, reusing previous one if
- * same type as previous argument. That's particularly useful in the
+ * same type as previous argument. That's particularly useful in the
* variadic-array case, but often saves work even for ordinary calls.
*/
if (typid != prev_type)
@@ -4274,8 +4274,8 @@ text_format(PG_FUNCTION_ARGS)
/* should not get here, because of previous check */
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("unrecognized conversion type specifier \"%c\"",
- *cp)));
+ errmsg("unrecognized conversion type specifier \"%c\"",
+ *cp)));
break;
}
}
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c
index 9c5daec31e9..25ab79b1979 100644
--- a/src/backend/utils/adt/xml.c
+++ b/src/backend/utils/adt/xml.c
@@ -1499,7 +1499,7 @@ xml_pstrdup(const char *string)
/*
* xmlPgEntityLoader --- entity loader callback function
*
- * Silently prevent any external entity URL from being loaded. We don't want
+ * Silently prevent any external entity URL from being loaded. We don't want
* to throw an error, so instead make the entity appear to expand to an empty
* string.
*
@@ -1609,6 +1609,7 @@ xml_errorHandler(void *data, xmlErrorPtr error)
case XML_FROM_NONE:
case XML_FROM_MEMORY:
case XML_FROM_IO:
+
/*
* Suppress warnings about undeclared entities. We need to do
* this to avoid problems due to not loading DTD definitions.
@@ -2002,8 +2003,8 @@ map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings)
char *str;
/*
- * Flatten domains; the special-case treatments below should apply
- * to, eg, domains over boolean not just boolean.
+ * Flatten domains; the special-case treatments below should apply to,
+ * eg, domains over boolean not just boolean.
*/
type = getBaseType(type);