Re: jsonb_array_elements_recursive()

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
Cc: "PostgreSQL Hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: jsonb_array_elements_recursive()
Date: 2021-02-07 16:27:01
Message-ID: 0fca97b0-5c52-43d5-a6d5-bec35070036c@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)compiler(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-02-07 16:27:19 Re: jsonb_array_elements_recursive()
Previous Message Zhihong Yu 2021-02-07 16:16:44 Re: REINDEX backend filtering