Re: jsonb_array_elements_recursive()

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Joel Jacobson <joel(at)compiler(dot)org>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: jsonb_array_elements_recursive()
Date: 2021-02-07 16:08:46
Message-ID: CAFj8pRAvEAD41G_M_a5mZRBNhFXAgNZ6XgnHPMLoHr=JhfCLwQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

ne 7. 2. 2021 v 16:59 odesílatel Joel Jacobson <joel(at)compiler(dot)org> napsal:

> Having thought about this some more,
> the function name should of course be jsonb_unnest(),
> similar to how unnest() works for normal arrays:
>
> SELECT unnest(array[[3,2],[1,4]]);
> unnest
> --------
> 3
> 2
> 1
> 4
> (4 rows)
>
> SELECT jsonb_unnest('[[3,2],[1,4]]'::jsonb);
> jsonb_unnest
> --------------------
> 3
> 2
> 1
> 4
> (4 rows)
>
> Thoughts?
>

It has sense. Maybe it should return two columns - first path to value,
and second with value. It can be used like some "reader"

Regards

Pavel

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-02-07 16:09:49 Re: Prevent printing "next step instructions" in initdb and pg_upgrade
Previous Message Joel Jacobson 2021-02-07 15:59:04 Re: jsonb_array_elements_recursive()