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

Поиск
Список
Период
Сортировка
От Florian Pflug
Тема Re: Initial Review: JSON contrib modul was: Re: Another swing at JSON
Дата
Msg-id A52E8B6C-44F9-472C-B3B9-B189050D3163@phlo.org
обсуждение исходный текст
Ответ на Re: Initial Review: JSON contrib modul was: Re: Another swing at JSON  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Jul23, 2011, at 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.

I'm usually all for throwing an error on ambiguous input - but if Javascript,
PHP and Python all agree, it might be wise to just yield to them.

best regards,
Florian Pflug



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: Policy on pulling in code from other projects?
Следующее
От: David Fetter
Дата:
Сообщение: Re: pgbench --unlogged-tables