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



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to