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-06-03T19:02:07Z
Lists: pgsql-hackers
Attachments
- v6-0001-Rename-jsonpath-method-arg-tokens.patch (application/octet-stream) patch v6-0001
- v6-0002-Add-additional-jsonpath-string-methods.patch (application/octet-stream) patch v6-0002
- (unnamed) (text/plain)
Hackers, On May 26, 2025, at 18:00, David E. Wheeler <david@justatheory.com> wrote: > Yes, I think it would be best if the grammar was a bit stricter --- and therefore more self-explanatory --- by making the args closer to what the functions actually expect. I chatted with Florents and went ahead and simplified the grammar and fixed the other issues I identified in my original review. Note that there are two commits, now: `v6-0001-Rename-jsonpath-method-arg-tokens.patch` Renames some of the symbols in the jsonpath grammar so that they’re less generic (`csv*`) and more specific to their contents. This is with the expectation that they will be used by other methods in the next patch and in the future. I thought it best to separate this refactoring from the feature patch. `v6-0002-Add-additional-jsonpath-string-methods.patch` is that feature patch. The grammar now parses the exact number and types of each method argument, eliminating the need for explicit error checking. It also uses the existing patterns for handling methods with two parameters, removing a bunch of duplicate code. Overall I think this is ready for committer review, although now that I’m not just reviewing but hacking on this thing, maybe someone else should review it first. Patches attached, GitHub PR here: https://github.com/theory/postgres/pull/12 Best, David
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add additional jsonpath string methods
- bd4f879a9cdd 19 (unreleased) landed
-
Rename jsonpath method arg tokens
- a35c9d524ed0 19 (unreleased) landed
-
Fix transient memory leakage in jsonpath evaluation.
- 5a2043bf7131 19 (unreleased) cited
-
Make jsonpath .string() be immutable for datetimes.
- cb599b9ddfcc 18.0 cited