public inbox for [email protected]  
help / color / mirror / Atom feed
From: Michael Paquier <[email protected]>
To: [email protected]
Subject: pgsql: Fix jsonpath .split_part() to honor silent mode
Date: Thu, 14 May 2026 07:03:24 +0000
Message-ID: <[email protected]> (raw)

Fix jsonpath .split_part() to honor silent mode

The jsonpath .split_part() method passed its field-position argument
through numeric_int4(), that can fail hard if called directly.

This commit switches the code to use numeric_int4_safe() with an error
context for soft reporting, so as the overflow and zero field-position
cases can be handled in silent mode.

Oversight in bd4f879a9cdd.

Author:  Chao Li <[email protected]>
Reviewed-by: Nazir Bilal Yavuz <[email protected]>
Discussion: https://postgr.es/m/[email protected]

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/954e57708ea6996e8948ccb820ed03d0262fc2d2

Modified Files
--------------
src/backend/utils/adt/jsonpath_exec.c        | 19 ++++++++++++++++---
src/test/regress/expected/jsonb_jsonpath.out | 14 ++++++++++++++
src/test/regress/sql/jsonb_jsonpath.sql      |  4 ++++
3 files changed, 34 insertions(+), 3 deletions(-)



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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: pgsql: Fix jsonpath .split_part() to honor silent mode
  In-Reply-To: <[email protected]>

* 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