diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-10-10 01:43:50 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-10-10 01:43:50 +0000 |
commit | 8a5849b7ff24c637a1140c26fc171e45c9142005 (patch) | |
tree | 8f660c08709c999c3a4299436312390c53231b01 /src/backend/nodes/copyfuncs.c | |
parent | b865d2758255b767e30dc5f23c7c7d209e716f3b (diff) |
Split the processing of INSERT/UPDATE/DELETE operations out of execMain.c.
They are now handled by a new plan node type called ModifyTable, which is
placed at the top of the plan tree. In itself this change doesn't do much,
except perhaps make the handling of RETURNING lists and inherited UPDATEs a
tad less klugy. But it is necessary preparation for the intended extension of
allowing RETURNING queries inside WITH.
Marko Tiikkaja
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r-- | src/backend/nodes/copyfuncs.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 27c231701d6..cee7cb8ded6 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -15,7 +15,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.442 2009/10/08 02:39:20 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.443 2009/10/10 01:43:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -77,6 +77,7 @@ _copyPlannedStmt(PlannedStmt *from) PlannedStmt *newnode = makeNode(PlannedStmt); COPY_SCALAR_FIELD(commandType); + COPY_SCALAR_FIELD(hasReturning); COPY_SCALAR_FIELD(canSetTag); COPY_NODE_FIELD(planTree); COPY_NODE_FIELD(rtable); @@ -85,7 +86,6 @@ _copyPlannedStmt(PlannedStmt *from) COPY_NODE_FIELD(intoClause); COPY_NODE_FIELD(subplans); COPY_BITMAPSET_FIELD(rewindPlanIDs); - COPY_NODE_FIELD(returningLists); COPY_NODE_FIELD(rowMarks); COPY_NODE_FIELD(relationOids); COPY_NODE_FIELD(invalItems); @@ -155,6 +155,30 @@ _copyResult(Result *from) } /* + * _copyModifyTable + */ +static ModifyTable * +_copyModifyTable(ModifyTable *from) +{ + ModifyTable *newnode = makeNode(ModifyTable); + + /* + * copy node superclass fields + */ + CopyPlanFields((Plan *) from, (Plan *) newnode); + + /* + * copy remainder of node + */ + COPY_SCALAR_FIELD(operation); + COPY_NODE_FIELD(resultRelations); + COPY_NODE_FIELD(plans); + COPY_NODE_FIELD(returningLists); + + return newnode; +} + +/* * _copyAppend */ static Append * @@ -171,7 +195,6 @@ _copyAppend(Append *from) * copy remainder of node */ COPY_NODE_FIELD(appendplans); - COPY_SCALAR_FIELD(isTarget); return newnode; } @@ -3482,6 +3505,9 @@ copyObject(void *from) case T_Result: retval = _copyResult(from); break; + case T_ModifyTable: + retval = _copyModifyTable(from); + break; case T_Append: retval = _copyAppend(from); break; |