aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-06-09 21:25:22 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-06-09 21:25:22 +0000
commit56b01dc9ff900a944cd970ea8d65fd3de2361441 (patch)
tree464525b10520b63f8cfefb7d7d153c9eccdf07b2 /src
parentdce83e76e0083a9a73321040f3a678ecd3e51006 (diff)
downloadpostgresql-56b01dc9ff900a944cd970ea8d65fd3de2361441.tar.gz
postgresql-56b01dc9ff900a944cd970ea8d65fd3de2361441.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/backend/executor/spi.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index 22619930b2f..f00a2c3c411 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -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;