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

From: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Florents Tselai <florents(dot)tselai(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: Fix jsonpath .split_part() to honor silent mode
Date: 2026-05-13 09:57:50
Message-ID: CAN55FZ05TxsGxJXJ4u-BJW=dc=ycGw96fNYzOMMuEFAa-MUynA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Thank you for working on this!

On Tue, 12 May 2026 at 05:11, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message shveta malik 2026-05-13 09:32:11 Re: Parallel Apply