Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt')
-rw-r--r--src/backend/utils/adt/amutils.c14
-rw-r--r--src/backend/utils/adt/formatting.c2
-rw-r--r--src/backend/utils/adt/geo_spgist.c10
-rw-r--r--src/backend/utils/adt/jsonb.c17
-rw-r--r--src/backend/utils/adt/jsonfuncs.c30
-rw-r--r--src/backend/utils/adt/tsquery.c38
6 files changed, 61 insertions, 50 deletions
diff --git a/src/backend/utils/adt/amutils.c b/src/backend/utils/adt/amutils.c
index 0f8ad4ef0fa..dc04148b78d 100644
--- a/src/backend/utils/adt/amutils.c
+++ b/src/backend/utils/adt/amutils.c
@@ -187,8 +187,8 @@ indexam_property(FunctionCallInfo fcinfo,
}
/*
- * At this point, either index_oid == InvalidOid or it's a valid index OID.
- * Also, after this test and the one below, either attno == 0 for
+ * At this point, either index_oid == InvalidOid or it's a valid index
+ * OID. Also, after this test and the one below, either attno == 0 for
* index-wide or AM-wide tests, or it's a valid column number in a valid
* index.
*/
@@ -276,6 +276,7 @@ indexam_property(FunctionCallInfo fcinfo,
break;
case AMPROP_ORDERABLE:
+
/*
* generic assumption is that nonkey columns are not orderable
*/
@@ -293,8 +294,9 @@ indexam_property(FunctionCallInfo fcinfo,
* getting there from just the index column type seems like a
* lot of work. So instead we expect the AM to handle this in
* its amproperty routine. The generic result is to return
- * false if the AM says it never supports this, or if this is a
- * nonkey column, and null otherwise (meaning we don't know).
+ * false if the AM says it never supports this, or if this is
+ * a nonkey column, and null otherwise (meaning we don't
+ * know).
*/
if (!iskey || !routine->amcanorderbyop)
{
@@ -314,8 +316,8 @@ indexam_property(FunctionCallInfo fcinfo,
{
/*
* If possible, the AM should handle this test in its
- * amproperty function without opening the rel. But this is the
- * generic fallback if it does not.
+ * amproperty function without opening the rel. But this
+ * is the generic fallback if it does not.
*/
Relation indexrel = index_open(index_oid, AccessShareLock);
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index 1a1088711c3..a345c656050 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -3905,7 +3905,7 @@ do_to_timestamp(text *date_txt, text *fmt,
DateTimeParseError(DTERR_TZDISP_OVERFLOW, date_str, "timestamp");
tz = psprintf("%c%02d:%02d",
- tmfc.tzsign > 0 ? '+' : '-', tmfc.tzh, tmfc.tzm);
+ tmfc.tzsign > 0 ? '+' : '-', tmfc.tzh, tmfc.tzm);
tm->tm_zone = tz;
}
diff --git a/src/backend/utils/adt/geo_spgist.c b/src/backend/utils/adt/geo_spgist.c
index 3f1a755cbb3..06411aea9ec 100644
--- a/src/backend/utils/adt/geo_spgist.c
+++ b/src/backend/utils/adt/geo_spgist.c
@@ -686,10 +686,10 @@ spg_box_quad_leaf_consistent(PG_FUNCTION_ARGS)
/* Perform the required comparison(s) */
for (i = 0; i < in->nkeys; i++)
{
- StrategyNumber strategy = in->scankeys[i].sk_strategy;
- BOX *box = spg_box_quad_get_scankey_bbox(&in->scankeys[i],
- &out->recheck);
- Datum query = BoxPGetDatum(box);
+ StrategyNumber strategy = in->scankeys[i].sk_strategy;
+ BOX *box = spg_box_quad_get_scankey_bbox(&in->scankeys[i],
+ &out->recheck);
+ Datum query = BoxPGetDatum(box);
switch (strategy)
{
@@ -790,7 +790,7 @@ spg_bbox_quad_config(PG_FUNCTION_ARGS)
Datum
spg_poly_quad_compress(PG_FUNCTION_ARGS)
{
- POLYGON *polygon = PG_GETARG_POLYGON_P(0);
+ POLYGON *polygon = PG_GETARG_POLYGON_P(0);
BOX *box;
box = box_copy(&polygon->boundbox);
diff --git a/src/backend/utils/adt/jsonb.c b/src/backend/utils/adt/jsonb.c
index 80d23cc0524..e99bbc482a9 100644
--- a/src/backend/utils/adt/jsonb.c
+++ b/src/backend/utils/adt/jsonb.c
@@ -1861,8 +1861,8 @@ JsonbExtractScalar(JsonbContainer *jbc, JsonbValue *res)
return NULL;
/*
- * A root scalar is stored as an array of one element, so we get the
- * array and then its first (and only) member.
+ * A root scalar is stored as an array of one element, so we get the array
+ * and then its first (and only) member.
*/
it = JsonbIteratorInit(jbc);
@@ -1871,11 +1871,11 @@ JsonbExtractScalar(JsonbContainer *jbc, JsonbValue *res)
Assert(tmp.val.array.nElems == 1 && tmp.val.array.rawScalar);
tok = JsonbIteratorNext(&it, res, true);
- Assert (tok == WJB_ELEM);
+ Assert(tok == WJB_ELEM);
Assert(IsAJsonbScalar(res));
tok = JsonbIteratorNext(&it, &tmp, true);
- Assert (tok == WJB_END_ARRAY);
+ Assert(tok == WJB_END_ARRAY);
tok = JsonbIteratorNext(&it, &tmp, true);
Assert(tok == WJB_DONE);
@@ -1912,7 +1912,8 @@ jsonb_numeric(PG_FUNCTION_ARGS)
errmsg("jsonb value must be numeric")));
/*
- * v.val.numeric points into jsonb body, so we need to make a copy to return
+ * v.val.numeric points into jsonb body, so we need to make a copy to
+ * return
*/
retValue = DatumGetNumericCopy(NumericGetDatum(v.val.numeric));
@@ -1925,7 +1926,7 @@ Datum
jsonb_int2(PG_FUNCTION_ARGS)
{
Jsonb *in = PG_GETARG_JSONB_P(0);
- JsonbValue v;
+ JsonbValue v;
Datum retValue;
if (!JsonbExtractScalar(&in->root, &v) || v.type != jbvNumeric)
@@ -1945,7 +1946,7 @@ Datum
jsonb_int4(PG_FUNCTION_ARGS)
{
Jsonb *in = PG_GETARG_JSONB_P(0);
- JsonbValue v;
+ JsonbValue v;
Datum retValue;
if (!JsonbExtractScalar(&in->root, &v) || v.type != jbvNumeric)
@@ -1965,7 +1966,7 @@ Datum
jsonb_int8(PG_FUNCTION_ARGS)
{
Jsonb *in = PG_GETARG_JSONB_P(0);
- JsonbValue v;
+ JsonbValue v;
Datum retValue;
if (!JsonbExtractScalar(&in->root, &v) || v.type != jbvNumeric)
diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c
index 202779dfffb..2f701603a26 100644
--- a/src/backend/utils/adt/jsonfuncs.c
+++ b/src/backend/utils/adt/jsonfuncs.c
@@ -60,7 +60,8 @@ typedef struct IterateJsonStringValuesState
JsonIterateStringValuesAction action; /* an action that will be applied
* to each json value */
void *action_state; /* any necessary context for iteration */
- uint32 flags; /* what kind of elements from a json we want to iterate */
+ uint32 flags; /* what kind of elements from a json we want
+ * to iterate */
} IterateJsonStringValuesState;
/* state for transform_json_string_values function */
@@ -4950,19 +4951,19 @@ setPathArray(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
uint32
parse_jsonb_index_flags(Jsonb *jb)
{
- JsonbIterator *it;
- JsonbValue v;
- JsonbIteratorToken type;
- uint32 flags = 0;
+ JsonbIterator *it;
+ JsonbValue v;
+ JsonbIteratorToken type;
+ uint32 flags = 0;
it = JsonbIteratorInit(&jb->root);
type = JsonbIteratorNext(&it, &v, false);
/*
- * We iterate over array (scalar internally is represented as array, so, we
- * will accept it too) to check all its elements. Flag names are chosen
- * the same as jsonb_typeof uses.
+ * We iterate over array (scalar internally is represented as array, so,
+ * we will accept it too) to check all its elements. Flag names are
+ * chosen the same as jsonb_typeof uses.
*/
if (type != WJB_BEGIN_ARRAY)
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
@@ -4977,7 +4978,7 @@ parse_jsonb_index_flags(Jsonb *jb)
errhint("Possible values are: \"string\", \"numeric\", \"boolean\", \"key\" and \"all\"")));
if (v.val.string.len == 3 &&
- pg_strncasecmp(v.val.string.val, "all", 3) == 0)
+ pg_strncasecmp(v.val.string.val, "all", 3) == 0)
flags |= jtiAll;
else if (v.val.string.len == 3 &&
pg_strncasecmp(v.val.string.val, "key", 3) == 0)
@@ -5045,7 +5046,7 @@ iterate_jsonb_values(Jsonb *jb, uint32 flags, void *state,
}
/* JsonbValue is a value of object or element of array */
- switch(v.type)
+ switch (v.type)
{
case jbvString:
if (flags & jtiString)
@@ -5054,10 +5055,10 @@ iterate_jsonb_values(Jsonb *jb, uint32 flags, void *state,
case jbvNumeric:
if (flags & jtiNumeric)
{
- char *val;
+ char *val;
val = DatumGetCString(DirectFunctionCall1(numeric_out,
- NumericGetDatum(v.val.numeric)));
+ NumericGetDatum(v.val.numeric)));
action(state, val, strlen(val));
pfree(val);
@@ -5112,7 +5113,7 @@ iterate_values_scalar(void *state, char *token, JsonTokenType tokentype)
{
IterateJsonStringValuesState *_state = (IterateJsonStringValuesState *) state;
- switch(tokentype)
+ switch (tokentype)
{
case JSON_TOKEN_STRING:
if (_state->flags & jtiString)
@@ -5140,7 +5141,8 @@ iterate_values_object_field_start(void *state, char *fname, bool isnull)
if (_state->flags & jtiKey)
{
- char *val = pstrdup(fname);
+ char *val = pstrdup(fname);
+
_state->action(_state->action_state, val, strlen(val));
}
}
diff --git a/src/backend/utils/adt/tsquery.c b/src/backend/utils/adt/tsquery.c
index 793c0e5dd1c..7b9dbfef0cc 100644
--- a/src/backend/utils/adt/tsquery.c
+++ b/src/backend/utils/adt/tsquery.c
@@ -63,9 +63,9 @@ typedef enum
* *strval, *lenval and *weight are filled in when return value is PT_VAL
*
*/
-typedef ts_tokentype (*ts_tokenizer)(TSQueryParserState state, int8 *operator,
- int *lenval, char **strval,
- int16 *weight, bool *prefix);
+typedef ts_tokentype (*ts_tokenizer) (TSQueryParserState state, int8 *operator,
+ int *lenval, char **strval,
+ int16 *weight, bool *prefix);
struct TSQueryParserStateData
{
@@ -233,7 +233,7 @@ parse_phrase_operator(TSQueryParserState pstate, int16 *distance)
static bool
parse_or_operator(TSQueryParserState pstate)
{
- char *ptr = pstate->buf;
+ char *ptr = pstate->buf;
if (pstate->in_quotes)
return false;
@@ -245,26 +245,26 @@ parse_or_operator(TSQueryParserState pstate)
ptr += 2;
/*
- * it shouldn't be a part of any word but somewhere later it should be some
- * operand
+ * it shouldn't be a part of any word but somewhere later it should be
+ * some operand
*/
- if (*ptr == '\0') /* no operand */
+ if (*ptr == '\0') /* no operand */
return false;
/* it shouldn't be a part of any word */
- if (t_iseq(ptr, '-') || t_iseq(ptr, '_') || t_isalpha(ptr) || t_isdigit(ptr))
+ if (t_iseq(ptr, '-') || t_iseq(ptr, '_') || t_isalpha(ptr) || t_isdigit(ptr))
return false;
- for(;;)
+ for (;;)
{
ptr += pg_mblen(ptr);
- if (*ptr == '\0') /* got end of string without operand */
+ if (*ptr == '\0') /* got end of string without operand */
return false;
/*
- * Suppose, we found an operand, but could be a not correct operand. So
- * we still treat OR literal as operation with possibly incorrect
+ * Suppose, we found an operand, but could be a not correct operand.
+ * So we still treat OR literal as operation with possibly incorrect
* operand and will not search it as lexeme
*/
if (!t_isspace(ptr))
@@ -312,7 +312,10 @@ gettoken_query_standard(TSQueryParserState state, int8 *operator,
}
else if (!t_isspace(state->buf))
{
- /* We rely on the tsvector parser to parse the value for us */
+ /*
+ * We rely on the tsvector parser to parse the value for
+ * us
+ */
reset_tsvector_parser(state->valstate, state->buf);
if (gettoken_tsvector(state->valstate, strval, lenval,
NULL, NULL, &state->buf))
@@ -437,7 +440,10 @@ gettoken_query_websearch(TSQueryParserState state, int8 *operator,
}
else if (!t_isspace(state->buf))
{
- /* We rely on the tsvector parser to parse the value for us */
+ /*
+ * We rely on the tsvector parser to parse the value for
+ * us
+ */
reset_tsvector_parser(state->valstate, state->buf);
if (gettoken_tsvector(state->valstate, strval, lenval,
NULL, NULL, &state->buf))
@@ -464,8 +470,8 @@ gettoken_query_websearch(TSQueryParserState state, int8 *operator,
if (!state->in_quotes)
{
/*
- * put implicit AND after an operand
- * and handle this quote in WAITOPERAND
+ * put implicit AND after an operand and handle this
+ * quote in WAITOPERAND
*/
state->state = WAITOPERAND;
*operator = OP_AND;