pgsql: Prevent improper reordering of antijoins vs. outer joins.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Prevent improper reordering of antijoins vs. outer joins.
Date: 2015-04-25 20:44:52
Message-ID: E1Ym6wW-0001cg-1s@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/2e38198f605f39e96544c81a43f1984147e0890c

Modified Files
--------------
src/backend/optimizer/plan/initsplan.c | 7 +++---
src/test/regress/expected/join.out | 42 ++++++++++++++++++++++++++++++++
src/test/regress/sql/join.sql | 17 +++++++++++++
3 files changed, 63 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2015-04-26 01:00:51 pgsql: Don't overwrite EXTRA_INSTALL
Previous Message Peter Eisentraut 2015-04-25 12:58:33 pgsql: Replace backslashes by forward slashes in MSVC build code