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.