pgsql: Fix bogus handling of "postponed" lateral quals.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix bogus handling of "postponed" lateral quals.
Date: 2014-01-30 19:51:29
Message-ID: E1W8xe5-0007KY-FM@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix bogus handling of "postponed" lateral quals.

When pulling a "postponed" qual from a LATERAL subquery up into the quals
of an outer join, we must make sure that the postponed qual is included
in those seen by make_outerjoininfo(). Otherwise we might compute a
too-small min_lefthand or min_righthand for the outer join, leading to
"JOIN qualification cannot refer to other relations" failures from
distribute_qual_to_rels. Subtler errors in the created plan seem possible,
too, if the extra qual would only affect join ordering constraints.

Per bug #9041 from David Leverton. Back-patch to 9.3.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/043f6ff05d0a5140dfe25faf277ec9f1d7169005

Modified Files
--------------
src/backend/optimizer/plan/initsplan.c | 56 +++++++++++++++++---------------
src/test/regress/expected/join.out | 22 +++++++++++++
src/test/regress/sql/join.sql | 8 +++++
3 files changed, 59 insertions(+), 27 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2014-01-30 20:48:45 pgsql: Add convenience functions pg_sleep_for and pg_sleep_until.
Previous Message Bruce Momjian 2014-01-30 17:48:27 pgsql: docs: add mention of index swapping