Thread
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix jsonpath .split_part() to honor silent mode
- 954e57708ea6 19 (unreleased) landed
-
Fix jsonpath .split_part() to honor silent mode
Chao Li <li.evan.chao@gmail.com> — 2026-05-12T02:10:53Z
Hi, 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. This is a simple repro: ``` evantest=# select jsonb_path_query('"a,b"', '$.split_part(",", 0)'); ERROR: field position must not be zero evantest=# select jsonb_path_query('"a,b"', '$.split_part(",", 0)', silent => true); ERROR: field position must not be zero evantest=# select jsonb_path_query('"a,b"', '$.split_part(",", 2147483648)'); ERROR: integer out of range evantest=# select jsonb_path_query('"a,b"', '$.split_part(",", 2147483648)', silent => true); ERROR: integer out of range ``` As a comparison, an existing method such as .decimal() suppresses similar argument errors in silent mode: ``` evantest=# select jsonb_path_query('12.3', '$.decimal(12345678901,1)'); ERROR: precision of jsonpath item method .decimal() is out of range for type integer evantest=# select jsonb_path_query('12.3', '$.decimal(12345678901,1)', silent => true); jsonb_path_query ------------------ (0 rows) ``` 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. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/ -
Re: Fix jsonpath .split_part() to honor silent mode
Nazir Bilal Yavuz <byavuz81@gmail.com> — 2026-05-13T09:57:50Z
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
-
Re: Fix jsonpath .split_part() to honor silent mode
Michael Paquier <michael@paquier.xyz> — 2026-05-14T06:02:18Z
On Wed, May 13, 2026 at 12:57:50PM +0300, Nazir Bilal Yavuz wrote: > I think you are right and I confirm that your patch fixes the problem. Indeed, good catch! I'll go double-check the area before doing something. Thanks for the report! -- Michael
-
Re: Fix jsonpath .split_part() to honor silent mode
Andrew Dunstan <andrew@dunslane.net> — 2026-05-14T12:29:16Z
On 2026-05-14 Th 2:02 AM, Michael Paquier wrote: > On Wed, May 13, 2026 at 12:57:50PM +0300, Nazir Bilal Yavuz wrote: >> I think you are right and I confirm that your patch fixes the problem. > Indeed, good catch! I'll go double-check the area before doing > something. Thanks for the report! Thanks for jumping on this, you beat me to it. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com
-
Re: Fix jsonpath .split_part() to honor silent mode
Michael Paquier <michael@paquier.xyz> — 2026-05-14T23:40:26Z
On Thu, May 14, 2026 at 08:29:16AM -0400, Andrew Dunstan wrote: > Thanks for jumping on this, you beat me to it. No problem! I was looking for a different problem to put my mind on, and was passing by. I have also checked this whole area of the code for similar trouble, without finding anything. Nice work overall, from what I've seen. -- Michael