agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Don't evaluate the FOR PORTION OF target under EXPLAIN
Date: Tue, 08 Sep 2026 13:31:26 +0000
Message-ID: <E1x3vv2-00000003zyU-4ALA@gemulon.postgresql.org> (raw)
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(-)
view thread (2+ messages) latest in thread
Message-ID: <E1x3vv2-00000003zyU-4ALA@gemulon.postgresql.org>
Permalink: ../E1x3vv2-00000003zyU-4ALA@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1x3vv2-00000003zyU-4ALA@gemulon.postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Don't evaluate the FOR PORTION OF target under EXPLAIN
In-Reply-To: <E1x3vv2-00000003zyU-4ALA@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox