Re: jsonb_array_elements_recursive()

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: jsonb_array_elements_recursive()
Дата
Msg-id CAFj8pRBzhudFrUDAsZAVY1zzdxnuPZmRj_cnR9nm+5AMB0QN-w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: jsonb_array_elements_recursive()  (Zhihong Yu <zyu@yugabyte.com>)
Список pgsql-hackers
Hi

ne 7. 2. 2021 v 18:31 odesílatel Zhihong Yu <zyu@yugabyte.com> napsal:
Hi,
# SELECT '[[5,2],"a",[8,[3,2],6]]'::jsonb;
             jsonb
-------------------------------
 [[5, 2], "a", [8, [3, 2], 6]]
(1 row)

unnest(array[[3,2],"a",[1,4]]) is not accepted currently.

Would the enhanced unnest accept the above array ?

There should be a special overwrite for json type. Json can hold an array, but from Postgres perspective, it is not an array.

But there is really one specific case. We can have an array of json(b), and inside there should be other arrays. So nesting can be across values.

Regards

Pavel

 

Cheers

On Sun, Feb 7, 2021 at 8:31 AM Joel Jacobson <joel@compiler.org> wrote:
On Sun, Feb 7, 2021, at 17:27, Tom Lane wrote:
>"Joel Jacobson" <joel@compiler.org> writes:
>> Having thought about this some more,
>> the function name should of course be jsonb_unnest(),
>> similar to how unnest() works for normal arrays:
>
>Why not just unnest(), then?
>
>regards, tom lane

Ahh, of course! I totally forgot about function overloading when thinking about this.

+1

/Joel

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Zhihong Yu
Дата:
Сообщение: Re: jsonb_array_elements_recursive()
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: jsonb_array_elements_recursive()