Re: jsonb_array_elements_recursive()

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: jsonb_array_elements_recursive()
Дата
Msg-id CAKFQuwY4-kzcUOmTHFVA_oi_vDH7Q_QXvuzmDhB8SVsHjoc1SA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: jsonb_array_elements_recursive()  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
On Sun, Feb 7, 2021 at 11:39 AM Pavel Stehule <pavel.stehule@gmail.com> wrote:


ne 7. 2. 2021 v 19:18 odesílatel Zhihong Yu <zyu@yugabyte.com> napsal:
Hi,

bq. SELECT unnest('[[5,2],"a",[8,[3,2],6]]'::jsonb);

Since the array without cast is not normal array (and would be rejected), I wonder if the cast is needed.
Because casting to jsonb is the only legitimate interpretation here.

only until somebody does support for hstore, xml, ... some future data type

Minimally now, we have json, jsonb types.


More generally, a sequence of characters has no meaning to the system unless and until an externally supplied type is given to it allowing it to interpret the sequence of characters in some concrete way.  The system will never assign a concrete type to some random sequence of characters based upon what those characters are.  Forgive the idiom, but to do otherwise would be putting the cart before the horse.  It would also be quite expensive and prone to, as above, different types deciding on the same textual representation being valid input to each.

David J.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Bug in query rewriter - hasModifyingCTE not getting set
Следующее
От: John Naylor
Дата:
Сообщение: Re: [POC] verifying UTF-8 using SIMD instructions