The following bug has been logged online:
Bug reference: 3852
Logged by: Sokolov Yura
Email address: funny.falcon@gmail.com
PostgreSQL version: 8.3beta4
Operating system: Linux Debian 4.0rel2
Description: Could not create complex aggregate
Details:
Possibly it's not an error, then how can I make such aggregate?
create or replace function add_group(grp anyarray, ad anyelement, size int4)
returns anyarray
language plpgsql
as $$
begin
if array_upper(grp, 1) < size then
return grp||ad;
end if;
return grp;
end;
$$ immutable;
create aggregate build_group(anyelement, int4) (
SFUNC= add_group,
STYPE = anyarray
);
> ERROR: argument declared "anyarray" is not an array but type anyarray
> SQL State:42804