Re: More jsonpath methods: translate, split, join

From: Florents Tselai <florents(dot)tselai(at)gmail(dot)com>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Subject: Re: More jsonpath methods: translate, split, join
Date: 2026-06-20 08:34:57
Message-ID: CA+v5N40u7kAttYWPK-NTbusUkgZfZkTbnvA7rF63dX+y0hQm2Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 19, 2026 at 11:43 PM Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)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>

Attachment Content-Type Size
v3-0001-Add-more-jsonpath-string-methods-.translate-.spli.patch application/x-patch 39.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuya Kawata 2026-06-20 09:14:59 Re: [PATCH] doc: clarify pg_stat_lock.fastpath_exceeded scope
Previous Message Alexander Lakhin 2026-06-20 08:00:01 Re: Unexpected behavior after OOM errors