Re: jsonb_array_elements_recursive()

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Zhihong Yu <zyu(at)yugabyte(dot)com>, Joel Jacobson <joel(at)compiler(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: jsonb_array_elements_recursive()
Date: 2021-02-07 19:09:42
Message-ID: CAKFQuwY4-kzcUOmTHFVA_oi_vDH7Q_QXvuzmDhB8SVsHjoc1SA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Feb 7, 2021 at 11:39 AM Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
wrote:

>
>
> ne 7. 2. 2021 v 19:18 odesílatel Zhihong Yu <zyu(at)yugabyte(dot)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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2021-02-07 20:24:16 Re: [POC] verifying UTF-8 using SIMD instructions
Previous Message Tom Lane 2021-02-07 19:05:27 Re: Bug in query rewriter - hasModifyingCTE not getting set