Re: BUG #7620: array_to_json doesn't support heterogeneous arrays - Mailing list pgsql-bugs

From Craig Ringer
Subject Re: BUG #7620: array_to_json doesn't support heterogeneous arrays
Date
Msg-id 508CDF2E.7060305@ringerc.id.au
Whole thread Raw
In response to Re: BUG #7620: array_to_json doesn't support heterogeneous arrays  (Greg Hazel <ghazel@gmail.com>)
List pgsql-bugs
On 10/24/2012 11:46 PM, Greg Hazel wrote:
> Another option that just occurred to me is a new function (say, to_json) that converts the parameter to its json
representation,with type json. 
>
> Then this would be possible:
>
> select array_to_json(ARRAY[to_json('foo'), to_json(100), to_json(true)]);
That's been repeatedly discussed (and requested, and had patches posted)
on -hackers. Right now the standing opinion appears to be that "json"
represents a whole json document, and json documents must be arrays or
JavaScript objects, not scalars, so it is not valid to provide a scalar
"to_json".

I posted patches to support this functionality - as did several others
as it turns out - and they've all been rejected.

--
Craig Ringer

pgsql-bugs by date:

Previous
From: Владимир Сошенко
Date:
Subject: Installation issue
Next
From: tixu@cs.ucsd.edu
Date:
Subject: BUG #7624: Misleading Log Message & Inconsistent Configuration Design