forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5840c20
committed
Rethink treatment of "postponed" quals in deconstruct_jointree().
After pulling up LATERAL subqueries, we may have qual clauses thatrefer to relations outside their syntactic scope. Before doing anysuch pullup, prepjointree.c checks to make sure that it wouldn'tcreate a semantically-invalid situation; but we leave it todeconstruct_jointree() to actually move these quals up the jointree to a place where they can be evaluated. In commit2489d76,I (tgl) refactored deconstruct_jointree() in a way that causedassertion failures while moving such quals, because the new logicfailed to distinguish "this jointree node is a parent of the sourceone" from "this jointree node is processed after the sourceone in depth-first order".Fix this, and at the same time reduce the overhead a bit, bygetting rid of the common PostponedQual list and instead making eachJoinTreeItem contain a list of quals that needed to be postponed toits level. We can help distribute_qual_to_rels find the appropriateJoinTreeItem efficiently by adding parent-item links to theJoinTreeItem data structure. This ends up being the same numberof relid subset checks as the original (pre-bug) logic, but lesslist manipulation is required during multi-level postponements.Richard Guo and Tom Lane, per bug #17768 from Robins Tharakan.Discussion:https://postgr.es/m/17768-5ac8730ece54478f@postgresql.org1 parentfaff8f8 commit5840c20
File tree
3 files changed
+111
-120
lines changed- src
- backend/optimizer/plan
- test/regress
- expected
- sql
3 files changed
+111
-120
lines changed0 commit comments
Comments
(0)