88 *
99 *
1010 * IDENTIFICATION
11- * $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.104 2003/09/16 00:50:09 tgl Exp $
11+ * $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.105 2003/09/23 15:11:33 tgl Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -1270,7 +1270,8 @@ _SPI_cursor_operation(Portal portal, bool forward, int count,
12701270elog (ERROR ,"invalid portal in SPI cursor operation" );
12711271
12721272/* Push the SPI stack */
1273- _SPI_begin_call (true);
1273+ if (_SPI_begin_call (true)< 0 )
1274+ elog (ERROR ,"SPI cursor operation called while not connected" );
12741275
12751276/* Reset the SPI result */
12761277SPI_processed = 0 ;
@@ -1320,8 +1321,7 @@ _SPI_procmem()
13201321}
13211322
13221323/*
1323- * _SPI_begin_call
1324- *
1324+ * _SPI_begin_call: begin a SPI operation within a connected procedure
13251325 */
13261326static int
13271327_SPI_begin_call (bool execmem )
@@ -1338,6 +1338,11 @@ _SPI_begin_call(bool execmem)
13381338return 0 ;
13391339}
13401340
1341+ /*
1342+ * _SPI_end_call: end a SPI operation within a connected procedure
1343+ *
1344+ * Note: this currently has no failure return cases, so callers don't check
1345+ */
13411346static int
13421347_SPI_end_call (bool procmem )
13431348{