pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix planner error with pulling up subquery expressions into func
3+ messages / 1 participants
[nested] [flat]

* pgsql: Fix planner error with pulling up subquery expressions into func
@ 2021-10-14 16:44 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2021-10-14 16:44 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix planner error with pulling up subquery expressions into function RTEs.

If a function-in-FROM laterally references the output of some sub-SELECT
earlier in the FROM clause, and we are able to flatten that sub-SELECT
into the outer query, the expression(s) copied into the function RTE
missed being processed by eval_const_expressions.  This'd lead to trouble
and probable crashes at execution if such expressions contained
named-argument function call syntax or functions with defaulted arguments.
The bug is masked if the query contains any explicit JOIN syntax, which
may help explain why we'd not noticed.

Per bug #17227 from Bernd Dorn.  This is an oversight in commit 7266d0997,
so back-patch to v13 where that came in.

Discussion: https://postgr.es/m/17227-5a28ed1512189fa4@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4d5f651f1d651c6fa79f9188e7b9a04654c7125a

Modified Files
--------------
src/backend/optimizer/plan/planner.c     |  9 +++++----
src/test/regress/expected/rangefuncs.out | 29 +++++++++++++++++++++++++++++
src/test/regress/sql/rangefuncs.sql      | 15 +++++++++++++++
3 files changed, 49 insertions(+), 4 deletions(-)



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

* pgsql: Fix planner error with pulling up subquery expressions into func
@ 2021-10-14 16:44 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2021-10-14 16:44 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix planner error with pulling up subquery expressions into function RTEs.

If a function-in-FROM laterally references the output of some sub-SELECT
earlier in the FROM clause, and we are able to flatten that sub-SELECT
into the outer query, the expression(s) copied into the function RTE
missed being processed by eval_const_expressions.  This'd lead to trouble
and probable crashes at execution if such expressions contained
named-argument function call syntax or functions with defaulted arguments.
The bug is masked if the query contains any explicit JOIN syntax, which
may help explain why we'd not noticed.

Per bug #17227 from Bernd Dorn.  This is an oversight in commit 7266d0997,
so back-patch to v13 where that came in.

Discussion: https://postgr.es/m/17227-5a28ed1512189fa4@postgresql.org

Branch
------
REL_14_STABLE

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

Modified Files
--------------
src/backend/optimizer/plan/planner.c     |  9 +++++----
src/test/regress/expected/rangefuncs.out | 29 +++++++++++++++++++++++++++++
src/test/regress/sql/rangefuncs.sql      | 15 +++++++++++++++
3 files changed, 49 insertions(+), 4 deletions(-)



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

* pgsql: Fix planner error with pulling up subquery expressions into func
@ 2021-10-14 16:44 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2021-10-14 16:44 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix planner error with pulling up subquery expressions into function RTEs.

If a function-in-FROM laterally references the output of some sub-SELECT
earlier in the FROM clause, and we are able to flatten that sub-SELECT
into the outer query, the expression(s) copied into the function RTE
missed being processed by eval_const_expressions.  This'd lead to trouble
and probable crashes at execution if such expressions contained
named-argument function call syntax or functions with defaulted arguments.
The bug is masked if the query contains any explicit JOIN syntax, which
may help explain why we'd not noticed.

Per bug #17227 from Bernd Dorn.  This is an oversight in commit 7266d0997,
so back-patch to v13 where that came in.

Discussion: https://postgr.es/m/17227-5a28ed1512189fa4@postgresql.org

Branch
------
REL_13_STABLE

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

Modified Files
--------------
src/backend/optimizer/plan/planner.c     |  9 +++++----
src/test/regress/expected/rangefuncs.out | 29 +++++++++++++++++++++++++++++
src/test/regress/sql/rangefuncs.sql      | 15 +++++++++++++++
3 files changed, 49 insertions(+), 4 deletions(-)



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


end of thread, other threads:[~2021-10-14 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-10-14 16:44 pgsql: Fix planner error with pulling up subquery expressions into func Tom Lane <tgl@sss.pgh.pa.us>
2021-10-14 16:44 pgsql: Fix planner error with pulling up subquery expressions into func Tom Lane <tgl@sss.pgh.pa.us>
2021-10-14 16:44 pgsql: Fix planner error with pulling up subquery expressions into func 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