mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-12 18:34:36 +08:00
Make SPI set SPI_processed for CREATE TABLE AS / SELECT INTO commands;
this in turn causes CREATE TABLE AS in plpgsql to set ROW_COUNT. This is how it behaved before 7.4; I had unintentionally changed the behavior in a bit of sloppy micro-optimization.
This commit is contained in:
parent
dce83e76e0
commit
56b01dc9ff
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.140 2005/05/06 17:24:54 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.141 2005/06/09 21:25:22 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1497,6 +1497,7 @@ static int
|
||||
_SPI_pquery(QueryDesc *queryDesc, long tcount)
|
||||
{
|
||||
int operation = queryDesc->operation;
|
||||
CommandDest origDest = queryDesc->dest->mydest;
|
||||
int res;
|
||||
Oid save_lastoid;
|
||||
|
||||
@ -1504,10 +1505,10 @@ _SPI_pquery(QueryDesc *queryDesc, long tcount)
|
||||
{
|
||||
case CMD_SELECT:
|
||||
res = SPI_OK_SELECT;
|
||||
if (queryDesc->parsetree->into != NULL) /* select into table */
|
||||
if (queryDesc->parsetree->into) /* select into table? */
|
||||
{
|
||||
res = SPI_OK_SELINTO;
|
||||
queryDesc->dest = None_Receiver; /* don't output results */
|
||||
queryDesc->dest = None_Receiver; /* don't output results */
|
||||
}
|
||||
break;
|
||||
case CMD_INSERT:
|
||||
@ -1548,7 +1549,8 @@ _SPI_pquery(QueryDesc *queryDesc, long tcount)
|
||||
|
||||
ExecutorEnd(queryDesc);
|
||||
|
||||
if (queryDesc->dest->mydest == SPI)
|
||||
/* Test origDest here so that SPI_processed gets set in SELINTO case */
|
||||
if (origDest == SPI)
|
||||
{
|
||||
SPI_processed = _SPI_current->processed;
|
||||
SPI_lastoid = save_lastoid;
|
||||
|
Loading…
Reference in New Issue
Block a user