Re: potential bug in JSON

From: Szymon Guz <mabewlun(at)gmail(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: potential bug in JSON
Date: 2013-05-28 16:20:32
Message-ID: CAFjNrYt25WG2jgTBrVYGkLP4r+sEQA+PZ7xqG8cKPpoOb2OMtA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 28 May 2013 17:53, Josh Berkus <josh(at)agliodbs(dot)com> wrote:

> On 05/28/2013 08:38 AM, Szymon Guz wrote:
> > I've found a potential bug. Why the "->" operator returns JSON instead of
> > TEXT? It doesn't make sens for me, and the documentation doesn't inform
> > about that.
>
> Yes, it most certainly does:
> http://www.postgresql.org/docs/9.3/static/functions-json.html
>
> If you want to get text, use the ->> operator.
>
>
>
Yea, I noticed that. It was a little bit misleading for me that "->" is for
getting field and "->>" is for getting field as text. Especially when
"->"::TEXT doesn't return the same value as "->>".
Maybe there should be added "as JSON" to those operators which don't return
text?

Szymon

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2013-05-28 16:29:26 Re: getting rid of freezing
Previous Message Robert Haas 2013-05-28 16:11:45 Re: Planning incompatibilities for Postgres 10.0