Re: Ignored join clause
Andrew Gierth <andrew@tao11.riddles.org.uk>
From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Andreas Karlsson <andreas@proxel.se>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2018-04-19T11:59:40Z
Lists: pgsql-bugs
>>>>> "Andrew" == Andrew Gierth <andrew@tao11.riddles.org.uk> writes: Andrew> My suspicion is that this is an interaction between lateral and Andrew> join reordering. Looking into it further. I think I was wrong, and that in fact this is a much more general problem which amounts to a lack of communication between get_joinrel_parampathinfo and extract_actual_join_clauses. When we build the hash join path between q1 and q2, get_joinrel_parampathinfo adds the q1.x=t.x clause to the restrict_clauses list, but it doesn't distinguish it in any way from the clauses that were there already. Later when building the final Plan node for the hash join, we call extract_actual_join_clauses to determine which clauses are join clauses rather than filters. But this only looks at the RestrictInfo's is_pushed_down field, and in this case that's wrong; is_pushed_down isn't set, because the condition really was a join clause at the place where it was originally written, but the condition has now been moved from its original place by the parameterization and is effectively pushed down even though it's not marked as such. So it ends up on the wrong list. -- Andrew (irc:RhodiumToad)
Commits
-
Tweak a couple of planner APIs to save recalculating join relids.
- ec38dcd363cd 11.0 landed
-
Change more places to be less trusting of RestrictInfo.is_pushed_down.
- 9680c120e5b2 9.3.23 landed
- 80e12a621876 9.5.13 landed
- 64ad85860ce6 9.6.9 landed
- 58fec95268dc 9.4.18 landed
- c792c7db4146 11.0 landed
- 8b6294c7a560 10.4 landed
-
Fix broken extract_actual_join_clauses call in 9.6 postgres_fdw.
- 306d6e59f751 9.6.9 cited
-
Fix incorrect handling of join clauses pushed into parameterized paths.
- e5d83995e9f8 11.0 landed
- e4e43a16b250 9.5.13 landed
- e1d4398c0a5b 9.3.23 landed
- a347d5210ef0 9.4.18 landed
- 68fab04f7c2a 10.4 landed
- 0c141fcaa7dd 9.6.9 landed
-
Handle restriction clause lists more uniformly in postgres_fdw.
- 28b047875554 10.0 cited