]> granicus.if.org Git - postgresql/commit
Improve sublink pullup code to handle ANY/EXISTS sublinks that are at top
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 17 Aug 2008 01:20:00 +0000 (01:20 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 17 Aug 2008 01:20:00 +0000 (01:20 +0000)
commit19e34b62395b36513a8e6c35ddfbeef12dd1e89f
treecf74ae45a1d9ea3c6f2ffc471d5dea75fb510984
parent909346eff0ca2c7a73e889122d6f54669494141b
Improve sublink pullup code to handle ANY/EXISTS sublinks that are at top
level of a JOIN/ON clause, not only at top level of WHERE.  (However, we
can't do this in an outer join's ON clause, unless the ANY/EXISTS refers
only to the nullable side of the outer join, so that it can effectively
be pushed down into the nullable side.)  Per request from Kevin Grittner.

In passing, fix a bug in the initial implementation of EXISTS pullup:
it would Assert if the EXIST's WHERE clause used a join alias variable.
Since we haven't yet flattened join aliases when this transformation
happens, it's necessary to include join relids in the computed set of
RHS relids.
src/backend/optimizer/plan/initsplan.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/plan/subselect.c
src/backend/optimizer/prep/prepjointree.c
src/include/optimizer/prep.h
src/include/optimizer/subselect.h