Re: Problems with insert rule called from plpython

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pavel Hanak <hanak(at)brailcom(dot)cz>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Problems with insert rule called from plpython
Date: 2003-02-14 21:14:13
Message-ID: 11090.1045257253@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Pavel Hanak <hanak(at)brailcom(dot)cz> writes:
> Now calling "select testfun()" shows this fatal error:
> FATAL: SPI: improper call to spi_dest_setup

Hm, I'm glad I put in that test --- it exposed a problem. Here is
the patch for 7.3.

regards, tom lane

*** src/backend/executor/spi.c.orig Wed Jan 29 10:24:57 2003
--- src/backend/executor/spi.c Fri Feb 14 16:09:38 2003
***************
*** 1097,1102 ****
--- 1097,1111 ----
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))
***************
*** 1206,1211 ****
--- 1215,1229 ----
canSetResult = true;
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)
{

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2003-02-14 22:42:56 Re: Function will not back up on 7.2.3
Previous Message Josh Berkus 2003-02-14 21:00:22 Function will not back up on 7.2.3