Fix optimizer to not try to push WHERE clauses down into a sub-SELECT that
Tom Lane <tgl@sss.pgh.pa.us>
Fix optimizer to not try to push WHERE clauses down into a sub-SELECT that has a DISTINCT ON clause, per bug report from Anthony Wood. While at it, improve the DISTINCT-ON-clause recognizer routine to not be fooled by out- of-order DISTINCT lists. Also, back-patch earlier fix to not push down into sub-SELECT with LIMIT.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/optimizer/path/allpaths.c | modified | +8 −2 |
| src/backend/optimizer/util/clauses.c | modified | +54 −2 |
| src/backend/utils/adt/ruleutils.c | modified | +4 −33 |
| src/include/optimizer/clauses.h | modified | +3 −1 |