Re: jsonb_array_elements_recursive() - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: jsonb_array_elements_recursive()
Date
Msg-id CAFj8pRAvEAD41G_M_a5mZRBNhFXAgNZ6XgnHPMLoHr=JhfCLwQ@mail.gmail.com
Whole thread Raw
In response to Re: jsonb_array_elements_recursive()  ("Joel Jacobson" <joel@compiler.org>)
Responses Re: jsonb_array_elements_recursive()
List pgsql-hackers
Hi

ne 7. 2. 2021 v 16:59 odesílatel Joel Jacobson <joel@compiler.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


pgsql-hackers by date:

Previous
From: "Joel Jacobson"
Date:
Subject: Re: jsonb_array_elements_recursive()
Next
From: Tom Lane
Date:
Subject: Re: Prevent printing "next step instructions" in initdb and pg_upgrade