Re: Initial Review: JSON contrib modul was: Re: Another swing at JSON - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Initial Review: JSON contrib modul was: Re: Another swing at JSON
Date
Msg-id CA+TgmoZjHL1POpt78fsQYXNDcNrktGxkDChNWEX27x9EXGzc5Q@mail.gmail.com
Whole thread Raw
In response to Re: Initial Review: JSON contrib modul was: Re: Another swing at JSON  (Jan Urbański <wulczer@wulczer.org>)
List pgsql-hackers
On Fri, Jul 22, 2011 at 7:16 PM, Jan Urbański <wulczer@wulczer.org> wrote:
> On 23/07/11 01:12, Robert Haas wrote:
>> On Fri, Jul 22, 2011 at 6:04 PM, Joey Adams <joeyadams3.14159@gmail.com> wrote:
>>> On another matter, should the JSON type guard against duplicate member
>>> keys?  The JSON RFC says "The names within an object SHOULD be
>>> unique," meaning JSON with duplicate members can be considered valid.
>>> JavaScript interpreters (the ones I tried), PHP, and Python all have
>>> the same behavior: discard the first member in favor of the second.
>>> That is, {"key":1,"key":2} becomes {"key":2}.  The XML type throws an
>>> error if a duplicate attribute is present (e.g. '<a href="b"
>>> href="c"/>'::xml).
>>
>> Hmm.  That's tricky.  I lean mildly toward throwing an error as being
>> more consistent with the general PG philosophy.
>
> OTOH:
>
> regression=# select 'key=>1,key=>2'::hstore;
>   hstore
> ------------
>  "key"=>"1"
> (1 row)

Fair point.

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


pgsql-hackers by date:

Previous
From: Jan Urbański
Date:
Subject: Re: Initial Review: JSON contrib modul was: Re: Another swing at JSON
Next
From: Josh Berkus
Date:
Subject: Re: Policy on pulling in code from other projects?