Re: PATCH: jsonpath string methods: lower, upper, initcap, l/r/btrim, replace, split_part

David E. Wheeler <david@justatheory.com>

From: "David E. Wheeler" <david@justatheory.com>
To: Florents Tselai <florents.tselai@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter@eisentraut.org>, Robert Haas <robertmhaas@gmail.com>, Alexander Korotkov <aekorotkov@gmail.com>, pgsql-hackers <pgsql-hackers@lists.postgresql.org>, Andrew Dunstan <andrew@dunslane.net>
Date: 2025-07-11T18:48:46Z
Lists: pgsql-hackers

Attachments

On Jul 10, 2025, at 19:23, David E. Wheeler <david@justatheory.com> wrote:

> Now with the `ISO C90 forbids mixed declarations and code` warning cleared up.
> 
> Weird that there’s a failure on Bookworm with Meson [1] (pg_regress diffs [2]) but not Bookworm with Configure [3]. Collation issue, perhaps?

David Johnson noticed that this build is 32-bit. I looked at the split_path function and after trying a couple of things, realized that it was passing an int8 when the SQL function in Marlena.c passes an int4. This change got the test passing in my clone (indentation reduced):


```patch
--- a/src/backend/utils/adt/jsonpath_exec.c
+++ b/src/backend/utils/adt/jsonpath_exec.c
@@ -2959,7 +2959,7 @@ executeStringInternalMethod(JsonPathExecContext *cxt, JsonPathItem *jsp,
 	C_COLLATION_OID,
 	CStringGetTextDatum(tmp),
 	CStringGetTextDatum(from_str),
-	DirectFunctionCall1(numeric_int8, NumericGetDatum(n))));
+	DirectFunctionCall1(numeric_int4, NumericGetDatum(n))));
 				break;
 			}
 		default:
```

v12 attached.


Best,

David