Clean up handling of variable-free qual clauses. System now does the
Tom Lane <tgl@sss.pgh.pa.us>
Clean up handling of variable-free qual clauses. System now does the right thing with variable-free clauses that contain noncachable functions, such as 'WHERE random() < 0.5' --- these are evaluated once per potential output tuple. Expressions that contain only Params are now candidates to be indexscan quals --- for example, 'var = ($1 + 1)' can now be indexed. Cope with RelabelType nodes atop potential indexscan variables --- this oversight prevents 7.0.* from recognizing some potentially indexscanable situations.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/executor/execProcnode.c | modified | +2 −2 |
| src/backend/executor/nodeIndexscan.c | modified | +23 −11 |
| src/backend/executor/nodeNestloop.c | modified | +3 −3 |
| src/backend/optimizer/path/clausesel.c | modified | +10 −3 |
| src/backend/optimizer/path/indxpath.c | modified | +108 −60 |
| src/backend/optimizer/plan/createplan.c | modified | +7 −1 |
| src/backend/optimizer/plan/initsplan.c | modified | +13 −6 |
| src/backend/optimizer/plan/planmain.c | modified | +17 −5 |
| src/backend/optimizer/util/clauses.c | modified | +138 −18 |
| src/backend/utils/cache/lsyscache.c | modified | +44 −15 |
| src/include/executor/nodeNestloop.h | modified | +2 −2 |
| src/include/nodes/execnodes.h | modified | +3 −1 |
| src/include/optimizer/clauses.h | modified | +8 −2 |
| src/include/utils/lsyscache.h | modified | +12 −13 |
| src/pl/plpgsql/src/pl_exec.c | modified | +6 −21 |