diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-02-14 21:12:54 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-02-14 21:12:54 +0000 |
commit | 79c049ddaa2f2c3142519c873d6a3efc6f2f145b (patch) | |
tree | 8d3968e16f31271d7f91da72cdc03cadf62e621f /src/backend/executor | |
parent | 56650f3fda5dcab57377eef95df55a036f0f122f (diff) |
Fix SPI result logic for case where there are multiple statements of the
same type in a rule. Per bug report from Pavel Hanak.
Diffstat (limited to 'src/backend/executor')
-rw-r--r-- | src/backend/executor/spi.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c index c237a126e86..27b075982a9 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.75.2.2 2003/01/29 15:24:57 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.75.2.3 2003/02/14 21:12:54 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1097,6 +1097,15 @@ _SPI_execute(char *src, int tcount, _SPI_plan *plan) else canSetResult = false; + /* Reset state if can set result */ + if (canSetResult) + { + SPI_processed = 0; + SPI_lastoid = InvalidOid; + SPI_tuptable = NULL; + _SPI_current->tuptable = NULL; + } + if (queryTree->commandType == CMD_UTILITY) { if (IsA(queryTree->utilityStmt, CopyStmt)) @@ -1207,6 +1216,15 @@ _SPI_execute_plan(_SPI_plan *plan, Datum *Values, char *Nulls, int tcount) else canSetResult = false; + /* Reset state if can set result */ + if (canSetResult) + { + SPI_processed = 0; + SPI_lastoid = InvalidOid; + SPI_tuptable = NULL; + _SPI_current->tuptable = NULL; + } + if (queryTree->commandType == CMD_UTILITY) { res = SPI_OK_UTILITY; |