postgresql/src
Tom Lane d2ef7758d2 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
common pgindent run for 9.5 2015-05-23 21:35:49 -04:00
include Fix GiST index build for NaN values in geometric types. 2016-07-14 18:46:00 -04:00
interfaces Remove extraneous leading whitespace in Windows build script. 2016-06-13 11:50:34 -04:00
makefiles Link $(WIN32RES) into single-file modules only when PGFILEDESC is set. 2015-08-05 20:45:21 -04:00
pl Make pltcl regression tests safe for Danish locale. 2016-07-21 14:24:07 -04:00
port Stamp 9.5.3. 2016-05-09 16:50:23 -04:00
template AIX: Test the -qlonglong option before use. 2015-07-17 03:01:29 -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 no-longer-required function declarations. 2015-05-24 12:20:23 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04: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 Create libpgcommon, and move pg_malloc et al to it 2013-02-12 11:21:05 -03:00
Makefile.global.in Back-patch fixes to make TAP tests work on Windows. 2015-11-17 14:10:24 -05:00
Makefile.shlib Make the AIX case of Makefile.shlib safe for parallel make. 2016-07-23 20:30:40 -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 Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00