Re: json ->> operator precedence

From: John McKown <john(dot)archie(dot)mckown(at)gmail(dot)com>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: json ->> operator precedence
Date: 2015-08-05 13:45:09
Message-ID: CAAJSdjj=G8qCDuotojGbfBDjfjSEBZrBsp5n-ND-hEm9TBNdJQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Aug 5, 2015 at 8:35 AM, John McKown <john(dot)archie(dot)mckown(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2015-08-05 13:46:54 Re: idle processes
Previous Message Geoff Winkless 2015-08-05 13:42:57 Re: json ->> operator precedence