Add additional jsonpath string methods
Andrew Dunstan <andrew@dunslane.net>
Add additional jsonpath string methods Add the following jsonpath methods: * l/r/btrim() * lower(), upper() * initcap() * replace() * split_part() Each simply dispatches to the standard string processing functions. These depend on the locale, but since it's set at `initdb`, they can be considered immutable and therefore allowed in any jsonpath expression. Author: Florents Tselai <florents.tselai@gmail.com> Co-authored-by: David E. Wheeler <david@justatheory.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Reviewed-by: Andrew Dunstan <andrew@dunslane.net> Discussion: https://postgr.es/m/CA+v5N40sJF39m0v7h=QN86zGp0CUf9F1WKasnZy9nNVj_VhCZQ@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/func/func-json.sgml | modified | +140 −0 |
| src/backend/utils/adt/jsonpath.c | modified | +113 −4 |
| src/backend/utils/adt/jsonpath_exec.c | modified | +178 −0 |
| src/backend/utils/adt/jsonpath_gram.y | modified | +32 −1 |
| src/backend/utils/adt/jsonpath_scan.l | modified | +8 −0 |
| src/include/utils/jsonpath.h | modified | +8 −0 |
| src/test/regress/expected/jsonb_jsonpath.out | modified | +381 −0 |
| src/test/regress/expected/jsonpath.out | modified | +186 −0 |
| src/test/regress/expected/sqljson_queryfuncs.out | modified | +9 −1 |
| src/test/regress/sql/jsonb_jsonpath.sql | modified | +106 −0 |
| src/test/regress/sql/jsonpath.sql | modified | +41 −0 |
| src/test/regress/sql/sqljson_queryfuncs.sql | modified | +10 −1 |
Discussion
- PATCH: jsonpath string methods: lower, upper, initcap, l/r/btrim, replace, split_part 67 messages · 2024-09-25 → 2026-04-03