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