pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Allow subquery pullup to wrap a PlaceHolderVar in another one.
6+ messages / 1 participants
[nested] [flat]

* pgsql: Allow subquery pullup to wrap a PlaceHolderVar in another one.
@ 2024-01-11 20:28  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2024-01-11 20:28 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Allow subquery pullup to wrap a PlaceHolderVar in another one.

The code for wrapping subquery output expressions in PlaceHolderVars
believed that if the expression already was a PlaceHolderVar, it was
never necessary to wrap that in another one.  That's wrong if the
expression is underneath an outer join and involves a lateral
reference to outside that scope: failing to add an additional PHV
risks evaluating the expression at the wrong place and hence not
forcing it to null when the outer join should do so.  This is an
oversight in commit 9e7e29c75, which added logic to forcibly wrap
lateral-reference Vars in PlaceHolderVars, but didn't see that the
adjacent case for PlaceHolderVars needed the same treatment.

The test case we have for this doesn't fail before 4be058fe9, but now
that I see the problem I wonder if it is possible to demonstrate
related errors before that.  That's moot though, since all such
branches are out of support.

Per bug #18284 from Holger Reise.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/18284-47505a20c23647f8@postgresql.org

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/69c12c41740913cc90e20886af4218db9b9b776c

Modified Files
--------------
src/backend/optimizer/prep/prepjointree.c |  9 +++++++--
src/test/regress/expected/join.out        | 26 ++++++++++++++++++++++++++
src/test/regress/sql/join.sql             | 12 ++++++++++++
3 files changed, 45 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Allow subquery pullup to wrap a PlaceHolderVar in another one.
@ 2024-01-11 20:28  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2024-01-11 20:28 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Allow subquery pullup to wrap a PlaceHolderVar in another one.

The code for wrapping subquery output expressions in PlaceHolderVars
believed that if the expression already was a PlaceHolderVar, it was
never necessary to wrap that in another one.  That's wrong if the
expression is underneath an outer join and involves a lateral
reference to outside that scope: failing to add an additional PHV
risks evaluating the expression at the wrong place and hence not
forcing it to null when the outer join should do so.  This is an
oversight in commit 9e7e29c75, which added logic to forcibly wrap
lateral-reference Vars in PlaceHolderVars, but didn't see that the
adjacent case for PlaceHolderVars needed the same treatment.

The test case we have for this doesn't fail before 4be058fe9, but now
that I see the problem I wonder if it is possible to demonstrate
related errors before that.  That's moot though, since all such
branches are out of support.

Per bug #18284 from Holger Reise.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/18284-47505a20c23647f8@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/29f114b6ff0c4ccad29b3a3707ab2c299647d450

Modified Files
--------------
src/backend/optimizer/prep/prepjointree.c |  9 +++++++--
src/test/regress/expected/join.out        | 27 +++++++++++++++++++++++++++
src/test/regress/sql/join.sql             | 12 ++++++++++++
3 files changed, 46 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Allow subquery pullup to wrap a PlaceHolderVar in another one.
@ 2024-01-11 20:28  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2024-01-11 20:28 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Allow subquery pullup to wrap a PlaceHolderVar in another one.

The code for wrapping subquery output expressions in PlaceHolderVars
believed that if the expression already was a PlaceHolderVar, it was
never necessary to wrap that in another one.  That's wrong if the
expression is underneath an outer join and involves a lateral
reference to outside that scope: failing to add an additional PHV
risks evaluating the expression at the wrong place and hence not
forcing it to null when the outer join should do so.  This is an
oversight in commit 9e7e29c75, which added logic to forcibly wrap
lateral-reference Vars in PlaceHolderVars, but didn't see that the
adjacent case for PlaceHolderVars needed the same treatment.

The test case we have for this doesn't fail before 4be058fe9, but now
that I see the problem I wonder if it is possible to demonstrate
related errors before that.  That's moot though, since all such
branches are out of support.

Per bug #18284 from Holger Reise.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/18284-47505a20c23647f8@postgresql.org

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ea1d54288ff03a0b043d218bb13322589e47abe2

Modified Files
--------------
src/backend/optimizer/prep/prepjointree.c |  9 +++++++--
src/test/regress/expected/join.out        | 26 ++++++++++++++++++++++++++
src/test/regress/sql/join.sql             | 12 ++++++++++++
3 files changed, 45 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Allow subquery pullup to wrap a PlaceHolderVar in another one.
@ 2024-01-11 20:28  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2024-01-11 20:28 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Allow subquery pullup to wrap a PlaceHolderVar in another one.

