Re: array_agg-like thing over arrays

From: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
To: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>, pgsql-general(at)postgresql(dot)org
Subject: Re: array_agg-like thing over arrays
Date: 2011-01-14 22:35:20
Message-ID: AANLkTikfnLgPEaOzROfgcM_p4kF4wyd+=HqpstuJUOu5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hey Andrew,

2011/1/15 Andrew Sullivan <ajs(at)crankycanuck(dot)ca>

> Hi all,
>
> I could swear I remember being able to do this in the past, but it
> doesn't seem I can remember how, and I have been unable to find
> anything in The Fine Materials.
>
> I want to produce the output of rows of arrays as an aggregated array:
>
> create table eg1 (class_id int, item_id int8, arrayofstuff text[]);
>
> SELECT item_id, array_agg(arrayofstuff) from eg1 WHERE class_id = 1;
>
Try SELECT item_id, array_agg(arrayofstuff::text) from eg1 WHERE class_id =
1;

>
> But this, of course, gives an ERROR: could not find array type for data
> type text[].
>
> What am I missing, or have I just misremembered that this was ever
> possible?
>
> Thanks,
>
> A
>
> --
> Andrew Sullivan
> ajs(at)crankycanuck(dot)ca
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

--
// Dmitriy.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2011-01-14 22:52:18 Re: pg_db_role_setting info not dumped
Previous Message Adrian Klaver 2011-01-14 22:28:00 pg_db_role_setting info not dumped