Commit 2dde90ad authored by Tom Lane's avatar Tom Lane

Fix SPI result logic for case where there are multiple statements of the

same type in a rule.  Per bug report from Pavel Hanak.
parent 3f633335
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.85 2003/01/29 15:24:46 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.86 2003/02/14 21:12:45 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1088,6 +1088,15 @@ _SPI_execute(const char *src, int tcount, _SPI_plan *plan) ...@@ -1088,6 +1088,15 @@ _SPI_execute(const char *src, int tcount, _SPI_plan *plan)
else else
canSetResult = false; 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 (queryTree->commandType == CMD_UTILITY)
{ {
if (IsA(queryTree->utilityStmt, CopyStmt)) if (IsA(queryTree->utilityStmt, CopyStmt))
...@@ -1199,6 +1208,15 @@ _SPI_execute_plan(_SPI_plan *plan, Datum *Values, const char *Nulls, ...@@ -1199,6 +1208,15 @@ _SPI_execute_plan(_SPI_plan *plan, Datum *Values, const char *Nulls,
else else
canSetResult = false; 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 (queryTree->commandType == CMD_UTILITY)
{ {
res = SPI_OK_UTILITY; res = SPI_OK_UTILITY;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment