aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeModifyTable.c
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2022-04-20 10:34:58 +0200
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2022-04-20 10:34:58 +0200
commit3dcc6bf4068a29be2bebee80bb919f8057af0fd9 (patch)
tree8e9806016a22f8897042699121f1170aff821350 /src/backend/executor/nodeModifyTable.c
parent74547b9c23f9f7ecfc6511e055982b8d5f51ae88 (diff)
downloadpostgresql-3dcc6bf4068a29be2bebee80bb919f8057af0fd9.tar.gz
postgresql-3dcc6bf4068a29be2bebee80bb919f8057af0fd9.zip
ExecModifyTable: use context.planSlot instead of planSlot
There's no reason to keep a separate local variable when we have a place for it elsewhere. This allows to simplify some code. Reviewed-by: Michaƫl Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/202204191345.qerjy3kxi3eb@alvherre.pgsql
Diffstat (limited to 'src/backend/executor/nodeModifyTable.c')
-rw-r--r--src/backend/executor/nodeModifyTable.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c
index 171575cd73b..0de6abd5bb8 100644
--- a/src/backend/executor/nodeModifyTable.c
+++ b/src/backend/executor/nodeModifyTable.c
@@ -3452,7 +3452,6 @@ ExecModifyTable(PlanState *pstate)
ResultRelInfo *resultRelInfo;
PlanState *subplanstate;
TupleTableSlot *slot;
- TupleTableSlot *planSlot;
TupleTableSlot *oldSlot;
ItemPointerData tuple_ctid;
HeapTupleData oldtupdata;
@@ -3525,10 +3524,10 @@ ExecModifyTable(PlanState *pstate)
if (pstate->ps_ExprContext)
ResetExprContext(pstate->ps_ExprContext);
- planSlot = ExecProcNode(subplanstate);
+ context.planSlot = ExecProcNode(subplanstate);
/* No more tuples to process? */
- if (TupIsNull(planSlot))
+ if (TupIsNull(context.planSlot))
break;
/*
@@ -3542,7 +3541,7 @@ ExecModifyTable(PlanState *pstate)
bool isNull;
Oid resultoid;
- datum = ExecGetJunkAttribute(planSlot, node->mt_resultOidAttno,
+ datum = ExecGetJunkAttribute(context.planSlot, node->mt_resultOidAttno,
&isNull);
if (isNull)
{
@@ -3556,9 +3555,8 @@ ExecModifyTable(PlanState *pstate)
*/
if (operation == CMD_MERGE)
{
- EvalPlanQualSetSlot(&node->mt_epqstate, planSlot);
+ EvalPlanQualSetSlot(&node->mt_epqstate, context.planSlot);
- context.planSlot = planSlot;
context.lockmode = 0;
ExecMerge(&context, node->resultRelInfo, NULL, node->canSetTag);
@@ -3589,13 +3587,13 @@ ExecModifyTable(PlanState *pstate)
* ExecProcessReturning by IterateDirectModify, so no need to
* provide it here.
*/
- slot = ExecProcessReturning(resultRelInfo, NULL, planSlot);
+ slot = ExecProcessReturning(resultRelInfo, NULL, context.planSlot);
return slot;
}
- EvalPlanQualSetSlot(&node->mt_epqstate, planSlot);
- slot = planSlot;
+ EvalPlanQualSetSlot(&node->mt_epqstate, context.planSlot);
+ slot = context.planSlot;
tupleid = NULL;
oldtuple = NULL;
@@ -3637,9 +3635,8 @@ ExecModifyTable(PlanState *pstate)
{
if (operation == CMD_MERGE)
{
- EvalPlanQualSetSlot(&node->mt_epqstate, planSlot);
+ EvalPlanQualSetSlot(&node->mt_epqstate, context.planSlot);
- context.planSlot = planSlot;
context.lockmode = 0;
ExecMerge(&context, node->resultRelInfo, NULL, node->canSetTag);
@@ -3698,7 +3695,6 @@ ExecModifyTable(PlanState *pstate)
}
/* complete context setup */
- context.planSlot = planSlot;
context.lockmode = 0;
switch (operation)
@@ -3707,7 +3703,7 @@ ExecModifyTable(PlanState *pstate)
/* Initialize projection info if first time for this table */
if (unlikely(!resultRelInfo->ri_projectNewInfoValid))
ExecInitInsertProjection(node, resultRelInfo);
- slot = ExecGetInsertNewTuple(resultRelInfo, planSlot);
+ slot = ExecGetInsertNewTuple(resultRelInfo, context.planSlot);
slot = ExecInsert(&context, resultRelInfo, slot,
node->canSetTag, NULL, NULL);
break;
@@ -3737,7 +3733,7 @@ ExecModifyTable(PlanState *pstate)
oldSlot))
elog(ERROR, "failed to fetch tuple being updated");
}
- slot = internalGetUpdateNewTuple(resultRelInfo, planSlot,
+ slot = internalGetUpdateNewTuple(resultRelInfo, context.planSlot,
oldSlot, NULL);
context.GetUpdateNewTuple = internalGetUpdateNewTuple;
context.relaction = NULL;