From: Tom Lane <tgl@sss.pgh.pa.us>
To: david.g.johnston@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14626: array_agg( anyarray ) unexpected error with multi-valued single-dimension array
Date: Wed, 19 Apr 2017 17:03:52 -0400
Message-ID: <30751.1492635832@sss.pgh.pa.us> (raw)
In-Reply-To: <20170419204327.24366.56745@wrigleys.postgresql.org>
References: <20170419204327.24366.56745@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
david.g.johnston@gmail.com writes:
> This doesn't, and should since the number of elements in the non-empty array
> shouldn't change the dimensionality logic.
> SELECT array_agg(CASE WHEN a = ARRAY[]::text[] THEN ARRAY['N/A']::text[]
> ELSE a END)
> FROM ( VALUES (1, ARRAY[]::text[]), (1, ARRAY['1','2']::text[]) ) vals (v,
> a)
Why do you think that should work? You're asking array_agg to accumulate
a 1-D length-1 array and then a 1-D length-2 array. There's no way to
make a rectangular 2-D array out of that, except perhaps by inventing
entries which isn't in array_agg's charter.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com
Subject: Re: BUG #14626: array_agg( anyarray ) unexpected error with multi-valued single-dimension array
In-Reply-To: <30751.1492635832@sss.pgh.pa.us>
References: <20170419204327.24366.56745@wrigleys.postgresql.org> <30751.1492635832@sss.pgh.pa.us>
* 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