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: Robert Haas <robertmhaas@gmail.com>,
Andrey Lepikhov <a.lepikhov@postgrespro.ru>,
PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2023-05-18T13:28:33Z
Lists: pgsql-bugs
Richard Guo <guofenglinux@gmail.com> writes: > BTW, it seems that there is a minor thinko in the changes. In the > outer-join removal logic, we use syn_xxxhand to compute the relid set > for the join we are considering to remove. I think this might be not > right, because the outer joins may not be performed in syntactic order. No, I don't believe that. What we are interested in at this point is the semantic effect (or lack of it) of the potentially-removable join. It's fine to reason about that under the assumption that the joins will be done in syntactic order. If later parts of the planner decide to implement the joins in a different order, that cannot change the conclusion about whether it's safe to remove a join --- otherwise, either we were mistaken to remove the join, or the reordering logic is wrong. I prefer the code as it stands now because it helps to decouple the join-removal reasoning from the join-reordering logic, limiting any possible effect of bugs in the latter. (I think I might've had some other reason for changing it as well, but can't reconstruct that first thing in the morning.) 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