Re: jsonb and nested hstore - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: jsonb and nested hstore
Date
Msg-id 5321ADDB.5030804@dunslane.net
Whole thread Raw
In response to Re: jsonb and nested hstore  (Greg Stark <stark@mit.edu>)
Responses Re: jsonb and nested hstore  (Greg Stark <stark@mit.edu>)
List 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




pgsql-hackers by date:

Previous
From: Etsuro Fujita
Date:
Subject: Re: inherit support for foreign tables
Next
From: Stephen Frost
Date:
Subject: Re: [PATCH] Store Extension Options