postgresql/src
Tom Lane bcdd8a1949 Fix constant-folding of ROW(...) IS [NOT] NULL with composite fields.
The SQL standard appears to specify that IS [NOT] NULL's tests of field
nullness are non-recursive, ie, we shouldn't consider that a composite
field with value ROW(NULL,NULL) is null for this purpose.
ExecEvalNullTest got this right, but eval_const_expressions did not,
leading to weird inconsistencies depending on whether the expression
was such that the planner could apply constant folding.

Also, adjust the docs to mention that IS [NOT] DISTINCT FROM NULL can be
used as a substitute test if a simple null check is wanted for a rowtype
argument.  That motivated reordering things so that IS [NOT] DISTINCT FROM
is described before IS [NOT] NULL.  In HEAD, I went a bit further and added
a table showing all the comparison-related predicates.

Per bug #14235.  Back-patch to all supported branches, since it's certainly
undesirable that constant-folding should change the semantics.

Report and patch by Andrew Gierth; assorted wordsmithing and revised
regression test cases by me.

Report: <20160708024746.1410.57282@wrigleys.postgresql.org>
2016-07-26 15:25:02 -04:00
..
backend Fix constant-folding of ROW(...) IS [NOT] NULL with composite fields. 2016-07-26 15:25:02 -04:00
bin Sync back-branch copies of the timezone code with IANA release tzcode2016c. 2016-07-19 15:59:36 -04:00
include Fix GiST index build for NaN values in geometric types. 2016-07-14 18:46:00 -04:00
interfaces Stamp 9.2.17. 2016-05-09 16:56:07 -04:00
makefiles Don't use deprecated dllwrap on Cygwin. 2014-02-01 16:13:46 -05:00
pl Make pltcl regression tests safe for Danish locale. 2016-07-21 14:24:07 -04:00
port Stamp 9.2.17. 2016-05-09 16:56:07 -04:00
template AIX: Test the -qlonglong option before use. 2015-07-17 03:02:18 -04:00
test Fix constant-folding of ROW(...) IS [NOT] NULL with composite fields. 2016-07-26 15:25:02 -04:00
timezone Sync back-branch copies of the timezone code with IANA release tzcode2016c. 2016-07-19 15:59:36 -04:00
tools Fix MSVC build for changes in zic. 2016-07-19 17:53:31 -04:00
tutorial Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Fix some oversights in distprep and maintainer-clean targets. 2011-03-10 00:04:05 -05:00
Makefile.global.in Make numeric form of PG version number readily available in Makefiles. 2015-07-05 12:01:01 -04:00
Makefile.shlib Make the AIX case of Makefile.shlib safe for parallel make. 2016-07-23 20:30:55 -04:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00
win32.mak Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00