Index: spi.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/executor/spi.c,v
retrieving revision 1.75.2.3
diff -c -r1.75.2.3 spi.c
*** spi.c	14 Feb 2003 21:12:54 -0000	1.75.2.3
--- spi.c	23 Sep 2003 15:09:39 -0000
***************
*** 1387,1393 ****
  		elog(ERROR, "invalid portal in SPI cursor operation");
  
  	/* Push the SPI stack */
! 	_SPI_begin_call(true);
  
  	/* Reset the SPI result */
  	SPI_processed = 0;
--- 1387,1394 ----
  		elog(ERROR, "invalid portal in SPI cursor operation");
  
  	/* Push the SPI stack */
! 	if (_SPI_begin_call(true) < 0)
! 		elog(ERROR, "SPI cursor operation called while not connected");
  
  	/* Reset the SPI result */
  	SPI_processed = 0;
