Re: json ->> operator precedence

Поиск
Список
Период
Сортировка
От John McKown
Тема Re: json ->> operator precedence
Дата
Msg-id CAAJSdjj=G8qCDuotojGbfBDjfjSEBZrBsp5n-ND-hEm9TBNdJQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: json ->> operator precedence  (John McKown <john.archie.mckown@gmail.com>)
Список pgsql-general


On Wed, Aug 5, 2015 at 8:35 AM, John McKown <john.archie.mckown@gmail.com> wrote:
​​

​Looks correct to me. As I understand it the ::jsonb is NOT an operator! It is a syntactic construct for a CAST(). An equivalent which might make more sense is:

select CASE WHEN CAST('{"a":null}' AS JSONB)->>'a' IS NULL THEN 'yes' ELSE 'no' END;​​

Oh, an CAST() may look like a function call, but it is also a syntactic element. I.e. there is not a function called "CAST". 


​Well, I messed that up a bit. CAST is not a "syntactic element" as I was thinking. But it's not really a function call either but is closer to a function call than an operator in nature (I my ignorant opinion) . I was thinking it was a "compile time" operation, but it, like a function call, is a run-time operation. I think that using the CASE() makes it plainer that it is _not_ an operation like ->> or - and makes the precedence issue plainer.

 
--

Schrodinger's backup: The condition of any backup is unknown until a restore is attempted.

Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be.

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown

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

Предыдущее
От: Geoff Winkless
Дата:
Сообщение: Re: json ->> operator precedence
Следующее
От: Tom Lane
Дата:
Сообщение: Re: idle processes