mirror of
https://github.com/postgres/postgres.git
synced 2025-08-22 21:53:06 +03:00
Add INSERT/UPDATE/DELETE RETURNING, with basic docs and regression tests.
plpgsql support to come later. Along the way, convert execMain's SELECT INTO support into a DestReceiver, in order to eliminate some ugly special cases. Jonah Harris and Tom Lane
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.153 2006/08/08 01:23:15 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.154 2006/08/12 02:52:04 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -955,6 +955,7 @@ SPI_cursor_open(const char *name, void *plan,
|
||||
PortalStart(portal, paramLI, snapshot);
|
||||
|
||||
Assert(portal->strategy == PORTAL_ONE_SELECT ||
|
||||
portal->strategy == PORTAL_ONE_RETURNING ||
|
||||
portal->strategy == PORTAL_UTIL_SELECT);
|
||||
|
||||
/* Return the created portal */
|
||||
@@ -1521,17 +1522,15 @@ _SPI_pquery(QueryDesc *queryDesc, long tcount)
|
||||
switch (operation)
|
||||
{
|
||||
case CMD_SELECT:
|
||||
res = SPI_OK_SELECT;
|
||||
if (queryDesc->parsetree->into) /* select into table? */
|
||||
{
|
||||
res = SPI_OK_SELINTO;
|
||||
queryDesc->dest = None_Receiver; /* don't output results */
|
||||
}
|
||||
else if (queryDesc->dest->mydest != DestSPI)
|
||||
{
|
||||
/* Don't return SPI_OK_SELECT if we're discarding result */
|
||||
res = SPI_OK_UTILITY;
|
||||
}
|
||||
else
|
||||
res = SPI_OK_SELECT;
|
||||
break;
|
||||
case CMD_INSERT:
|
||||
res = SPI_OK_INSERT;
|
||||
|
Reference in New Issue
Block a user