Search Postgresql Archives

Re: json ->> operator precedence

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Wed, Aug 5, 2015 at 8:35 AM, John McKown <john.archie.mckown@xxxxxxxxx> 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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux