|
8 | 8 | * |
9 | 9 | * |
10 | 10 | * IDENTIFICATION |
11 | | - * $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.140 2005/05/06 17:24:54 tgl Exp $ |
| 11 | + * $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.141 2005/06/09 21:25:22 tgl Exp $ |
12 | 12 | * |
13 | 13 | *------------------------------------------------------------------------- |
14 | 14 | */ |
@@ -1497,17 +1497,18 @@ static int |
1497 | 1497 | _SPI_pquery(QueryDesc*queryDesc,longtcount) |
1498 | 1498 | { |
1499 | 1499 | intoperation=queryDesc->operation; |
| 1500 | +CommandDestorigDest=queryDesc->dest->mydest; |
1500 | 1501 | intres; |
1501 | 1502 | Oidsave_lastoid; |
1502 | 1503 |
|
1503 | 1504 | switch (operation) |
1504 | 1505 | { |
1505 | 1506 | caseCMD_SELECT: |
1506 | 1507 | res=SPI_OK_SELECT; |
1507 | | -if (queryDesc->parsetree->into!=NULL)/* select into table */ |
| 1508 | +if (queryDesc->parsetree->into)/* select into table? */ |
1508 | 1509 | { |
1509 | 1510 | res=SPI_OK_SELINTO; |
1510 | | -queryDesc->dest=None_Receiver;/* don't output results */ |
| 1511 | +queryDesc->dest=None_Receiver;/* don't output results */ |
1511 | 1512 | } |
1512 | 1513 | break; |
1513 | 1514 | caseCMD_INSERT: |
@@ -1548,7 +1549,8 @@ _SPI_pquery(QueryDesc *queryDesc, long tcount) |
1548 | 1549 |
|
1549 | 1550 | ExecutorEnd(queryDesc); |
1550 | 1551 |
|
1551 | | -if (queryDesc->dest->mydest==SPI) |
| 1552 | +/* Test origDest here so that SPI_processed gets set in SELINTO case */ |
| 1553 | +if (origDest==SPI) |
1552 | 1554 | { |
1553 | 1555 | SPI_processed=_SPI_current->processed; |
1554 | 1556 | SPI_lastoid=save_lastoid; |
|