agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Alexander Korotkov <akorotkov@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove unreachable error check in JSON_TABLE plan transform
Date: Tue, 14 Jul 2026 22:31:12 +0000
Message-ID: <E1wjlei-000Cef-0M@gemulon.postgresql.org> (raw)

Remove unreachable error check in JSON_TABLE plan transform

transformJsonTableNestedColumns() looked up the nested column named by a
JSON_TABLE PLAN node and raised "invalid JSON_TABLE plan clause / PATH
name was %s not found in nested columns list" if none was found.  That
lookup cannot fail: validateJsonTableChildPlan() runs first, at every
plan level, and already matches the plan's sibling path names one-to-one
against the nested columns (reporting any uncovered nested path or any
extra or duplicate sibling node).  The check has been unreachable since
the PLAN clause code was first written.

Replace it with an Assert documenting the invariant, which also removes
a user-facing message that could never be emitted.

Reported-by: Thom Brown <thom@linux.com>
Discussion: https://postgr.es/m/CAA-aLv5_9%3DzgA_Y7aoFp-%2BQSeh0kx4dfbAas9Wx%3DyrweQSqa6Q%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9ee5241d02442911ffec9a0ce35327a0fea4a5c1

Modified Files
--------------
src/backend/parser/parse_jsontable.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)



Message-ID: <E1wjlei-000Cef-0M@gemulon.postgresql.org>
Permalink:  ../E1wjlei-000Cef-0M@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wjlei-000Cef-0M@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: akorotkov@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Remove unreachable error check in JSON_TABLE plan transform
  In-Reply-To: <E1wjlei-000Cef-0M@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