Fix bogus handling of "postponed" lateral quals.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 043f6ff05d0a5140dfe25faf277ec9f1d7169005
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2014-01-30T19:51:16Z
Releases: 9.4.0
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.

Files