Fix "cannot handle unplanned sub-select" error that can occur when a
Tom Lane <tgl@sss.pgh.pa.us>
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
| Path | Change | +/− |
|---|---|---|
| src/backend/optimizer/util/var.c | modified | +28 −2 |
| src/test/regress/expected/subselect.out | modified | +14 −0 |
| src/test/regress/sql/subselect.sql | modified | +12 −0 |