mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +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/executor/spi.c,v 1.209 2009/10/02 17:57:30 alvherre Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.210 2009/10/10 01:43:47 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1975,19 +1975,19 @@ _SPI_pquery(QueryDesc *queryDesc, bool fire_triggers, long tcount)
|
||||
res = SPI_OK_SELECT;
|
||||
break;
|
||||
case CMD_INSERT:
|
||||
if (queryDesc->plannedstmt->returningLists)
|
||||
if (queryDesc->plannedstmt->hasReturning)
|
||||
res = SPI_OK_INSERT_RETURNING;
|
||||
else
|
||||
res = SPI_OK_INSERT;
|
||||
break;
|
||||
case CMD_DELETE:
|
||||
if (queryDesc->plannedstmt->returningLists)
|
||||
if (queryDesc->plannedstmt->hasReturning)
|
||||
res = SPI_OK_DELETE_RETURNING;
|
||||
else
|
||||
res = SPI_OK_DELETE;
|
||||
break;
|
||||
case CMD_UPDATE:
|
||||
if (queryDesc->plannedstmt->returningLists)
|
||||
if (queryDesc->plannedstmt->hasReturning)
|
||||
res = SPI_OK_UPDATE_RETURNING;
|
||||
else
|
||||
res = SPI_OK_UPDATE;
|
||||
@ -2011,7 +2011,7 @@ _SPI_pquery(QueryDesc *queryDesc, bool fire_triggers, long tcount)
|
||||
_SPI_current->processed = queryDesc->estate->es_processed;
|
||||
_SPI_current->lastoid = queryDesc->estate->es_lastoid;
|
||||
|
||||
if ((res == SPI_OK_SELECT || queryDesc->plannedstmt->returningLists) &&
|
||||
if ((res == SPI_OK_SELECT || queryDesc->plannedstmt->hasReturning) &&
|
||||
queryDesc->dest->mydest == DestSPI)
|
||||
{
|
||||
if (_SPI_checktuples())
|
||||
|
Reference in New Issue
Block a user