Re: PATCH: jsonpath string methods: lower, upper, initcap, l/r/btrim, replace, split_part - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: PATCH: jsonpath string methods: lower, upper, initcap, l/r/btrim, replace, split_part
Date
Msg-id 176C517D-2DEB-4CAB-9AE4-261079D313B9@justatheory.com
Whole thread Raw
In response to Re: PATCH: jsonpath string methods: lower, upper, initcap, l/r/btrim, replace, split_part  ("David E. Wheeler" <david@justatheory.com>)
Responses Re: PATCH: jsonpath string methods: lower, upper, initcap, l/r/btrim, replace, split_part
List pgsql-hackers
On May 24, 2025, at 17:39, David E. Wheeler <david@justatheory.com> wrote:

> I’ve attached a new patch with docs.

Oh, and I forgot to mention, src/backend/utils/adt/jsonpath_scan.l looks like it has a ton of duplication in it.
Shouldn’tit just add the new keywords, something like: 

```
@@ -415,6 +415,11 @@ static const JsonPathKeyword keywords[] = {
    {4, false, WITH_P, "with"},
    {5, true, FALSE_P, "false"},
    {5, false, FLOOR_P, "floor"},
+   {5, false, STR_BTRIM_P, "btrim"},
+   {5, false, STR_LOWER_P, "lower"},
+   {5, false, STR_LTRIM_P, "ltrim"},
+   {5, false, STR_RTRIM_P, "rtrim"},
+   {5, false, STR_UPPER_P, "upper"},
    {6, false, BIGINT_P, "bigint"},
    {6, false, DOUBLE_P, "double"},
    {6, false, EXISTS_P, "exists"},
@@ -428,10 +433,13 @@ static const JsonPathKeyword keywords[] = {
    {7, false, INTEGER_P, "integer"},
    {7, false, TIME_TZ_P, "time_tz"},
    {7, false, UNKNOWN_P, "unknown"},
+   {7, false, STR_INITCAP_P, "initcap"},
+   {7, false, STR_REPLACEFUNC_P, "replace"},
    {8, false, DATETIME_P, "datetime"},
    {8, false, KEYVALUE_P, "keyvalue"},
    {9, false, TIMESTAMP_P, "timestamp"},
    {10, false, LIKE_REGEX_P, "like_regex"},
+   {10, false, STR_SPLIT_PART_P, "split_part"},
    {12, false, TIMESTAMP_TZ_P, "timestamp_tz"},
```

Best,

David


Attachment

pgsql-hackers by date:

Previous
From: "David E. Wheeler"
Date:
Subject: Re: PATCH: jsonpath string methods: lower, upper, initcap, l/r/btrim, replace, split_part
Next
From: "David E. Wheeler"
Date:
Subject: Re: PATCH: jsonpath string methods: lower, upper, initcap, l/r/btrim, replace, split_part