Re: [PERFORM] GroupAggregate and Integer Arrays

2015-10-24 Thread Marc Mamin
> CREATE OR REPLACE FUNCTION array_add(int[],int[]) RETURNS int[] AS $$ >-- Add two arrays. >select > ARRAY ( > SELECT coalesce($1[i],0) + coalesce($2[i],0) > FROM ( > select generate_series(least(array_lower($1, 1),array_lower($2, > 1)),

Re: [PERFORM] GroupAggregate and Integer Arrays

2015-10-24 Thread Jeff Janes
On Fri, Oct 23, 2015 at 9:26 AM, David Osborne wrote: > Ah yes sorry: > > I think these cover it... > > CREATE AGGREGATE sum ( > sfunc = array_add, > basetype = INTEGER[], > stype = INTEGER[], > initcond = '{}' >); > > CREATE OR REPLACE FUNCTION