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

Started by Tom Laneover 12 years ago1 messagescomitters
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

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
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/a4aa854cadc9a8272c08940c93cbaeb3d1c89945

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(-)

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers