Re: intagg
| От | Tom Lane |
|---|---|
| Тема | Re: intagg |
| Дата | |
| Msg-id | 25041.1371757243@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | intagg (Andrew Bartley <ambartley@gmail.com>) |
| Список | 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 по дате отправления: