pgsql: Fix handling of strict non-set functions with NULLs in set-value

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix handling of strict non-set functions with NULLs in set-value
Date: 2013-05-12 17:08:24
Message-ID: E1UbZl2-0004kY-F8@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix handling of strict non-set functions with NULLs in set-valued inputs.

In a construct like "select plain_function(set_returning_function(...))",
the plain function is applied to each output row of the SRF successively.
If some of the SRF outputs are NULL, and the plain function is strict,
you'd expect to get NULL results for such rows ... but what actually
happened was that such rows were omitted entirely from the result set.
This was due to confusion of this case with what should happen for nested
set-returning functions; a strict SRF is indeed supposed to yield an empty
set for null input. Per bug #8150 from Erwin Brandstetter.

Although this has been broken forever, we're not back-patching because
of the possibility that some apps out there expect the incorrect behavior.
This change should be listed as a possible incompatibility in the 9.3
release notes.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/904af8db8a99409257db1eed0b056c8098e9013c

Modified Files
--------------
src/backend/executor/execQual.c | 10 +++++++++-
src/test/regress/expected/arrays.out | 9 +++++++++
src/test/regress/sql/arrays.sql | 1 +
3 files changed, 19 insertions(+), 1 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2013-05-13 19:41:50 pgsql: Fix handling of OID wraparound while in standalone mode.
Previous Message Peter Eisentraut 2013-05-12 02:03:07 pgsql: pgbench: Fix order of options in --help output