Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4717fdb

Browse files
committed
Rely on executor utils to build targetlist for DML RETURNING.
This is useful because it gets rid of the sole direct user of ExecAssignResultType(). A future commit will likely make use of that and combine creating the targetlist with the initialization of the result slot. But it seems like good code hygiene anyway. Author: Andres Freund Discussion: https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de
1 parent d02974e commit 4717fdb

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/backend/executor/nodeModifyTable.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,6 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
18281828
int nplans = list_length(node->plans);
18291829
ResultRelInfo *saved_resultRelInfo;
18301830
ResultRelInfo *resultRelInfo;
1831-
TupleDesc tupDesc;
18321831
Plan *subplan;
18331832
ListCell *l;
18341833
int i;
@@ -2068,12 +2067,11 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
20682067
* Initialize result tuple slot and assign its rowtype using the first
20692068
* RETURNING list. We assume the rest will look the same.
20702069
*/
2071-
tupDesc = ExecTypeFromTL((List *) linitial(node->returningLists),
2072-
false);
2070+
mtstate->ps.plan->targetlist = (List *) linitial(node->returningLists);
20732071

20742072
/* Set up a slot for the output of the RETURNING projection(s) */
20752073
ExecInitResultTupleSlot(estate, &mtstate->ps);
2076-
ExecAssignResultType(&mtstate->ps, tupDesc);
2074+
ExecAssignResultTypeFromTL(&mtstate->ps);
20772075
slot = mtstate->ps.ps_ResultTupleSlot;
20782076

20792077
/* Need an econtext too */
@@ -2126,9 +2124,9 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
21262124
* We still must construct a dummy result tuple type, because InitPlan
21272125
* expects one (maybe should change that?).
21282126
*/
2129-
tupDesc = ExecTypeFromTL(NIL, false);
2127+
mtstate->ps.plan->targetlist = NIL;
21302128
ExecInitResultTupleSlot(estate, &mtstate->ps);
2131-
ExecAssignResultType(&mtstate->ps, tupDesc);
2129+
ExecAssignResultTypeFromTL(&mtstate->ps);
21322130

21332131
mtstate->ps.ps_ExprContext = NULL;
21342132
}

0 commit comments

Comments
 (0)