Re: intagg - Mailing list pgsql-general

From Tom Lane
Subject Re: intagg
Date
Msg-id 25041.1371757243@sss.pgh.pa.us
Whole thread Raw
In response to intagg  (Andrew Bartley <ambartley@gmail.com>)
List pgsql-general
Andrew Bartley <ambartley@gmail.com> writes:
> function int_array_aggregate(integer[]) does not exist

int_array_aggregate() takes integers, not arrays of integers.

Depending on exactly what semantics you'd like to have, you could
probably build a custom aggregate to do this without any new C code
--- try basing it on array_cat() for instance.

regression=# create aggregate myagg (anyarray) (
sfunc = array_cat,
stype = anyarray,
initcond = '{}');
CREATE AGGREGATE
regression=# select * from x;
 transactions
--------------
 {1,2}
 {3,4,5}
(2 rows)

regression=# select myagg(transactions) from x;
    myagg
-------------
 {1,2,3,4,5}
(1 row)

            regards, tom lane


pgsql-general by date:

Previous
From: Arjen Nienhuis
Date:
Subject: Re: intagg
Next
From: David Johnston
Date:
Subject: Re: coalesce function