|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.84 2003/01/21 22:06:12 tgl Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.85 2003/01/29 15:24:46 tgl Exp $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
@@ -124,6 +124,14 @@ SPI_finish(void)
|
124 | 124 | MemoryContextDelete(_SPI_current->execCxt);
|
125 | 125 | MemoryContextDelete(_SPI_current->procCxt);
|
126 | 126 |
|
| 127 | +/* |
| 128 | + * Reset result variables, especially SPI_tuptable which is probably |
| 129 | + * pointing at a just-deleted tuptable |
| 130 | + */ |
| 131 | +SPI_processed=0; |
| 132 | +SPI_lastoid=InvalidOid; |
| 133 | +SPI_tuptable=NULL; |
| 134 | + |
127 | 135 | /*
|
128 | 136 | * After _SPI_begin_call _SPI_connected == _SPI_curid. Now we are
|
129 | 137 | * closing connection to SPI and returning to upper Executor and so
|
@@ -1314,6 +1322,11 @@ _SPI_pquery(QueryDesc *queryDesc, bool runit, int tcount)
|
1314 | 1322 | SPI_lastoid=save_lastoid;
|
1315 | 1323 | SPI_tuptable=_SPI_current->tuptable;
|
1316 | 1324 | }
|
| 1325 | +elseif (res==SPI_OK_SELECT) |
| 1326 | +{ |
| 1327 | +/* Don't return SPI_OK_SELECT if we discarded the result */ |
| 1328 | +res=SPI_OK_UTILITY; |
| 1329 | +} |
1317 | 1330 |
|
1318 | 1331 | ExecutorEnd(queryDesc);
|
1319 | 1332 |
|
|