]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix jsonpath .split_part() to honor silent mode
authorMichael Paquier <michael@paquier.xyz>
Thu, 14 May 2026 07:02:07 +0000 (16:02 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 14 May 2026 07:02:07 +0000 (16:02 +0900)
commit954e57708ea6996e8948ccb820ed03d0262fc2d2
treece9c645ad8b022a5ee4817439bd180eacf0ef01d
parent61f8a85a577fd0ea0bf924a88064187bed31eb48
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.evan.chao@gmail.com>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/FCF996D0-580B-431C-8DE1-A540C58E444C@gmail.com
src/backend/utils/adt/jsonpath_exec.c
src/test/regress/expected/jsonb_jsonpath.out
src/test/regress/sql/jsonb_jsonpath.sql