Re: json/jsonb inconsistence - 2

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: json/jsonb inconsistence - 2
Date: 2014-05-29 12:15:36
Message-ID: 538724E8.2040009@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 05/29/2014 08:00 AM, Teodor Sigaev wrote:
> postgres=# select '["\u0000"]'::json->0;
> ?column?
> ----------
> "\u0000"
> (1 row)
>
> Time: 1,294 ms
> postgres=# select '["\u0000"]'::jsonb->0;
> ?column?
> -----------
> "\\u0000"
> (1 row)
>
> It seems to me that escape_json() is wrongly used in
> jsonb_put_escaped_value(), right name of escape_json() is a
> escape_to_json().

That's a bug. I will look into it. I think we might need to special-case
\u0000 on output, just as we do on input.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Teodor Sigaev 2014-05-29 12:19:26 Re: json/jsonb inconsistence
Previous Message Peter Eisentraut 2014-05-29 12:14:48 Re: [PATCH] Replacement for OSSP-UUID for Linux and BSD