pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix improper interaction of FULL JOINs with lateral references. 6+ messages / 1 participants [nested] [flat]
* pgsql: Fix improper interaction of FULL JOINs with lateral references. @ 2019-04-08 20:09 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2019-04-08 20:09 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix improper interaction of FULL JOINs with lateral references. join_is_legal() needs to reject forming certain outer joins in cases where that would lead the planner down a blind alley. However, it mistakenly supposed that the way to handle full joins was to treat them as applying the same constraints as for left joins, only to both sides. That doesn't work, as shown in bug #15741 from Anthony Skorski: given a lateral reference out of a join that's fully enclosed by a full join, the code would fail to believe that any join ordering is legal, resulting in errors like "failed to build any N-way joins". However, we don't really need to consider full joins at all for this purpose, because we effectively force them to be evaluated in syntactic order, and that order is always legal for lateral references. Hence, get rid of this broken logic for full joins and just ignore them instead. This seems to have been an oversight in commit 7e19db0c0. Back-patch to all supported branches, as that was. Discussion: https://postgr.es/m/15741-276f1f464b3f40eb@postgresql.org Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/45f8eaa8e3031c9cb12deb1b5e294bc052b378f2 Modified Files -------------- src/backend/optimizer/path/joinrels.c | 13 ++++--------- src/test/regress/expected/rangefuncs.out | 25 +++++++++++++++++++++++++ src/test/regress/sql/rangefuncs.sql | 15 +++++++++++++++ 3 files changed, 44 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix improper interaction of FULL JOINs with lateral references. @ 2019-04-08 20:09 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2019-04-08 20:09 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix improper interaction of FULL JOINs with lateral references. join_is_legal() needs to reject forming certain outer joins in cases where that would lead the planner down a blind alley. However, it mistakenly supposed that the way to handle full joins was to treat them as applying the same constraints as for left joins, only to both sides. That doesn't work, as shown in bug #15741 from Anthony Skorski: given a lateral reference out of a join that's fully enclosed by a full join, the code would fail to believe that any join ordering is legal, resulting in errors like "failed to build any N-way joins". However, we don't really need to consider full joins at all for this purpose, because we effectively force them to be evaluated in syntactic order, and that order is always legal for lateral references. Hence, get rid of this broken logic for full joins and just ignore them instead. This seems to have been an oversight in commit 7e19db0c0. Back-patch to all supported branches, as that was. Discussion: https://postgr.es/m/15741-276f1f464b3f40eb@postgresql.org Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/68e745ed0d230bde188dc4c9b528627d048144be Modified Files -------------- src/backend/optimizer/path/joinrels.c | 13 ++++--------- src/test/regress/expected/rangefuncs.out | 25 +++++++++++++++++++++++++ src/test/regress/sql/rangefuncs.sql | 15 +++++++++++++++ 3 files changed, 44 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix improper interaction of FULL JOINs with lateral references. @ 2019-04-08 20:09 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2019-04-08 20:09 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix improper interaction of FULL JOINs with lateral references. join_is_legal() needs to reject forming certain outer joins in cases where that would lead the planner down a blind alley. However, it mistakenly supposed that the way to handle full joins was to treat them as applying the same constraints as for left joins, only to both sides. That doesn't work, as shown in bug #15741 from Anthony Skorski: given a lateral reference out of a join that's fully enclosed by a full join, the code would fail to believe that any join ordering is legal, resulting in errors like "failed to build any N-way joins". However, we don't really need to consider full joins at all for this purpose, because we effectively force them to be evaluated in syntactic order, and that order is always legal for lateral references. Hence, get rid of this broken logic for full joins and just ignore them instead. This seems to have been an oversight in commit 7e19db0c0. Back-patch to all supported branches, as that was. Discussion: https://postgr.es/m/15741-276f1f464b3f40eb@postgresql.org Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/051c71c6746309782d9bf1ebb257d3b5f88e6fb7 Modified Files -------------- src/backend/optimizer/path/joinrels.c | 13 ++++--------- src/test/regress/expected/rangefuncs.out | 25 +++++++++++++++++++++++++ src/test/regress/sql/rangefuncs.sql | 15 +++++++++++++++ 3 files changed, 44 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix improper interaction of FULL JOINs with lateral references. @ 2019-04-08 20:09 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2019-04-08 20:09 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix improper interaction of FULL JOINs with lateral references. join_is_legal() needs to reject forming certain outer joins in cases where that would lead the planner down a blind alley. However, it mistakenly supposed that the way to handle full joins was to treat them as applying the same constraints as for left joins, only to both sides. That doesn't work, as shown in bug #15741 from Anthony Skorski: given a lateral reference out of a join that's fully enclosed by a full join, the code would fail to believe that any join ordering is legal, resulting in errors like "failed to build any N-way joins". However, we don't really need to consider full joins at all for this purpose, because we effectively force them to be evaluated in syntactic order, and that order is always legal for lateral references. Hence, get rid of this broken logic for full joins and just ignore them instead. This seems to have been an oversight in commit 7e19db0c0. Back-patch to all supported branches, as that was. Discussion: https://postgr.es/m/15741-276f1f464b3f40eb@postgresql.org Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/23791c41576a86f0536b314f78ccaa5ee689f80c Modified Files -------------- src/backend/optimizer/path/joinrels.c | 13 ++++--------- src/test/regress/expected/rangefuncs.out | 25 +++++++++++++++++++++++++ src/test/regress/sql/rangefuncs.sql | 15 +++++++++++++++ 3 files changed, 44 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix improper interaction of FULL JOINs with lateral references. @ 2019-04-08 20:09 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2019-04-08 20:09 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix improper interaction of FULL JOINs with lateral references. join_is_legal() needs to reject forming certain outer joins in cases where that would lead the planner down a blind alley. However, it mistakenly supposed that the way to handle full joins was to treat them as applying the same constraints as for left joins, only to both sides. That doesn't work, as shown in bug #15741 from Anthony Skorski: given a lateral reference out of a join that's fully enclosed by a full join, the code would fail to believe that any join ordering is legal, resulting in errors like "failed to build any N-way joins". However, we don't really need to consider full joins at all for this purpose, because we effectively force them to be evaluated in syntactic order, and that order is always legal for lateral references. Hence, get rid of this broken logic for full joins and just ignore them instead. This seems to have been an oversight in commit 7e19db0c0. Back-patch to all supported branches, as that was. Discussion: https://postgr.es/m/15741-276f1f464b3f40eb@postgresql.org Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/2f78974e29bde06c265dec1332a8cc4c06bcda97 Modified Files -------------- src/backend/optimizer/path/joinrels.c | 13 ++++--------- src/test/regress/expected/rangefuncs.out | 25 +++++++++++++++++++++++++ src/test/regress/sql/rangefuncs.sql | 15 +++++++++++++++ 3 files changed, 44 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix improper interaction of FULL JOINs with lateral references. @ 2019-04-08 20:09 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2019-04-08 20:09 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix improper interaction of FULL JOINs with lateral references. join_is_legal() needs to reject forming certain outer joins in cases where that would lead the planner down a blind alley. However, it mistakenly supposed that the way to handle full joins was to treat them as applying the same constraints as for left joins, only to both sides. That doesn't work, as shown in bug #15741 from Anthony Skorski: given a lateral reference out of a join that's fully enclosed by a full join, the code would fail to believe that any join ordering is legal, resulting in errors like "failed to build any N-way joins". However, we don't really need to consider full joins at all for this purpose, because we effectively force them to be evaluated in syntactic order, and that order is always legal for lateral references. Hence, get rid of this broken logic for full joins and just ignore them instead. This seems to have been an oversight in commit 7e19db0c0. Back-patch to all supported branches, as that was. Discussion: https://postgr.es/m/15741-276f1f464b3f40eb@postgresql.org Branch ------ REL9_4_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/c6df3a28ff40ca7124ea6c28adf2e3ff9910faee Modified Files -------------- src/backend/optimizer/path/joinrels.c | 13 ++++--------- src/test/regress/expected/rangefuncs.out | 25 +++++++++++++++++++++++++ src/test/regress/sql/rangefuncs.sql | 15 +++++++++++++++ 3 files changed, 44 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2019-04-08 20:09 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2019-04-08 20:09 pgsql: Fix improper interaction of FULL JOINs with lateral references. Tom Lane <tgl@sss.pgh.pa.us> 2019-04-08 20:09 pgsql: Fix improper interaction of FULL JOINs with lateral references. Tom Lane <tgl@sss.pgh.pa.us> 2019-04-08 20:09 pgsql: Fix improper interaction of FULL JOINs with lateral references. Tom Lane <tgl@sss.pgh.pa.us> 2019-04-08 20:09 pgsql: Fix improper interaction of FULL JOINs with lateral references. Tom Lane <tgl@sss.pgh.pa.us> 2019-04-08 20:09 pgsql: Fix improper interaction of FULL JOINs with lateral references. Tom Lane <tgl@sss.pgh.pa.us> 2019-04-08 20:09 pgsql: Fix improper interaction of FULL JOINs with lateral references. Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox