pgsql: Make real sure we don't reassociate joins into or out of SEMI/AN - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Make real sure we don't reassociate joins into or out of SEMI/AN
Date
Msg-id E1ZN3bN-00087c-Bz@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/4d94b5f1f003404f86b2659eff9814466d03640e

Modified Files
--------------
src/backend/optimizer/path/joinrels.c |   15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Make real sure we don't reassociate joins into or out of SEMI/AN
Next
From: Tom Lane
Date:
Subject: pgsql: Make real sure we don't reassociate joins into or out of SEMI/AN