On Thu, Jan 29, 2015 at 5:39 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.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