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

From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Florents Tselai <florents(dot)tselai(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: PATCH: jsonpath string methods: lower, upper, initcap, l/r/btrim, replace, split_part
Date: 2025-07-11 18:48:46
Message-ID: 7D19A273-1306-4F4C-9DFD-CE16F44790CB@justatheory.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Jul 10, 2025, at 19:23, David E. Wheeler <david(at)justatheory(dot)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

Attachment Content-Type Size
v12-0001-Rename-jsonpath-method-arg-tokens.patch application/octet-stream 3.9 KB
v12-0002-Add-additional-jsonpath-string-methods.patch application/octet-stream 48.5 KB
unknown_filename text/plain 2 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2025-07-11 18:50:01 Re: [PATCH] Let's get rid of the freelist and the buffer_strategy_lock
Previous Message DINESH NAIR 2025-07-11 18:45:06 Re: [Question] Window Function Results without ORDER BY Clause