]> granicus.if.org Git - postgresql/commit
Make real sure we don't reassociate joins into or out of SEMI/ANTI joins.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 5 Aug 2015 18:39:07 +0000 (14:39 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 5 Aug 2015 18:39:07 +0000 (14:39 -0400)
commitc084f613e20165012974db44106e4c5174c2ba5f
treeeb3d9605ce5e6a40661aabe1d141d5facf7331c0
parentf9ab07be9fbaa95735ae4c3a6592ad058e2c1819
Make real sure we don't reassociate joins into or out of SEMI/ANTI joins.

Per the discussion in optimizer/README, it's unsafe to reassociate anything
into or out of the RHS of a SEMI or ANTI join.  An example from Piotr
Stefaniak showed that join_is_legal() wasn't sufficiently enforcing this
rule, so lock it down a little harder.

I couldn't find a reasonably simple example of the optimizer trying to
do this, so no new regression test.  (Piotr's example involved the random
search in GEQO accidentally trying an invalid case and triggering a sanity
check way downstream in clause selectivity estimation, which did not seem
like a sequence of events that would be useful to memorialize in a
regression test as-is.)

Back-patch to all active branches.
src/backend/optimizer/path/joinrels.c