Skip to content

Commit 2dde90a

Browse files
committed
Fix SPI result logic for case where there are multiple statements of the
same type in a rule. Per bug report from Pavel Hanak.
1 parent 3f63333 commit 2dde90a

File tree

1 file changed

+19
-1
lines changed
  • src/backend/executor

1 file changed

+19
-1
lines changed

src/backend/executor/spi.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.85 2003/01/29 15:24:46 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.86 2003/02/14 21:12:45 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1088,6 +1088,15 @@ _SPI_execute(const char *src, int tcount, _SPI_plan *plan)
10881088
else
10891089
canSetResult = false;
10901090

1091+
/* Reset state if can set result */
1092+
if (canSetResult)
1093+
{
1094+
SPI_processed = 0;
1095+
SPI_lastoid = InvalidOid;
1096+
SPI_tuptable = NULL;
1097+
_SPI_current->tuptable = NULL;
1098+
}
1099+
10911100
if (queryTree->commandType == CMD_UTILITY)
10921101
{
10931102
if (IsA(queryTree->utilityStmt, CopyStmt))
@@ -1199,6 +1208,15 @@ _SPI_execute_plan(_SPI_plan *plan, Datum *Values, const char *Nulls,
11991208
else
12001209
canSetResult = false;
12011210

1211+
/* Reset state if can set result */
1212+
if (canSetResult)
1213+
{
1214+
SPI_processed = 0;
1215+
SPI_lastoid = InvalidOid;
1216+
SPI_tuptable = NULL;
1217+
_SPI_current->tuptable = NULL;
1218+
}
1219+
12021220
if (queryTree->commandType == CMD_UTILITY)
12031221
{
12041222
res = SPI_OK_UTILITY;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy