Fix "cannot handle unplanned sub-select" error that can occur when a

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

Commit: accabacce905371f94d9d9a00e308931b56b7d67
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2010-07-08T00:14:28Z
Releases: 8.1.22
Fix "cannot handle unplanned sub-select" error that can occur when a
sub-select contains a join alias reference that expands into an expression
containing another sub-select.  Per yesterday's report from Merlin Moncure
and subsequent off-list investigation.

Back-patch to 7.4.  Older versions didn't attempt to flatten sub-selects in
ways that would trigger this problem.

Files