Re: jsonb, unicode escapes and escaped backslashes

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Noah Misch <noah(at)leadboat(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: jsonb, unicode escapes and escaped backslashes
Date: 2015-01-30 03:03:57
Message-ID: CA+TgmoYaHTe3AYy6+jaot2V0ebTs_gKbMMhVSLr1k9nhF7Tr6Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 29, 2015 at 5:39 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> I have yet to understand what we fix by banning \u0000. How is 0000
>> different from any other four-digit hexadecimal number that's not a
>> valid character in the current encoding? What does banning that one
>> particular value do?
>
> BTW, as to the point about encoding violations: we *already* ban \uXXXX
> sequences that don't correspond to valid characters in the current
> encoding. The attempt to exclude U+0000 from the set of banned characters
> was ill-advised, plain and simple.

Oh. Well, that's hard to argue with, then. I can't imagine why we'd
disallow all bytes invalid in the current encoding *except* for \0.
When I originally coded up the JSON data type, I intended for it to
store invalidly-encoded data that was nevertheless valid JSON without
trying to interpret it. It seems we've drifted pretty far off of that
principle.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2015-01-30 03:09:38 Re: jsonb, unicode escapes and escaped backslashes
Previous Message Robert Haas 2015-01-30 02:59:02 Re: jsonb, unicode escapes and escaped backslashes