]> granicus.if.org Git - postgresql/commit
Prevent improper reordering of antijoins vs. outer joins.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 25 Apr 2015 20:44:27 +0000 (16:44 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 25 Apr 2015 20:44:27 +0000 (16:44 -0400)
commit3cf8686014f91174018f20e01dbb0dafdcad0473
tree865d0d850055c85b18b339093d2be8996653dfa1
parent854adb83711da8fda2a8f028c27ad8956179c04a
Prevent improper reordering of antijoins vs. outer joins.

An outer join appearing within the RHS of an antijoin can't commute with
the antijoin, but somehow I missed teaching make_outerjoininfo() about
that.  In Teodor Sigaev's recent trouble report, this manifests as a
"could not find RelOptInfo for given relids" error within eqjoinsel();
but I think silently wrong query results are possible too, if the planner
misorders the joins and doesn't happen to trigger any internal consistency
checks.  It's broken as far back as we had antijoins, so back-patch to all
supported branches.
src/backend/optimizer/plan/initsplan.c
src/test/regress/expected/join.out
src/test/regress/sql/join.sql