Pavel Hanak <[EMAIL PROTECTED]> 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) { ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]