Re: Clause accidentally pushed down ( Possible bug in Making Vars outer-join aware)
Richard Guo <guofenglinux@gmail.com>
From: Richard Guo <guofenglinux@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andrey Lepikhov <a.lepikhov@postgrespro.ru>, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2023-03-14T10:32:54Z
Lists: pgsql-bugs
Attachments
- v1-0001-Draft-adjust-upper-quals.patch (application/octet-stream) patch v1-0001
On Thu, Mar 2, 2023 at 11:27 PM Tom Lane <tgl@sss.pgh.pa.us> wrote: > What's feeling like it might be the best thing is to go ahead and > syntactically convert to the second form of identity 3 as soon as > we've determined it's applicable, so that upper C Vars are always > marked with both OJ relids. Not sure how much work is involved > there. I'm thinking something that once we've determined identity 3 applies in make_outerjoininfo we record information about how to adjust relids for upper quals and store this info in all upper JoinTreeItems. Then afterwards in distribute_qual_to_rels we check all this info stored in current JoinTreeItem and adjust relids for the qual accordingly. The info we record should consist of two parts, target_relids and added_relids. Vars and PHVs in quals that belong to target_relids should be adjusted to include added_relids. Following this idea I come up with attached patch (no comments and test cases yet). It fixes the presented case and passes check-world. Before finishing it I'd like to know whether this idea works. Any comments are appreciated. Thanks Richard
Commits
-
Fix thinko in join removal.
- d0f952691ff5 16.0 landed
-
Convert nullingrels match checks from Asserts to test-and-elog.
- 867be9c0738b 16.0 landed
-
Fix some issues with improper placement of outer join clauses.
- 9df8f903eb67 16.0 landed