agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Don't evaluate the FOR PORTION OF target under EXPLAIN
2+ messages / 1 participants
[nested] [flat]

* pgsql: Don't evaluate the FOR PORTION OF target under EXPLAIN
@ 2026-09-08 13:31 Peter Eisentraut <peter@eisentraut.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Eisentraut @ 2026-09-08 13:31 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't evaluate the FOR PORTION OF target under EXPLAIN

ExecInitModifyTable() evaluated ForPortionOfExpr.targetRange
unconditionally at executor start-up, with no EXEC_FLAG_EXPLAIN_ONLY
guard. This caused three problems:

- EXPLAIN (GENERIC_PLAN) failed with "no value found for parameter 1".

- Plain EXPLAIN with FOR PORTION OF (null) raised "FOR PORTION OF
  target must not be null".

- Plain EXPLAIN ran user functions appearing in the target a second
  time, beyond the one evaluation the planner already does for
  selectivity estimation.

Now we skip the evaluation and the accompanying null check in
explain-only mode.

Reported-by: Noah Misch <noah@leadboat.com>
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>
Discussion: https://www.postgresql.org/message-id/flat/CA%2BrenyXci9khYXJ8uSwzF30DVw%2Bzc4QwGb1RdsuOu_YtrFuy1g%4...

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/140fdfcdf12d524541ff26491b8e2076a690e434

Modified Files
--------------
src/backend/executor/nodeModifyTable.c       | 40 +++++++------
src/test/regress/expected/for_portion_of.out | 89 ++++++++++++++++++++++++++++
src/test/regress/sql/for_portion_of.sql      | 44 ++++++++++++++
3 files changed, 156 insertions(+), 17 deletions(-)



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

* pgsql: Don't evaluate the FOR PORTION OF target under EXPLAIN
@ 2026-09-08 13:31 Peter Eisentraut <peter@eisentraut.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Eisentraut @ 2026-09-08 13:31 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't evaluate the FOR PORTION OF target under EXPLAIN

ExecInitModifyTable() evaluated ForPortionOfExpr.targetRange
unconditionally at executor start-up, with no EXEC_FLAG_EXPLAIN_ONLY
guard. This caused three problems:

- EXPLAIN (GENERIC_PLAN) failed with "no value found for parameter 1".

- Plain EXPLAIN with FOR PORTION OF (null) raised "FOR PORTION OF
  target must not be null".

- Plain EXPLAIN ran user functions appearing in the target a second
  time, beyond the one evaluation the planner already does for
  selectivity estimation.

Now we skip the evaluation and the accompanying null check in
explain-only mode.

Reported-by: Noah Misch <noah@leadboat.com>
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>
Discussion: https://www.postgresql.org/message-id/flat/CA%2BrenyXci9khYXJ8uSwzF30DVw%2Bzc4QwGb1RdsuOu_YtrFuy1g%4...

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/98f6984e5c0d180264d1e972c36252c8b36206ef

Modified Files
--------------
src/backend/executor/nodeModifyTable.c       | 40 +++++++------
src/test/regress/expected/for_portion_of.out | 89 ++++++++++++++++++++++++++++
src/test/regress/sql/for_portion_of.sql      | 44 ++++++++++++++
3 files changed, 156 insertions(+), 17 deletions(-)



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


end of thread, other threads:[~2026-09-08 13:31 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-08 13:31 pgsql: Don't evaluate the FOR PORTION OF target under EXPLAIN Peter Eisentraut <peter@eisentraut.org>
2026-09-08 13:31 pgsql: Don't evaluate the FOR PORTION OF target under EXPLAIN Peter Eisentraut <peter@eisentraut.org>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox