Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4717fdb

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 ofExecAssignResultType(). A future commit will likely make use of thatand combine creating the targetlist with the initialization of theresult slot. But it seems like good code hygiene anyway.Author: Andres FreundDiscussion:https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de
1 parentd02974e commit4717fdb

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
intnplans=list_length(node->plans);
18291829
ResultRelInfo*saved_resultRelInfo;
18301830
ResultRelInfo*resultRelInfo;
1831-
TupleDesctupDesc;
18321831
Plan*subplan;
18331832
ListCell*l;
18341833
inti;
@@ -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)

[8]ページ先頭

©2009-2025 Movatter.jp