pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Hazel <ghazel@gmail.com>
To: Merlin Moncure <mmoncure@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7620: array_to_json doesn't support heterogeneous arrays
Date: Tue, 23 Oct 2012 18:05:44 -0700
Message-ID: <E54F8153-EA35-4AF1-AB36-FEA63EA18A75@gmail.com> (raw)
In-Reply-To: <CAHyXU0xNBtbHJtFxa9P8rJ+Q6VJku-co6mM=hEzXOTeuosJwdg@mail.gmail.com>
References: <E1TQnxe-0002WI-DP@wrigleys.postgresql.org>
	<CAHyXU0xNBtbHJtFxa9P8rJ+Q6VJku-co6mM=hEzXOTeuosJwdg@mail.gmail.com>

On Oct 23, 2012, at 6:03 PM, Merlin Moncure <mmoncure@gmail.com> wrote:

> On Tue, Oct 23, 2012 at 6:32 PM,  <ghazel@gmail.com> wrote:
>> The following bug has been logged on the website:
>> 
>> Bug reference:      7620
>> Logged by:          Greg Hazel
>> Email address:      ghazel@gmail.com
>> PostgreSQL version: 9.2.1
>> Operating system:   Amazon Linux
>> Description:
>> 
>> array_to_json(ARRAY['foo', 100, true]) complains because arrays can't have
>> mixed types, but json arrays can.
>> 
>> So, it's not possible to form a heterogeneous json array, when this is often
>> desired.
> 
> This is not really a bug because the feature is working as intended.
> Postgres arrays are homogonous so what you're asking really isn't
> possible.  You can though use row_to_json to work around:
> 
> select row_to_json(row('foo', 100, true));

That doesn't produce the same results.

Call it a feature request or a bug report, the postgres json support fails to make the json I need.

-Greg





view thread (10+ messages)  latest in thread

Message-ID: <E54F8153-EA35-4AF1-AB36-FEA63EA18A75@gmail.com>
Permalink:  ../E54F8153-EA35-4AF1-AB36-FEA63EA18A75@gmail.com/
Also on:    postgresql.org/message-id/E54F8153-EA35-4AF1-AB36-FEA63EA18A75@gmail.com

 · 

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: ghazel@gmail.com, mmoncure@gmail.com
  Subject: Re: BUG #7620: array_to_json doesn't support heterogeneous arrays
  In-Reply-To: <E54F8153-EA35-4AF1-AB36-FEA63EA18A75@gmail.com>
  References: <E1TQnxe-0002WI-DP@wrigleys.postgresql.org> <CAHyXU0xNBtbHJtFxa9P8rJ+Q6VJku-co6mM=hEzXOTeuosJwdg@mail.gmail.com> <E54F8153-EA35-4AF1-AB36-FEA63EA18A75@gmail.com>

* 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