1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-21 16:02:15 +03:00

Pre-beta mechanical code beautification.

Run pgindent, pgperltidy, and reformat-dat-files.
I manually fixed a couple of comments that pgindent uglified.
This commit is contained in:
Tom Lane
2022-05-12 15:17:30 -04:00
parent 93909599cd
commit 23e7b38bfe
287 changed files with 5193 additions and 3549 deletions

View File

@ -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;
}

View File

@ -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.

View File

@ -575,6 +575,7 @@ ExecReScanIndexScan(IndexScanState *node)
if (node->iss_ReorderQueue)
{
HeapTuple tuple;
while (!pairingheap_is_empty(node->iss_ReorderQueue))
{
tuple = reorderqueue_pop(node);

View File

@ -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

View File

@ -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);

View File

@ -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 */