postgresql/src/backend
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
..
access Fix torn-page, unlogged xid and further risks from heap_update(). 2016-07-15 17:49:48 -07:00
bootstrap pgindent run for 9.5 2015-05-23 21:35:49 -04:00
catalog Fix multiple minor infelicities in aclchk.c error reports. 2016-06-13 13:53:10 -04:00
commands Fix CREATE MATVIEW/CREATE TABLE AS ... WITH NO DATA to not plan the query. 2016-06-27 15:57:21 -04:00
executor Fix constant-folding of ROW(...) IS [NOT] NULL with composite fields. 2016-07-26 15:25:02 -04:00
foreign Code review for foreign/custom join pushdown patch. 2015-05-10 14:36:36 -04:00
lib Avoid use of float arithmetic in bipartite_match.c. 2015-08-23 13:02:19 -04:00
libpq Distrust external OpenSSL clients; clear err queue 2016-05-06 23:47:42 -04:00
main Avoid crash on old Windows with AVX2-capable CPU for VS2013 builds 2016-03-10 14:10:32 +01:00
nodes Fix CREATE MATVIEW/CREATE TABLE AS ... WITH NO DATA to not plan the query. 2016-06-27 15:57:21 -04:00
optimizer Fix constant-folding of ROW(...) IS [NOT] NULL with composite fields. 2016-07-26 15:25:02 -04:00
parser Fix grammar's AND/OR flattening to work with operator_precedence_warning. 2016-06-03 19:12:30 -04:00
po Translation updates 2016-05-09 10:05:46 -04:00
port Support building with Visual Studio 2015 2016-04-29 08:06:25 -04:00
postmaster Make "postgres -C guc" print "" not "(null)" for null-valued GUCs. 2016-06-22 11:55:24 -04:00
regex Suppress compiler warnings about useless comparison of unsigned to zero. 2016-02-15 17:11:52 -05:00
replication Fix typo in ReorderBufferIterTXNInit(). 2016-06-30 12:37:02 -04:00
rewrite Improve error message for rejecting RETURNING clauses with dropped columns. 2016-02-29 19:11:44 -05:00
snowball Remove no-longer-required function declarations. 2015-05-24 12:20:23 -04:00
storage Finish up XLOG_HINT renaming 2016-06-17 18:05:55 -04:00
tcop Be more predictable about reporting "lock timeout" vs "statement timeout". 2016-05-27 10:40:20 -04:00
tsearch Fix possible use of uninitialised value in ts_headline() 2016-04-08 21:25:32 +03:00
utils Remove very-obsolete estimates of shmem usage from postgresql.conf.sample. 2016-07-19 18:41:30 -04:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
Makefile AIX: Link the postgres executable with -Wl,-brtllib. 2015-07-15 21:00:30 -04:00
nls.mk Translation updates 2015-02-01 23:23:40 -05:00