postgresql/src/include
Tom Lane 71b88cf52e Fix some more problems with nested append relations.
As of commit a87c72915 (which later got backpatched as far as 9.1),
we're explicitly supporting the notion that append relations can be
nested; this can occur when UNION ALL constructs are nested, or when
a UNION ALL contains a table with inheritance children.

Bug #11457 from Nelson Page, as well as an earlier report from Elvis
Pranskevichus, showed that there were still nasty bugs associated with such
cases: in particular the EquivalenceClass mechanism could try to generate
"join" clauses connecting an appendrel child to some grandparent appendrel,
which would result in assertion failures or bogus plans.

Upon investigation I concluded that all current callers of
find_childrel_appendrelinfo() need to be fixed to explicitly consider
multiple levels of parent appendrels.  The most complex fix was in
processing of "broken" EquivalenceClasses, which are ECs for which we have
been unable to generate all the derived equality clauses we would like to
because of missing cross-type equality operators in the underlying btree
operator family.  That code path is more or less entirely untested by
the regression tests to date, because no standard opfamilies have such
holes in them.  So I wrote a new regression test script to try to exercise
it a bit, which turned out to be quite a worthwhile activity as it exposed
existing bugs in all supported branches.

The present patch is essentially the same as far back as 9.2, which is
where parameterized paths were introduced.  In 9.0 and 9.1, we only need
to back-patch a small fragment of commit 5b7b5518d, which fixes failure to
propagate out the original WHERE clauses when a broken EC contains constant
members.  (The regression test case results show that these older branches
are noticeably stupider than 9.2+ in terms of the quality of the plans
generated; but we don't really care about plan quality in such cases,
only that the plan not be outright wrong.  A more invasive fix in the
older branches would not be a good idea anyway from a plan-stability
standpoint.)
2014-10-01 19:30:34 -04:00
..
access Treat 2PC commit/abort the same as regular xacts in recovery. 2014-07-29 11:58:01 +03:00
bootstrap Fix management of pendingOpsTable in auxiliary processes. 2012-07-18 15:28:17 -04:00
catalog Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
commands Fix REASSIGN OWNED for text search objects 2014-07-15 13:24:07 -04:00
datatype Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
executor Avoid leaking memory while evaluating arguments for a table function. 2014-06-19 22:13:51 -04:00
foreign Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
lib Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
libpq Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
mb Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
nodes Avoid leaking memory while evaluating arguments for a table function. 2014-06-19 22:13:51 -04:00
optimizer Fix some more problems with nested append relations. 2014-10-01 19:30:34 -04:00
parser Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
port Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
portability Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
postmaster Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
regex Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
replication Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
rewrite Avoid getting more than AccessShareLock when deparsing a query. 2014-03-06 19:31:12 -05:00
snowball Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
storage Mark x86's memory barrier inline assembly as clobbering the cpu flags. 2014-09-19 17:14:17 +02:00
tcop Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
tsearch Predict integer overflow to avoid buffer overruns. 2014-02-17 09:33:33 -05:00
utils 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
c.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
fmgr.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
funcapi.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
getaddrinfo.h Fix assorted issues in client host name lookup. 2014-04-02 17:11:31 -04:00
getopt_long.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
Makefile Fix server header file installation with vpath builds 2011-11-10 20:52:54 +02:00
miscadmin.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
pg_config.h.in Add mkdtemp() to libpgport. 2014-06-14 09:41:17 -04:00
pg_config.h.win32 Stamp 9.2.9. 2014-07-21 15:12:31 -04:00
pg_config_manual.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
pg_trace.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
pgstat.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
pgtime.h Fix some odd behaviors when using a SQL-style simple GMT offset timezone. 2013-11-01 12:13:26 -04:00
port.h Add mkdtemp() to libpgport. 2014-06-14 09:41:17 -04:00
postgres.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
postgres_ext.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
postgres_fe.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
rusagestub.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
windowapi.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00