pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix error code for null FOR PORTION OF target
Date: Fri, 21 Aug 2026 12:15:47 +0000
Message-ID: <E1wxO9y-00000001VtL-1IOF@gemulon.postgresql.org> (raw)

Fix error code for null FOR PORTION OF target

When the target expression of FOR PORTION OF (...) evaluated to NULL,
ExecInitModifyTable raised an error without an errcode, so clients got
the internal error code XX000 for a user-reachable condition.
Oversight in commit 8e72d914c52.

To fix, report ERRCODE_NULL_VALUE_NOT_ALLOWED, and reword the message
to "FOR PORTION OF target must not be null", matching similar executor
messages such as "frame starting offset must not be null".

Bug: #19630
Reported-by: Zheng Wang <hackerzheng666@gmail.com>
Reported-by: Yanjie Zhao
Reported-by: Yiyang Liu
Author: Zsolt Parragi <zsolt.parragi@percona.com>
Discussion: https://www.postgresql.org/message-id/flat/19630-9f10ca28426295fa%40postgresql.org

Branch
------
master

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

Modified Files
--------------
src/backend/executor/nodeModifyTable.c       | 5 +++--
src/test/regress/expected/for_portion_of.out | 8 ++++----
2 files changed, 7 insertions(+), 6 deletions(-)



view thread (2+ messages)

Message-ID: <E1wxO9y-00000001VtL-1IOF@gemulon.postgresql.org>
Permalink:  ../E1wxO9y-00000001VtL-1IOF@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wxO9y-00000001VtL-1IOF@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: Fix error code for null FOR PORTION OF target
  In-Reply-To: <E1wxO9y-00000001VtL-1IOF@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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox