pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix another oversight in checking if a join with LATERAL refs is
4+ messages / 1 participants
[nested] [flat]

* pgsql: Fix another oversight in checking if a join with LATERAL refs is
@ 2015-12-07 22:42 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2015-12-07 22:42 UTC (permalink / raw)
  To: pgsql-committers

Fix another oversight in checking if a join with LATERAL refs is legal.

It was possible for the planner to decide to join a LATERAL subquery to
the outer side of an outer join before the outer join itself is completed.
Normally that's fine because of the associativity rules, but it doesn't
work if the subquery contains a lateral reference to the inner side of the
outer join.  In such a situation the outer join *must* be done first.
join_is_legal() missed this consideration and would allow the join to be
attempted, but the actual path-building code correctly decided that no
valid join path could be made, sometimes leading to planner errors such as
"failed to build any N-way joins".

Per report from Andreas Seltenreich.  Back-patch to 9.3 where LATERAL
support was added.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/7e19db0c09719d7919a8fdd96a1fffe7efd2df93

Modified Files
--------------
src/backend/optimizer/path/joinrels.c |   30 ++++++++++++++++++++++++
src/backend/optimizer/util/relnode.c  |   41 +++++++++++++++++++++++++++++++++
src/include/optimizer/pathnode.h      |    1 +
src/test/regress/expected/join.out    |   41 +++++++++++++++++++++++++++++++++
src/test/regress/sql/join.sql         |   19 +++++++++++++++
5 files changed, 132 insertions(+)


-- 
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 another oversight in checking if a join with LATERAL refs is
@ 2015-12-07 22:42 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2015-12-07 22:42 UTC (permalink / raw)
  To: pgsql-committers

Fix another oversight in checking if a join with LATERAL refs is legal.

It was possible for the planner to decide to join a LATERAL subquery to
the outer side of an outer join before the outer join itself is completed.
Normally that's fine because of the associativity rules, but it doesn't
work if the subquery contains a lateral reference to the inner side of the
outer join.  In such a situation the outer join *must* be done first.
join_is_legal() missed this consideration and would allow the join to be
attempted, but the actual path-building code correctly decided that no
valid join path could be made, sometimes leading to planner errors such as
"failed to build any N-way joins".

Per report from Andreas Seltenreich.  Back-patch to 9.3 where LATERAL
support was added.

Branch
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/25517ee14c1a018876b64dce73e8f7fb7e937783

Modified Files
--------------
src/backend/optimizer/path/joinrels.c |   30 ++++++++++++++++++++++++
src/backend/optimizer/util/relnode.c  |   39 +++++++++++++++++++++++++++++++
src/include/optimizer/pathnode.h      |    1 +
src/test/regress/expected/join.out    |   41 +++++++++++++++++++++++++++++++++
src/test/regress/sql/join.sql         |   19 +++++++++++++++
5 files changed, 130 insertions(+)


-- 
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 another oversight in checking if a join with LATERAL refs is
@ 2015-12-07 22:42 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2015-12-07 22:42 UTC (permalink / raw)
  To: pgsql-committers

Fix another oversight in checking if a join with LATERAL refs is legal.

It was possible for the planner to decide to join a LATERAL subquery to
the outer side of an outer join before the outer join itself is completed.
Normally that's fine because of the associativity rules, but it doesn't
work if the subquery contains a lateral reference to the inner side of the
outer join.  In such a situation the outer join *must* be done first.
join_is_legal() missed this consideration and would allow the join to be
attempted, but the actual path-building code correctly decided that no
valid join path could be made, sometimes leading to planner errors such as
"failed to build any N-way joins".

Per report from Andreas Seltenreich.  Back-patch to 9.3 where LATERAL
support was added.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/0901d68babc324cc09077131fa966f15225e1fab

Modified Files
--------------
src/backend/optimizer/path/joinrels.c |   30 ++++++++++++++++++++++++
src/backend/optimizer/util/relnode.c  |   39 +++++++++++++++++++++++++++++++
src/include/optimizer/pathnode.h      |    1 +
src/test/regress/expected/join.out    |   41 +++++++++++++++++++++++++++++++++
src/test/regress/sql/join.sql         |   19 +++++++++++++++
5 files changed, 130 insertions(+)


-- 
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 another oversight in checking if a join with LATERAL refs is
@ 2015-12-07 22:42 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2015-12-07 22:42 UTC (permalink / raw)
  To: pgsql-committers

Fix another oversight in checking if a join with LATERAL refs is legal.

It was possible for the planner to decide to join a LATERAL subquery to
the outer side of an outer join before the outer join itself is completed.
Normally that's fine because of the associativity rules, but it doesn't
work if the subquery contains a lateral reference to the inner side of the
outer join.  In such a situation the outer join *must* be done first.
join_is_legal() missed this consideration and would allow the join to be
attempted, but the actual path-building code correctly decided that no
valid join path could be made, sometimes leading to planner errors such as
"failed to build any N-way joins".

Per report from Andreas Seltenreich.  Back-patch to 9.3 where LATERAL
support was added.

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/0a34ff7e9a3a232d675fe03dba00d010c689f33c

Modified Files
--------------
src/backend/optimizer/path/joinrels.c |   30 ++++++++++++++++++++++++
src/backend/optimizer/util/relnode.c  |   39 +++++++++++++++++++++++++++++++
src/include/optimizer/pathnode.h      |    1 +
src/test/regress/expected/join.out    |   41 +++++++++++++++++++++++++++++++++
src/test/regress/sql/join.sql         |   19 +++++++++++++++
5 files changed, 130 insertions(+)


-- 
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-12-07 22:42 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-12-07 22:42 pgsql: Fix another oversight in checking if a join with LATERAL refs is Tom Lane <tgl@sss.pgh.pa.us>
2015-12-07 22:42 pgsql: Fix another oversight in checking if a join with LATERAL refs is Tom Lane <tgl@sss.pgh.pa.us>
2015-12-07 22:42 pgsql: Fix another oversight in checking if a join with LATERAL refs is Tom Lane <tgl@sss.pgh.pa.us>
2015-12-07 22:42 pgsql: Fix another oversight in checking if 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