1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Fix coredump problem in plpgsql's RETURN NEXT. When a SELECT INTO

that's selecting into a RECORD variable returns zero rows, make it
assign an all-nulls row to the RECORD; this is consistent with what
happens when the SELECT INTO target is not a RECORD.  In support of
this, tweak the SPI code so that a valid tuple descriptor is returned
even when a SPI select returns no rows.
This commit is contained in:
Tom Lane
2003-01-21 22:06:12 +00:00
parent f8d8266ac5
commit a4482f4c4c
5 changed files with 106 additions and 64 deletions

View File

@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/spi.sgml,v 1.24 2002/12/30 22:10:53 tgl Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/spi.sgml,v 1.25 2003/01/21 22:06:11 tgl Exp $
-->
<Chapter id="spi">
@ -476,7 +476,7 @@ You may pass multiple queries in one string or query string may be
The actual number of tuples for which the (last) query was executed is
returned in the global variable SPI_processed (if not <ReturnValue>SPI_OK_UTILITY</ReturnValue>).
If <ReturnValue>SPI_OK_SELECT</ReturnValue> is returned and SPI_processed &gt; 0 then you may use global
If <ReturnValue>SPI_OK_SELECT</ReturnValue> is returned then you may use global
pointer SPITupleTable *SPI_tuptable to access the result tuples.
</Para>
@ -517,7 +517,7 @@ You may pass multiple queries in one string or query string may be
<TITLE>Structures
</TITLE>
<Para>
If <ReturnValue>SPI_OK_SELECT</ReturnValue> is returned and SPI_processed &gt; 0 then you may use the global
If <ReturnValue>SPI_OK_SELECT</ReturnValue> is returned then you may use the global
pointer SPITupleTable *SPI_tuptable to access the selected tuples.
</Para>