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

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

Commit: 1f1d13beaba40d092e4c7a337f6f1e01db2a2606
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2010-07-08T00:14:10Z
Releases: 8.4.5
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