Rename a node field for clarity

Rename ResultRelInfo.ri_ConstraintExprs to ri_CheckConstraintExprs.
This reflects its specific purpose better and avoids confusion with
adjacent fields with similar but distinct purposes.

Discussion: https://postgr.es/m/CACJufxHArQysbDkWFmvK+D1TPHQWWTxWN15cMuUaTYX3xhQXgg@mail.gmail.com
This commit is contained in:
Peter Eisentraut 2025-03-28 09:50:01 +01:00
parent fb2ea12f42
commit 9a9ead1105
2 changed files with 7 additions and 7 deletions

View File

@ -1371,7 +1371,7 @@ InitResultRelInfo(ResultRelInfo *resultRelInfo,
resultRelInfo->ri_projectNewInfoValid = false; resultRelInfo->ri_projectNewInfoValid = false;
resultRelInfo->ri_FdwState = NULL; resultRelInfo->ri_FdwState = NULL;
resultRelInfo->ri_usesFdwDirectModify = false; resultRelInfo->ri_usesFdwDirectModify = false;
resultRelInfo->ri_ConstraintExprs = NULL; resultRelInfo->ri_CheckConstraintExprs = NULL;
resultRelInfo->ri_GeneratedExprsI = NULL; resultRelInfo->ri_GeneratedExprsI = NULL;
resultRelInfo->ri_GeneratedExprsU = NULL; resultRelInfo->ri_GeneratedExprsU = NULL;
resultRelInfo->ri_projectReturning = NULL; resultRelInfo->ri_projectReturning = NULL;
@ -1871,10 +1871,10 @@ ExecRelCheck(ResultRelInfo *resultRelInfo,
* nodetrees for rel's constraint expressions. Keep them in the per-query * nodetrees for rel's constraint expressions. Keep them in the per-query
* memory context so they'll survive throughout the query. * memory context so they'll survive throughout the query.
*/ */
if (resultRelInfo->ri_ConstraintExprs == NULL) if (resultRelInfo->ri_CheckConstraintExprs == NULL)
{ {
oldContext = MemoryContextSwitchTo(estate->es_query_cxt); oldContext = MemoryContextSwitchTo(estate->es_query_cxt);
resultRelInfo->ri_ConstraintExprs = resultRelInfo->ri_CheckConstraintExprs =
(ExprState **) palloc0(ncheck * sizeof(ExprState *)); (ExprState **) palloc0(ncheck * sizeof(ExprState *));
for (i = 0; i < ncheck; i++) for (i = 0; i < ncheck; i++)
{ {
@ -1886,7 +1886,7 @@ ExecRelCheck(ResultRelInfo *resultRelInfo,
checkconstr = stringToNode(check[i].ccbin); checkconstr = stringToNode(check[i].ccbin);
checkconstr = (Expr *) expand_generated_columns_in_expr((Node *) checkconstr, rel, 1); checkconstr = (Expr *) expand_generated_columns_in_expr((Node *) checkconstr, rel, 1);
resultRelInfo->ri_ConstraintExprs[i] = resultRelInfo->ri_CheckConstraintExprs[i] =
ExecPrepareExpr(checkconstr, estate); ExecPrepareExpr(checkconstr, estate);
} }
MemoryContextSwitchTo(oldContext); MemoryContextSwitchTo(oldContext);
@ -1904,7 +1904,7 @@ ExecRelCheck(ResultRelInfo *resultRelInfo,
/* And evaluate the constraints */ /* And evaluate the constraints */
for (i = 0; i < ncheck; i++) for (i = 0; i < ncheck; i++)
{ {
ExprState *checkconstr = resultRelInfo->ri_ConstraintExprs[i]; ExprState *checkconstr = resultRelInfo->ri_CheckConstraintExprs[i];
/* /*
* NOTE: SQL specifies that a NULL result from a constraint expression * NOTE: SQL specifies that a NULL result from a constraint expression

View File

@ -546,8 +546,8 @@ typedef struct ResultRelInfo
/* list of WithCheckOption expr states */ /* list of WithCheckOption expr states */
List *ri_WithCheckOptionExprs; List *ri_WithCheckOptionExprs;
/* array of constraint-checking expr states */ /* array of expr states for checking check constraints */
ExprState **ri_ConstraintExprs; ExprState **ri_CheckConstraintExprs;
/* /*
* Arrays of stored generated columns ExprStates for INSERT/UPDATE/MERGE. * Arrays of stored generated columns ExprStates for INSERT/UPDATE/MERGE.