From: Bruce Momjian <bruce@momjian.us>
To: jaroslav.potapov@gmail.com
Cc: pgsql-bugs@postgresql.org
Cc: Andrew Dunstan <andrew@dunslane.net>
Subject: Re: BUG #8293: There are no methods to convert json scalar text to text in v9.3 beta2
Date: Fri, 2 Aug 2013 13:04:36 -0400
Message-ID: <20130802170436.GB14543@momjian.us> (raw)
In-Reply-To: <E1Uwzk2-000262-3q@wrigleys.postgresql.org>
References: <E1Uwzk2-000262-3q@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On Wed, Jul 10, 2013 at 07:07:54PM +0000, jaroslav.potapov@gmail.com wrote:
> The following bug has been logged on the website:
>
> Bug reference: 8293
> Logged by: Yaroslav Potapov
> Email address: jaroslav.potapov@gmail.com
> PostgreSQL version: Unsupported/Unknown
> Operating system: All
> Description:
>
> SELECT '"a\"b"'::json::text
>
>
> returns text: '"a\"b"' ,
> but it must return 'a"b' in my opinion.
I see you didn't get a reply, so let me try. I am no JSON expert, but I
think what is happening is that the system stores "a\"b" because that is
what a JSON/Javascript interpreter would need to understand that value.
It would convert "a\"b" to a"b. If we just stored a"b, the interpreter
would throw an error on input.
You can see this a little bit using 9.3 beta to pull values based on
keys:
SELECT json_extract_path('{"\"a": "b\"c"}'::json, '"a');
json_extract_path
-------------------
"b\"c"
(1 row)
SELECT json_extract_path('{"\"a": "b\"c"}'::json, '\"a');
json_extract_path
-------------------
(1 row)
Notice the key is "a, not \"a.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: bruce@momjian.us, jaroslav.potapov@gmail.com, andrew@dunslane.net
Subject: Re: BUG #8293: There are no methods to convert json scalar text to text in v9.3 beta2
In-Reply-To: <20130802170436.GB14543@momjian.us>
References: <E1Uwzk2-000262-3q@wrigleys.postgresql.org> <20130802170436.GB14543@momjian.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox