pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <ringerc@ringerc.id.au>
To: Greg Hazel <ghazel@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7620: array_to_json doesn't support heterogeneous arrays
Date: Sun, 28 Oct 2012 15:30:54 +0800
Message-ID: <508CDF2E.7060305@ringerc.id.au> (raw)
In-Reply-To: <F1B8C7A1-C22E-457A-A470-E938DD347B28@gmail.com>
References: <E1TQnxe-0002WI-DP@wrigleys.postgresql.org>
	<50879711.6020209@ringerc.id.au>
	<F1B8C7A1-C22E-457A-A470-E938DD347B28@gmail.com>

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




view thread (10+ messages)

Message-ID: <508CDF2E.7060305@ringerc.id.au>
Permalink:  ../508CDF2E.7060305@ringerc.id.au/
Also on:    postgresql.org/message-id/508CDF2E.7060305@ringerc.id.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: ringerc@ringerc.id.au, ghazel@gmail.com
  Subject: Re: BUG #7620: array_to_json doesn't support heterogeneous arrays
  In-Reply-To: <508CDF2E.7060305@ringerc.id.au>
  References: <E1TQnxe-0002WI-DP@wrigleys.postgresql.org> <50879711.6020209@ringerc.id.au> <F1B8C7A1-C22E-457A-A470-E938DD347B28@gmail.com> <508CDF2E.7060305@ringerc.id.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox