Re: jsonb_array_elements_recursive() - Mailing list pgsql-hackers

From Joel Jacobson
Subject Re: jsonb_array_elements_recursive()
Date
Msg-id 0fca97b0-5c52-43d5-a6d5-bec35070036c@www.fastmail.com
Whole thread Raw
In response to Re: jsonb_array_elements_recursive()  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
On Sun, Feb 7, 2021, at 17:08, Pavel Stehule wrote:
>>ne 7. 2. 2021 v 16:59 odesílatel Joel Jacobson <joel@compiler.org> napsal:
>>
>>SELECT jsonb_unnest('[[3,2],[1,4]]'::jsonb);
>>jsonb_unnest
>>--------------------
>>3
>>2
>>1
>>4
>>(4 rows)
>
>It  has  sense. Maybe it should return two columns - first path to value, and second with value. It can be used like some >"reader"

Thanks for thinking about this.

I would expect jsonb_unnest() to have the same semantics as unnest(), but returning SETOF jsonb.

jsonb_unnest() implemented in C would of course be much more performant than the PL/pgSQL PoC.
And I think performance could be important for such a function,
so I think we should be careful adding extra complexity to such a function,
unless it can be demonstrated it is needed for a majority of cases.

/Joel

pgsql-hackers by date:

Previous
From: Zhihong Yu
Date:
Subject: Re: REINDEX backend filtering
Next
From: Tom Lane
Date:
Subject: Re: jsonb_array_elements_recursive()