postgresql/src/backend
Tom Lane 6c560bef76 Fix thinko in previous patch for optimizing EXISTS-within-EXISTS.
When recursing after an optimization in pull_up_sublinks_qual_recurse, the
available_rels value passed down must include only the relations that are
in the righthand side of the new SEMI or ANTI join; it's incorrect to pull
up a sub-select that refers to other relations, as seen in the added test
case.  Per report from BangarRaju Vadapalli.

While at it, rethink the idea of recursing below a NOT EXISTS.  That is
essentially the same situation as pulling up ANY/EXISTS sub-selects that
are in the ON clause of an outer join, and it has the same disadvantage:
we'd force the two joins to be evaluated according to the syntactic nesting
order, because the lower join will most likely not be able to commute with
the ANTI join.  That could result in having to form a rather large join
product, whereas the handling of a correlated subselect is not quite that
dumb.  So until we can handle those cases better, #ifdef NOT_USED that
case.  (I think it's okay to pull up in the EXISTS/ANY cases, because SEMI
joins aren't so inflexible about ordering.)

Back-patch to 8.4, same as for previous patch in this area.  Fortunately
that patch hadn't made it into any shipped releases yet.
2011-06-20 14:33:42 -04:00
..
access pgindent run of recent SSI changes. Also, remove an unnecessary #include. 2011-06-16 16:17:16 +03:00
bootstrap Capitalization fixes 2011-06-19 00:39:19 +03:00
catalog Fix crash in CREATE UNLOGGED TABLE. 2011-06-17 13:37:01 -04:00
commands Fix thinko in previous patch to always update pg_class.reltuples/relpages. 2011-06-19 14:00:55 -04:00
executor Remove another no-longer-needed inclusion of predicate.h. 2011-06-16 11:43:43 -04:00
foreign Clean up most -Wunused-but-set-variable warnings from gcc 4.6 2011-04-11 22:28:45 +03:00
lib Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
libpq Pgindent run before 9.1 beta2. 2011-06-09 14:32:50 -04:00
main Pgindent run before 9.1 beta2. 2011-06-09 14:32:50 -04:00
nodes Fix handling of collations in multi-row VALUES constructs. 2011-04-18 15:31:52 -04:00
optimizer Fix thinko in previous patch for optimizing EXISTS-within-EXISTS. 2011-06-20 14:33:42 -04:00
parser Rework parsing of ConstraintAttributeSpec to improve NOT VALID handling. 2011-06-15 19:06:36 -04:00
po Translation updates for 9.1beta2 2011-06-09 23:02:48 +03:00
port Capitalization fixes 2011-06-19 00:39:19 +03:00
postmaster Pgindent run before 9.1 beta2. 2011-06-09 14:32:50 -04:00
regex Pgindent run before 9.1 beta2. 2011-06-09 14:32:50 -04:00
replication Pgindent run before 9.1 beta2. 2011-06-09 14:32:50 -04:00
rewrite Pgindent run before 9.1 beta2. 2011-06-09 14:32:50 -04:00
snowball Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
storage Capitalization fixes 2011-06-19 00:39:19 +03:00
tcop Refactor broken CREATE TABLE IF NOT EXISTS support. 2011-04-25 16:55:11 -04:00
tsearch Pgindent run before 9.1 beta2. 2011-06-09 14:32:50 -04:00
utils Capitalization fixes 2011-06-19 00:39:19 +03:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
common.mk Workaround for recursive make breakage 2011-01-13 09:32:06 +02:00
Makefile Use single quotes in preference to double quotes for protecting pathnames. 2011-06-15 21:45:50 -04:00
nls.mk Translation updates for 9.1beta2 2011-06-09 23:02:48 +03:00