Re: Unpacking scalar JSON values

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Daniel Farina <daniel(at)fdr(dot)io>
Cc: Hannu Krosing <hannu(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Unpacking scalar JSON values
Date: 2013-08-25 14:17:34
Message-ID: 521A11FE.7000300@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 08/24/2013 09:08 PM, Daniel Farina wrote:
> On Sat, Aug 24, 2013 at 6:04 PM, Daniel Farina <daniel(at)fdr(dot)io> wrote:
>> But there's no good way I can find from the documentation to do it
>> with a scalar: select ('"va\"lue"'::json)::text;
> Triggered send by accident:
>
> select ('"va\"lue"'::json)::text;
> text
> -----------
> "va\"lue"
> (1 row)
>
> the JSON escaping is retained. That may be reasonable for a
> text-cast, so I'm not suggesting its reinterpretation, but there is no
> operator I can identify immediately from the documentation to convert
> a JSON string value into a Postgres one like json_each_text, except on
> a json that contains a scalar JSON string.
>
>

This came up recently on -bugs. See
<http://www.postgresql.org/message-id/51FBF787.5000408@dunslane.net>,
where I suggested we expose the dequoting function.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2013-08-25 15:01:49 Re: proposal: lob conversion functionality
Previous Message Marc Cousin 2013-08-25 07:22:16 Re: Performance problem in PLPgSQL