Fix coredump problem in plpgsql's RETURN NEXT. When a SELECT INTO
Tom Lane <tgl@sss.pgh.pa.us>
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.
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/spi.sgml | modified | +3 −3 |
| src/backend/executor/spi.c | modified | +57 −43 |
| src/backend/tcop/dest.c | modified | +2 −2 |
| src/include/access/printtup.h | modified | +4 −2 |
| src/pl/plpgsql/src/pl_exec.c | modified | +39 −13 |