pgsql: Fix jsonpath .split_part() to honor silent mode

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix jsonpath .split_part() to honor silent mode
Date: 2026-05-14 07:03:24
Message-ID: E1wNQ6O-000SZi-1e@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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 <li(dot)evan(dot)chao(at)gmail(dot)com>
Reviewed-by: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
Discussion: https://postgr.es/m/FCF996D0-580B-431C-8DE1-A540C58E444C@gmail.com

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Etsuro Fujita 2026-05-14 08:07:19 pgsql: postgres_fdw: Fix deparsing of remote column names in stats impo
Previous Message Fujii Masao 2026-05-14 03:33:31 pgsql: pgbench: fix verbose error message corruption with multiple thre