Re: jsonb and nested hstore

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Greg Stark <stark(at)mit(dot)edu>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Peter Geoghegan <pg(at)heroku(dot)com>, Oleg Bartunov <obartunov(at)gmail(dot)com>, Tomas Vondra <tv(at)fuzzy(dot)cz>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: jsonb and nested hstore
Date: 2014-03-13 13:08:43
Message-ID: 5321ADDB.5030804@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 03/13/2014 06:53 AM, Greg Stark wrote:
>
> I also find it awkward that col->>'prop' returns the json
> representation of the property. If it's text that means it's
> double-quoted. I would think that a user storing text in a json
> property would want a way to pull out the text that json property
> represents so he doesn't have to write col->>'prop' = '"foo"' and
> doesn't need to strip the quotes (and de-escape the string?) before
> displaying the value or passing it through other apis.
>

->> returns dequoted text if the value it points to is a plain string.
If it's not doing that then that's a bug.

andrew=# select jsonb '{"a":"the string"}' -> 'a';
?column?
--------------
"the string"
(1 row)

andrew=# select jsonb '{"a":"the string"}' ->> 'a'
;
?column?
------------
the string
(1 row)

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2014-03-13 13:17:23 Re: gaussian distribution pgbench
Previous Message Etsuro Fujita 2014-03-13 13:00:02 Re: inherit support for foreign tables