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

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ?
Дата
Msg-id 9A450013-8006-4EB9-B34E-D62A301DD51B@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>)
Список pgsql-hackers
On May 1, 2012, at 20:41, Hannu Krosing <hannu@2ndQuadrant.com> wrote:
>
> Most people don't work in strongly-typed environment, and thus would
> work around such restriction if they need a simple JSON value at the
> other end of the interchange.
>
>
>> My personal take it is have it fail since any arbitrary decision to cast
>> to JSON Text is going to make someone unhappy and supposedly they can
>> modify their query so that the result generates whatever format they desire.
>
> Do you actually have such an experience or is it just a wild guess ?
>
>

So even given the semantic differences between an object and a scalar I am better understanding where interpreting JSON
asJSON Value makes sense.  However, if I convert a record or array to JSON I expect to get a JSON Text even if the
thereis only a single column or value in the input.   

I guess my take is that record -> JSON text while anything else is JSON value.  Whether it is worth maiming the special
casefor record is worthwhile I really do not know but the semantic difference does exist; and record output is a
significantaspect of PostgreSQL output. 

I get the ease-of-use aspect but also recognize that sometimes being slightly harder to use is worthwhile if you
eliminateambiguities or limit the possibility to make mistakes. 

FWIW my background on this topic is more theoretical than experiential though I am an web-application developer by
tradeand do use some JSON in that capacity. 

David J.

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

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: proposal: additional error fields
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Have we out-grown Flex?