postgresql/src/backend
Tom Lane 1c0dfaa68f Compute correct em_nullable_relids in get_eclass_for_sort_expr().
Bug #8591 from Claudio Freire demonstrates that get_eclass_for_sort_expr
must be able to compute valid em_nullable_relids for any new equivalence
class members it creates.  I'd worried about this in the commit message
for db9f0e1d9a, but claimed that it wasn't a
problem because multi-member ECs should already exist when it runs.  That
is transparently wrong, though, because this function is also called by
initialize_mergeclause_eclasses, which runs during deconstruct_jointree.
The example given in the bug report (which the new regression test item
is based upon) fails because the COALESCE() expression is first seen by
initialize_mergeclause_eclasses rather than process_equivalence.

Fixing this requires passing the appropriate nullable_relids set to
get_eclass_for_sort_expr, and it requires new code to compute that set
for top-level expressions such as ORDER BY, GROUP BY, etc.  We store
the top-level nullable_relids in a new field in PlannerInfo to avoid
computing it many times.  In the back branches, I've added the new
field at the end of the struct to minimize ABI breakage for planner
plugins.  There doesn't seem to be a good alternative to changing
get_eclass_for_sort_expr's API signature, though.  There probably aren't
any third-party extensions calling that function directly; moreover,
if there are, they probably need to think about what to pass for
nullable_relids anyway.

Back-patch to 9.2, like the previous patch in this area.
2013-11-15 16:46:21 -05:00
..
access Fix race condition in GIN posting tree page deletion. 2013-11-08 22:23:03 +02:00
bootstrap Prevent memory leaks from accumulating across printtup() calls. 2013-11-03 11:33:09 -05:00
catalog Don't fail for bad GUCs in CREATE FUNCTION with check_function_bodies off. 2013-09-03 18:32:23 -04:00
commands Fix subtly-wrong volatility checking in BeginCopyFrom(). 2013-11-08 08:59:43 -05:00
executor Prevent display of dropped columns in row constraint violation messages. 2013-11-07 14:41:39 -05:00
foreign Arrange to cache FdwRoutine structs in foreign tables' relcache entries. 2013-03-06 23:48:09 -05:00
lib Reset the binary heap in MergeAppend rescans. 2013-08-30 19:15:32 -04:00
libpq Fix memory leak when an empty ident file is reloaded. 2013-10-24 14:05:34 +03:00
main pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
nodes Compute correct em_nullable_relids in get_eclass_for_sort_expr(). 2013-11-15 16:46:21 -05:00
optimizer Compute correct em_nullable_relids in get_eclass_for_sort_expr(). 2013-11-15 16:46:21 -05:00
parser Re-allow duplicate aliases within aliased JOINs. 2013-11-11 10:43:00 -05:00
po Translation updates 2013-10-07 16:27:04 -04:00
port Message style improvements 2013-08-07 22:53:50 -04:00
postmaster Rename various "freeze multixact" variables 2013-09-16 15:56:11 -03:00
regex Fix regex match failures for backrefs combined with non-greedy quantifiers. 2013-07-18 21:22:43 -04:00
replication Don't crash when pg_xlog is empty and pg_basebackup -x is used 2013-08-24 17:14:18 +02:00
rewrite Fix breakage of MV column name list usage. 2013-11-04 14:45:18 -06:00
snowball Update copyrights for 2013 2013-01-01 17:15:01 -05:00
storage Ensure all files created for a single BufFile have the same resource owner. 2013-11-01 16:09:52 -04:00
tcop Ignore interrupts during quickdie(). 2013-09-11 20:14:07 -04:00
tsearch pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
utils Fix failure with whole-row reference to a subquery. 2013-11-11 16:36:41 -05:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
common.mk Call check_keywords.pl in maintainer-check 2012-02-27 13:53:12 +02:00
Makefile Move relpath() to libpgcommon 2013-02-21 22:46:17 -03:00
nls.mk Add libpgcommon to backend gettext source files 2013-10-21 06:20:05 -04:00