The code for wrapping subquery output expressions in PlaceHolderVars
believed that if the expression already was a PlaceHolderVar, it was
never necessary to wrap that in another one.  That's wrong if the
expression is underneath an outer join and involves a lateral
reference to outside that scope: failing to add an additional PHV
risks evaluating the expression at the wrong place and hence not
forcing it to null when the outer join should do so.  This is an
oversight in commit 9e7e29c75, which added logic to forcibly wrap
lateral-reference Vars in PlaceHolderVars, but didn't see that the
adjacent case for PlaceHolderVars needed the same treatment.

The test case we have for this doesn't fail before 4be058fe9, but now
that I see the problem I wonder if it is possible to demonstrate
related errors before that.  That's moot though, since all such
branches are out of support.

Per bug #18284 from Holger Reise.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/18284-47505a20c23647f8@postgresql.org

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/bfd28bb07a1fd83f42c6a37ccfc33b1e4959db52

Modified Files
--------------
src/backend/optimizer/prep/prepjointree.c |  9 +++++++--
src/test/regress/expected/join.out        | 26 ++++++++++++++++++++++++++
src/test/regress/sql/join.sql             | 12 ++++++++++++
3 files changed, 45 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Allow subquery pullup to wrap a PlaceHolderVar in another one.
@ 2024-01-11 20:28  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2024-01-11 20:28 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Allow subquery pullup to wrap a PlaceHolderVar in another one.

The code for wrapping subquery output expressions in PlaceHolderVars
believed that if the expression already was a PlaceHolderVar, it was
never necessary to wrap that in another one.  That's wrong if the
expression is underneath an outer join and involves a lateral
reference to outside that scope: failing to add an additional PHV
risks evaluating the expression at the wrong place and hence not
forcing it to null when the outer join should do so.  This is an
oversight in commit 9e7e29c75, which added logic to forcibly wrap
lateral-reference Vars in PlaceHolderVars, but didn't see that the
adjacent case for PlaceHolderVars needed the same treatment.

The test case we have for this doesn't fail before 4be058fe9, but now
that I see the problem I wonder if it is possible to demonstrate
related errors before that.  That's moot though, since all such
branches are out of support.

Per bug #18284 from Holger Reise.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/18284-47505a20c23647f8@postgresql.org

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a0b4fda442a7acf31d919f5a8988d230fa4db6cb

Modified Files
--------------
src/backend/optimizer/prep/prepjointree.c |  9 +++++++--
src/test/regress/expected/join.out        | 26 ++++++++++++++++++++++++++
src/test/regress/sql/join.sql             | 12 ++++++++++++
3 files changed, 45 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Allow subquery pullup to wrap a PlaceHolderVar in another one.
@ 2024-01-11 20:28  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2024-01-11 20:28 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Allow subquery pullup to wrap a PlaceHolderVar in another one.

The code for wrapping subquery output expressions in PlaceHolderVars
believed that if the expression already was a PlaceHolderVar, it was
never necessary to wrap that in another one.  That's wrong if the
expression is underneath an outer join and involves a lateral
reference to outside that scope: failing to add an additional PHV
risks evaluating the expression at the wrong place and hence not
forcing it to null when the outer join should do so.  This is an
oversight in commit 9e7e29c75, which added logic to forcibly wrap
lateral-reference Vars in PlaceHolderVars, but didn't see that the
adjacent case for PlaceHolderVars needed the same treatment.

The test case we have for this doesn't fail before 4be058fe9, but now
that I see the problem I wonder if it is possible to demonstrate
related errors before that.  That's moot though, since all such
branches are out of support.

Per bug #18284 from Holger Reise.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/18284-47505a20c23647f8@postgresql.org

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/80bece312c4b957ea5a93db84be1d1776f0e5e67

Modified Files
--------------
src/backend/optimizer/prep/prepjointree.c |  9 +++++++--
src/test/regress/expected/join.out        | 27 +++++++++++++++++++++++++++
src/test/regress/sql/join.sql             | 12 ++++++++++++
3 files changed, 46 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2024-01-11 20:28 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-01-11 20:28 pgsql: Allow subquery pullup to wrap a PlaceHolderVar in another one. Tom Lane <tgl@sss.pgh.pa.us>
2024-01-11 20:28 pgsql: Allow subquery pullup to wrap a PlaceHolderVar in another one. Tom Lane <tgl@sss.pgh.pa.us>
2024-01-11 20:28 pgsql: Allow subquery pullup to wrap a PlaceHolderVar in another one. Tom Lane <tgl@sss.pgh.pa.us>
2024-01-11 20:28 pgsql: Allow subquery pullup to wrap a PlaceHolderVar in another one. Tom Lane <tgl@sss.pgh.pa.us>
2024-01-11 20:28 pgsql: Allow subquery pullup to wrap a PlaceHolderVar in another one. Tom Lane <tgl@sss.pgh.pa.us>
2024-01-11 20:28 pgsql: Allow subquery pullup to wrap a PlaceHolderVar in another one. 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