Re: Fix jsonpath .split_part() to honor silent mode
Nazir Bilal Yavuz <byavuz81@gmail.com>
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
To: Chao Li <li.evan.chao@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Florents Tselai <florents.tselai@gmail.com>,
Andrew Dunstan <andrew@dunslane.net>
Date: 2026-05-13T09:57:50Z
Lists: pgsql-hackers
Hi, Thank you for working on this! On Tue, 12 May 2026 at 05:11, Chao Li <li.evan.chao@gmail.com> wrote: > > While testing the new json_path method split_part(), I noticed that it doesn’t honor silent mode. I think this is a v19-new bug. > > After looking into the code, I think the root cause is that .decimal() uses numeric_int4_safe() to parse integer arguments, while the .split_part() path in executeStringInternalMethod() uses numeric_int4() directly, which raises an error immediately for invalid values. > > The attached patch fixes this by switching the .split_part() path to use numeric_int4_safe() and report the argument errors through the jsonpath error handling mechanism. > > Please see the attached patch for details. I think you are right and I confirm that your patch fixes the problem. -- Regards, Nazir Bilal Yavuz Microsoft