Re: More jsonpath methods: translate, split, join
Florents Tselai <florents.tselai@gmail.com>
From: Florents Tselai <florents.tselai@gmail.com>
To: Zsolt Parragi <zsolt.parragi@percona.com>
Cc: pgsql-hackers <pgsql-hackers@lists.postgresql.org>, Corey Huinker <corey.huinker@gmail.com>
Date: 2026-06-20T08:34:57Z
Lists: pgsql-hackers
Attachments
- v3-0001-Add-more-jsonpath-string-methods-.translate-.spli.patch (application/x-patch) patch v3-0001
On Fri, Jun 19, 2026 at 11:43 PM Zsolt Parragi <zsolt.parragi@percona.com>
wrote:
> Hello
>
> + /* Validate target is an array */
> + if (JsonbType(jb) != jbvArray)
> + {
> + RETURN_ERROR(ereport(ERROR,
> +
> (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
> +
> errmsg("jsonpath item method .join() can only be applied
> to an array"))));
>
> Other methods seem to use ERRCODE_SQL_JSON_ARRAY_NOT_FOUND
>
> + else
> + {
> + /* Recursive Tree (jbvArray) */
> + for (int i = 0; i <
> jb->val.array.nElems; i++)
>
> Isn't this branch unreachable?
both of your points are correct.
Here's a v3 that address them .
While at it, I've added some additional edge cases about these 3 methods.
The semantics look good to me, and they pass without additional change in
the underlying src code in jsonpath_exec.c
https://commitfest.postgresql.org/patch/6673/
-
Cheers,
Flo
tselai.com
<http://tselai.com/?utm_source=email_signature&utm_medium=email&utm_campaign=Email_Signature>
Schedule a chat ☕ <https://calendly.com/florents-tselai/30min>