Re: Clause accidentally pushed down ( Possible bug in Making Vars outer-join aware)
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Guo <guofenglinux@gmail.com>
Cc: Andrey Lepikhov <a.lepikhov@postgrespro.ru>,
PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2023-02-28T19:10:07Z
Lists: pgsql-bugs
Attachments
- postpone-adding-pushed-down-ojrelid-to-relids.patch (text/x-diff) patch
I wrote: > I have a WIP patch that does it like this, and it fixes the presented > case; but it's not complete so it's still failing some existing > regression tests. More later. Here's said patch. Although this fixes the described problem and passes check-world, I'm not totally happy with it yet: it feels like the new add_outer_joins_to_relids() function is too expensive to be doing every time we construct a join relation. I wonder if there is a way we can add more info to the SpecialJoinInfo data structure to make it cheaper. An obvious improvement is to store commute_below_l explicitly instead of recomputing it over and over, but that isn't going to move the needle all that far. Is there a way to not have to scan all the SpecialJoinInfos? I may be worrying over nothing --- it's likely that the path construction work that will happen after we make the join relation RelOptInfo will swamp this cost anyway. But it feels ugly. Another thing I'm wondering about is whether this'd let us get rid of RestrictInfo.is_pushed_down and RINFO_IS_PUSHED_DOWN. I tried really hard to remove those in favor of checking to see whether a qual clause's required_relids include the outer join being formed, which seems like a much more principled way of deciding whether it's a filter or join clause. I couldn't get that to work, but now I wonder if what I was running into was really bugs associated with not understanding that we haven't fully formed the lower outer join when we apply identity 3. regards, tom lane
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