Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ?

Поиск
Список
Период
Сортировка
Искать
От
Joey Adams
Тема
Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ?
Дата
в 13:57:15
Msg-id
CAARyMpA9E6Mt4SYQfTzqYOZ_7=qNu+SR5rYRjuAVaXp-wR6uWg@mail.gmail.com
Ответ на
Список
Дерево обсуждения
JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ? Hannu Krosing <hannu@2ndQuadrant.com>
Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ? Merlin Moncure <mmoncure@gmail.com>
Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ? Hannu Krosing <hannu@2ndQuadrant.com>
Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ? Joey Adams <joeyadams3.14159@gmail.com>
Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ? Hannu Krosing <hannu@2ndQuadrant.com>
Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ? Merlin Moncure <mmoncure@gmail.com>
Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ? Andrew Dunstan <andrew@dunslane.net>
Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ? Hannu Krosing <hannu@2ndQuadrant.com>
Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ? "David Johnston" <polobo@yahoo.com>
Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ? Hannu Krosing <hannu@2ndQuadrant.com>
Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ? David Johnston <polobo@yahoo.com>
Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ? Hannu Krosing <hannu@2ndQuadrant.com>
Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ? Hannu Krosing <hannu@2ndQuadrant.com>
Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ? Joey Adams <joeyadams3.14159@gmail.com>
Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ? Andrew Dunstan <andrew@dunslane.net>
Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ? Hannu Krosing <hannu@2ndQuadrant.com>
Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ? Hannu Krosing <hannu@2ndQuadrant.com>
Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ? Merlin Moncure <mmoncure@gmail.com>
On Tue, May 1, 2012 at 12:22 PM, Andrew Dunstan  wrote:
> Second, RFC 4627 is absolutely clear: a valid JSON value can only be an
> object or an array, so this thing about converting arbitrary datum values to
> JSON is a fantasy. If anything, we should adjust the JSON input routines to
> disallow anything else, rather than start to output what is not valid JSON.

No, the RFC says (emphasis mine):
   A JSON *text* is a serialized object or array.

If we let the JSON type correspond to a *value* instead, this
restriction does not apply, and the JSON type has a useful recursive
definition.

For example, this function would not be possible if we applied the
"object or array" restriction:
   unnest(json) returns setof json

Note that a similar distinction appears with the XML type: "document"
versus "content".

-Joey

В списке pgsql-hackers по дате отправления
От: Tom Lane
Дата:
FAQ