Re: Duplicate JSON Object Keys

From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Hannu Krosing <hannu(at)2ndQuadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Duplicate JSON Object Keys
Date: 2013-03-08 21:14:09
Message-ID: 46479E46-F635-44BB-8B44-1357F623F1A8@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mar 8, 2013, at 1:01 PM, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote:

>> If it does not meet these "semantic" constraints, then it is not
>> really JSON - it is merely JSON-like.
>>
>> this sounds very much like MySQLs decision to support timestamp
>> "0000-00-00 00:00" - syntactically correct, but semantically wrong.
>
> Is it wrong? The standard cited says SHOULD, not MUST.

Yes, it is wrong, because multiple keys are specifically disallowed for accessing values. Hence this new error:

david=# select json_get('{"foo": 1, "foo": 2}', 'foo');
ERROR: field name is not unique in json object

I really don’t think that should be possible.

Best,

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Gavin Flower 2013-03-08 21:19:01 Re: Duplicate JSON Object Keys
Previous Message Alvaro Herrera 2013-03-08 21:01:10 Re: Duplicate JSON Object Keys