pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix an oversight in checking whether a join with LATERAL refs is 4+ messages / 1 participants [nested] [flat]
* pgsql: Fix an oversight in checking whether a join with LATERAL refs is @ 2015-07-31 23:26 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 4+ messages in thread From: Tom Lane @ 2015-07-31 23:26 UTC (permalink / raw) To: pgsql-committers Fix an oversight in checking whether a join with LATERAL refs is legal. In many cases, we can implement a semijoin as a plain innerjoin by first passing the righthand-side relation through a unique-ification step. However, one of the cases where this does NOT work is where the RHS has a LATERAL reference to the LHS; that makes the RHS dependent on the LHS so that unique-ification is meaningless. joinpath.c understood this, and so would not generate any join paths of this kind ... but join_is_legal neglected to check for the case, so it would think that we could do it. The upshot would be a "could not devise a query plan for the given query" failure once we had failed to generate any join paths at all for the bogus join pair. Back-patch to 9.3 where LATERAL was added. Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/edf26ed033f18bddc9bfe5c239388330150766a1 Modified Files -------------- src/backend/optimizer/path/joinrels.c | 8 ++++++-- src/test/regress/expected/join.out | 35 +++++++++++++++++++++++++++++++++ src/test/regress/sql/join.sql | 13 ++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Fix an oversight in checking whether a join with LATERAL refs is @ 2015-07-31 23:26 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 4+ messages in thread From: Tom Lane @ 2015-07-31 23:26 UTC (permalink / raw) To: pgsql-committers Fix an oversight in checking whether a join with LATERAL refs is legal. In many cases, we can implement a semijoin as a plain innerjoin by first passing the righthand-side relation through a unique-ification step. However, one of the cases where this does NOT work is where the RHS has a LATERAL reference to the LHS; that makes the RHS dependent on the LHS so that unique-ification is meaningless. joinpath.c understood this, and so would not generate any join paths of this kind ... but join_is_legal neglected to check for the case, so it would think that we could do it. The upshot would be a "could not devise a query plan for the given query" failure once we had failed to generate any join paths at all for the bogus join pair. Back-patch to 9.3 where LATERAL was added. Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/a6492ff8970b06b9e27cc314c7d1aa574fcc7b04 Modified Files -------------- src/backend/optimizer/path/joinrels.c | 8 ++++++-- src/test/regress/expected/join.out | 35 +++++++++++++++++++++++++++++++++ src/test/regress/sql/join.sql | 13 ++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Fix an oversight in checking whether a join with LATERAL refs is @ 2015-07-31 23:26 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 4+ messages in thread From: Tom Lane @ 2015-07-31 23:26 UTC (permalink / raw) To: pgsql-committers Fix an oversight in checking whether a join with LATERAL refs is legal. In many cases, we can implement a semijoin as a plain innerjoin by first passing the righthand-side relation through a unique-ification step. However, one of the cases where this does NOT work is where the RHS has a LATERAL reference to the LHS; that makes the RHS dependent on the LHS so that unique-ification is meaningless. joinpath.c understood this, and so would not generate any join paths of this kind ... but join_is_legal neglected to check for the case, so it would think that we could do it. The upshot would be a "could not devise a query plan for the given query" failure once we had failed to generate any join paths at all for the bogus join pair. Back-patch to 9.3 where LATERAL was added. Branch ------ REL9_3_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/a4df781c9037584d66a6f04b0b010a5bab0b509b Modified Files -------------- src/backend/optimizer/path/joinrels.c | 8 ++++++-- src/test/regress/expected/join.out | 35 +++++++++++++++++++++++++++++++++ src/test/regress/sql/join.sql | 13 ++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Fix an oversight in checking whether a join with LATERAL refs is @ 2015-07-31 23:26 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 4+ messages in thread From: Tom Lane @ 2015-07-31 23:26 UTC (permalink / raw) To: pgsql-committers Fix an oversight in checking whether a join with LATERAL refs is legal. In many cases, we can implement a semijoin as a plain innerjoin by first passing the righthand-side relation through a unique-ification step. However, one of the cases where this does NOT work is where the RHS has a LATERAL reference to the LHS; that makes the RHS dependent on the LHS so that unique-ification is meaningless. joinpath.c understood this, and so would not generate any join paths of this kind ... but join_is_legal neglected to check for the case, so it would think that we could do it. The upshot would be a "could not devise a query plan for the given query" failure once we had failed to generate any join paths at all for the bogus join pair. Back-patch to 9.3 where LATERAL was added. Branch ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/216977a7d99507ca3227a505510bf5ced4f14799 Modified Files -------------- src/backend/optimizer/path/joinrels.c | 8 ++++++-- src/test/regress/expected/join.out | 35 +++++++++++++++++++++++++++++++++ src/test/regress/sql/join.sql | 13 ++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2015-07-31 23:26 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2015-07-31 23:26 pgsql: Fix an oversight in checking whether a join with LATERAL refs is Tom Lane <tgl@sss.pgh.pa.us> 2015-07-31 23:26 pgsql: Fix an oversight in checking whether a join with LATERAL refs is Tom Lane <tgl@sss.pgh.pa.us> 2015-07-31 23:26 pgsql: Fix an oversight in checking whether a join with LATERAL refs is Tom Lane <tgl@sss.pgh.pa.us> 2015-07-31 23:26 pgsql: Fix an oversight in checking whether a join with LATERAL refs is 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