| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Andrew Bartley <ambartley(at)gmail(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: intagg |
| Date: | 2013-06-20 19:40:43 |
| Message-ID: | 25041.1371757243@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Andrew Bartley <ambartley(at)gmail(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David Johnston | 2013-06-20 21:36:26 | Re: coalesce function |
| Previous Message | Arjen Nienhuis | 2013-06-20 19:37:15 | Re: intagg |