mirror of
https://github.com/postgres/postgres.git
synced 2025-07-12 21:01:52 +03:00
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
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.131 2009/06/11 14:49:02 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.132 2009/10/10 01:43:49 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -338,7 +338,7 @@ ChoosePortalStrategy(List *stmts)
|
||||
{
|
||||
if (++nSetTag > 1)
|
||||
return PORTAL_MULTI_QUERY; /* no need to look further */
|
||||
if (pstmt->returningLists == NIL)
|
||||
if (!pstmt->hasReturning)
|
||||
return PORTAL_MULTI_QUERY; /* no need to look further */
|
||||
}
|
||||
}
|
||||
@ -414,8 +414,8 @@ FetchStatementTargetList(Node *stmt)
|
||||
pstmt->utilityStmt == NULL &&
|
||||
pstmt->intoClause == NULL)
|
||||
return pstmt->planTree->targetlist;
|
||||
if (pstmt->returningLists)
|
||||
return (List *) linitial(pstmt->returningLists);
|
||||
if (pstmt->hasReturning)
|
||||
return pstmt->planTree->targetlist;
|
||||
return NIL;
|
||||
}
|
||||
if (IsA(stmt, FetchStmt))
|
||||
@ -570,9 +570,9 @@ PortalStart(Portal portal, ParamListInfo params, Snapshot snapshot)
|
||||
|
||||
pstmt = (PlannedStmt *) PortalGetPrimaryStmt(portal);
|
||||
Assert(IsA(pstmt, PlannedStmt));
|
||||
Assert(pstmt->returningLists);
|
||||
Assert(pstmt->hasReturning);
|
||||
portal->tupDesc =
|
||||
ExecCleanTypeFromTL((List *) linitial(pstmt->returningLists),
|
||||
ExecCleanTypeFromTL(pstmt->planTree->targetlist,
|
||||
false);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user