Re: Initial Review: JSON contrib modul was: Re: Another swing at JSON

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Joey Adams <joeyadams3(dot)14159(at)gmail(dot)com>, Bernd Helmle <mailings(at)oopsware(dot)de>, Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, David Fetter <david(at)fetter(dot)org>, Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Initial Review: JSON contrib modul was: Re: Another swing at JSON
Date: 2011-07-18 19:38:16
Message-ID: CA+TgmoZa_i3t6MVQBxhrwfVU-mR_BxDRHRQa=2GDL6sdzLQ7EQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 18, 2011 at 3:19 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Fri, Jul 15, 2011 at 3:56 PM, Joey Adams <joeyadams3(dot)14159(at)gmail(dot)com> wrote:
>>> I'm having a really hard time figuring out how the JSON module should
>>> handle non-Unicode character sets.
>
>> But, again, why not just forget about transcoding and define it as
>> "JSON, if you happen to be using utf-8 as the server encoding, and
>> otherwise some variant of JSON that uses the server encoding as its
>> native format?".  It seems to me that that would be a heck of a lot
>> simpler and more reliable, and I'm not sure it's any less useful in
>> practice.
>
> Right offhand, the only argument I can see against this is that we might
> someday want to pass JSON datums directly to third-party loadable
> libraries that are picky about UTF8-ness.  But we could just document
> and/or enforce that such libraries can only be used in UTF8-encoded
> databases.

Right. Or, if someone someday implements a feature to allow multiple
server encodings within the same database, then we can tell people to
use it if they want JSON to work in a spec-canonical way.

> BTW, could the \uNNNN problem be finessed by leaving such escapes in
> source form?

Joey seems to want to canonicalize the input, which argues against
that, and to detect invalid surrogate pairs, which likewise argues
against that. You could argue that's overkill, but it seems to have
at least some merit.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-07-18 19:39:11 Re: Reduced power consumption in autovacuum launcher process
Previous Message Robert Haas 2011-07-18 19:31:52 Re: per-column generic option