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-23T19:48:05Z
Lists: pgsql-bugs
Richard Guo <guofenglinux@gmail.com> writes: > ISTM that for outer join identity 3, if we are given form > (A leftjoin B on (Pab)) leftjoin C on (Pbc) > then references to C Vars in higher qual levels would be marked with the > B/C join. If we've transformed it to form > A leftjoin (B leftjoin C on (Pbc)) on (Pab) > then references to C Vars in higher qual levels should be adjusted to > include both B/C join and A/B join in their varnullingrels. Hmm. I remember having convinced myself that we didn't need to change anything above the commuting OJs, but now I can't reconstruct the reasoning :-(. I wonder whether we could instead fix things by deeming that the result of the pushed-down B/C join does not yet produce correct C* variables, so that we won't allow conditions involving them to drop below the pushed-up A/B join. This would be a little bit messy in some places because now we'd consider that the A/B join is adding two OJ relids not just one to the output join relid set, while the B/C join is adding no relids even though it must execute an outer join. (But we already have that notion for semijoins and some antijoins, so maybe it's fine.) 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