aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor')
-rw-r--r--src/backend/executor/execExpr.c4
-rw-r--r--src/backend/executor/execExprInterp.c65
-rw-r--r--src/backend/executor/nodeIndexscan.c1
-rw-r--r--src/backend/executor/nodeMemoize.c2
-rw-r--r--src/backend/executor/nodeModifyTable.c2
-rw-r--r--src/backend/executor/spi.c16
6 files changed, 47 insertions, 43 deletions
diff --git a/src/backend/executor/execExpr.c b/src/backend/executor/execExpr.c
index 38b94c02767..2831e7978b5 100644
--- a/src/backend/executor/execExpr.c
+++ b/src/backend/executor/execExpr.c
@@ -2504,7 +2504,7 @@ ExecInitExprRec(Expr *node, ExprState *state,
if (ctor->type == JSCTOR_JSON_SCALAR)
{
bool is_jsonb =
- ctor->returning->format->format_type == JS_FORMAT_JSONB;
+ ctor->returning->format->format_type == JS_FORMAT_JSONB;
scratch.d.json_constructor.arg_type_cache =
palloc(sizeof(*scratch.d.json_constructor.arg_type_cache) * nargs);
@@ -2666,7 +2666,7 @@ ExecInitExprRec(Expr *node, ExprState *state,
{
cstate->coercion = *coercion;
cstate->estate = *coercion ?
- ExecInitExprWithCaseValue((Expr *)(*coercion)->expr,
+ ExecInitExprWithCaseValue((Expr *) (*coercion)->expr,
state->parent,
caseval, casenull) : NULL;
}
diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c
index 3b1c045c52f..e024611aa54 100644
--- a/src/backend/executor/execExprInterp.c
+++ b/src/backend/executor/execExprInterp.c
@@ -3978,8 +3978,8 @@ ExecEvalJsonIsPredicate(ExprState *state, ExprEvalStep *op)
}
/*
- * Do full parsing pass only for uniqueness check or for
- * JSON text validation.
+ * Do full parsing pass only for uniqueness check or for JSON text
+ * validation.
*/
if (res && (pred->unique_keys || exprtype == TEXTOID))
res = json_validate(json, pred->unique_keys, false);
@@ -4513,20 +4513,20 @@ ExecEvalJsonConstructor(ExprState *state, ExprEvalStep *op,
if (ctor->type == JSCTOR_JSON_ARRAY)
res = (is_jsonb ?
jsonb_build_array_worker :
- json_build_array_worker)(op->d.json_constructor.nargs,
- op->d.json_constructor.arg_values,
- op->d.json_constructor.arg_nulls,
- op->d.json_constructor.arg_types,
- op->d.json_constructor.constructor->absent_on_null);
- else if (ctor->type == JSCTOR_JSON_OBJECT)
- res = (is_jsonb ?
- jsonb_build_object_worker :
- json_build_object_worker)(op->d.json_constructor.nargs,
+ json_build_array_worker) (op->d.json_constructor.nargs,
op->d.json_constructor.arg_values,
op->d.json_constructor.arg_nulls,
op->d.json_constructor.arg_types,
- op->d.json_constructor.constructor->absent_on_null,
- op->d.json_constructor.constructor->unique);
+ op->d.json_constructor.constructor->absent_on_null);
+ else if (ctor->type == JSCTOR_JSON_OBJECT)
+ res = (is_jsonb ?
+ jsonb_build_object_worker :
+ json_build_object_worker) (op->d.json_constructor.nargs,
+ op->d.json_constructor.arg_values,
+ op->d.json_constructor.arg_nulls,
+ op->d.json_constructor.arg_types,
+ op->d.json_constructor.constructor->absent_on_null,
+ op->d.json_constructor.constructor->unique);
else if (ctor->type == JSCTOR_JSON_SCALAR)
{
if (op->d.json_constructor.arg_nulls[0])
@@ -4622,9 +4622,9 @@ static Datum
ExecEvalJsonExprCoercion(ExprEvalStep *op, ExprContext *econtext,
Datum res, bool *isNull, void *p, bool *error)
{
- ExprState *estate = p;
+ ExprState *estate = p;
- if (estate) /* coerce using specified expression */
+ if (estate) /* coerce using specified expression */
return ExecEvalExpr(estate, econtext, isNull);
if (op->d.jsonexpr.jsexpr->op != JSON_EXISTS_OP)
@@ -4696,7 +4696,7 @@ EvalJsonPathVar(void *cxt, char *varName, int varNameLen,
if (!var->evaluated)
{
MemoryContext oldcxt = var->mcxt ?
- MemoryContextSwitchTo(var->mcxt) : NULL;
+ MemoryContextSwitchTo(var->mcxt) : NULL;
var->value = ExecEvalExpr(var->estate, var->econtext, &var->isnull);
var->evaluated = true;
@@ -4751,9 +4751,8 @@ ExecPrepareJsonItemCoercion(JsonbValue *item,
case jbvString:
coercion = &coercions->string;
- res = PointerGetDatum(
- cstring_to_text_with_len(item->val.string.val,
- item->val.string.len));
+ res = PointerGetDatum(cstring_to_text_with_len(item->val.string.val,
+ item->val.string.len));
break;
case jbvNumeric:
@@ -4809,8 +4808,8 @@ ExecPrepareJsonItemCoercion(JsonbValue *item,
return res;
}
-typedef Datum (*JsonFunc)(ExprEvalStep *op, ExprContext *econtext,
- Datum item, bool *resnull, void *p, bool *error);
+typedef Datum (*JsonFunc) (ExprEvalStep *op, ExprContext *econtext,
+ Datum item, bool *resnull, void *p, bool *error);
static Datum
ExecEvalJsonExprSubtrans(JsonFunc func, ExprEvalStep *op,
@@ -4826,8 +4825,8 @@ ExecEvalJsonExprSubtrans(JsonFunc func, ExprEvalStep *op,
return func(op, econtext, res, resnull, p, error);
/*
- * We should catch exceptions of category ERRCODE_DATA_EXCEPTION
- * and execute the corresponding ON ERROR behavior then.
+ * We should catch exceptions of category ERRCODE_DATA_EXCEPTION and
+ * execute the corresponding ON ERROR behavior then.
*/
oldcontext = CurrentMemoryContext;
oldowner = CurrentResourceOwner;
@@ -4864,7 +4863,8 @@ ExecEvalJsonExprSubtrans(JsonFunc func, ExprEvalStep *op,
ecategory = ERRCODE_TO_CATEGORY(edata->sqlerrcode);
- if (ecategory != ERRCODE_DATA_EXCEPTION && /* jsonpath and other data errors */
+ if (ecategory != ERRCODE_DATA_EXCEPTION && /* jsonpath and other data
+ * errors */
ecategory != ERRCODE_INTEGRITY_CONSTRAINT_VIOLATION) /* domain errors */
ReThrowError(edata);
@@ -4918,7 +4918,7 @@ ExecEvalJsonExpr(ExprEvalStep *op, ExprContext *econtext,
if (error && *error)
return (Datum) 0;
- if (!jbv) /* NULL or empty */
+ if (!jbv) /* NULL or empty */
break;
Assert(!empty);
@@ -4949,21 +4949,23 @@ ExecEvalJsonExpr(ExprEvalStep *op, ExprContext *econtext,
*error = true;
return (Datum) 0;
}
+
/*
* Coercion via I/O means here that the cast to the target
* type simply does not exist.
*/
ereport(ERROR,
- /*
- * XXX Standard says about a separate error code
- * ERRCODE_SQL_JSON_ITEM_CANNOT_BE_CAST_TO_TARGET_TYPE
- * but does not define its number.
- */
+
+ /*
+ * XXX Standard says about a separate error code
+ * ERRCODE_SQL_JSON_ITEM_CANNOT_BE_CAST_TO_TARGET_TYPE but
+ * does not define its number.
+ */
(errcode(ERRCODE_SQL_JSON_SCALAR_REQUIRED),
errmsg("SQL/JSON item cannot be cast to target type")));
}
else if (!jcstate->estate)
- return res; /* no coercion */
+ return res; /* no coercion */
/* coerce using specific expression */
estate = jcstate->estate;
@@ -5018,6 +5020,7 @@ ExecEvalJsonExpr(ExprEvalStep *op, ExprContext *econtext,
}
if (jexpr->on_empty->btype == JSON_BEHAVIOR_DEFAULT)
+
/*
* Execute DEFAULT expression as a coercion expression, because
* its result is already coerced to the target type.
diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c
index 90b2699a96b..5ef5c6930fd 100644
--- a/src/backend/executor/nodeIndexscan.c
+++ b/src/backend/executor/nodeIndexscan.c
@@ -575,6 +575,7 @@ ExecReScanIndexScan(IndexScanState *node)
if (node->iss_ReorderQueue)
{
HeapTuple tuple;
+
while (!pairingheap_is_empty(node->iss_ReorderQueue))
{
tuple = reorderqueue_pop(node);
diff --git a/src/backend/executor/nodeMemoize.c b/src/backend/executor/nodeMemoize.c
index 23441e33cad..f7be4fc31f7 100644
--- a/src/backend/executor/nodeMemoize.c
+++ b/src/backend/executor/nodeMemoize.c
@@ -375,7 +375,7 @@ static void
cache_purge_all(MemoizeState *mstate)
{
uint64 evictions = mstate->hashtable->members;
- PlanState *pstate = (PlanState *) mstate;
+ PlanState *pstate = (PlanState *) mstate;
/*
* Likely the most efficient way to remove all items is to just reset the
diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c
index 982acfdad98..a49c3da5b6c 100644
--- a/src/backend/executor/nodeModifyTable.c
+++ b/src/backend/executor/nodeModifyTable.c
@@ -831,7 +831,7 @@ ExecInsert(ModifyTableContext *context,
{
TupleDesc tdesc = CreateTupleDescCopy(slot->tts_tupleDescriptor);
TupleDesc plan_tdesc =
- CreateTupleDescCopy(planSlot->tts_tupleDescriptor);
+ CreateTupleDescCopy(planSlot->tts_tupleDescriptor);
resultRelInfo->ri_Slots[resultRelInfo->ri_NumSlots] =
MakeSingleTupleTableSlot(tdesc, slot->tts_ops);
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index 042a5f8b0a2..29bc26669b0 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -2267,10 +2267,10 @@ _SPI_prepare_plan(const char *src, SPIPlanPtr plan)
else
{
stmt_list = pg_analyze_and_rewrite_fixedparams(parsetree,
- src,
- plan->argtypes,
- plan->nargs,
- _SPI_current->queryEnv);
+ src,
+ plan->argtypes,
+ plan->nargs,
+ _SPI_current->queryEnv);
}
/* Finish filling in the CachedPlanSource */
@@ -2504,10 +2504,10 @@ _SPI_execute_plan(SPIPlanPtr plan, const SPIExecuteOptions *options,
else
{
stmt_list = pg_analyze_and_rewrite_fixedparams(parsetree,
- src,
- plan->argtypes,
- plan->nargs,
- _SPI_current->queryEnv);
+ src,
+ plan->argtypes,
+ plan->nargs,
+ _SPI_current->queryEnv);
}
/* Finish filling in the CachedPlanSource */