> intagg: the aggregation function has been obsolete since 7.4 because
> standard array functionality supports the same.  intagg has a nice
> equivalent for UNROLL, but it only works for arrays of INT, and only
> one-dimensional arrays.  Has not been updated since 2001.

I think this one can be dropped.  The definition of a general
array_accum() is very easy, and supplied in the docs:

CREATE AGGREGATE array_accum (anyelement)
(
    sfunc = array_append,
    stype = anyarray,
    initcond = '{}'
);

A general one-dimensional array enumerator is equally easy to define,
though not in the docs (there is a two-dimensional array enumerator
called unnest2 under generate_subscripts):

CREATE OR REPLACE FUNCTION array_enum(anyarray)
    RETURNS SETOF anyelement AS
$$
    SELECT $1[i] FROM generate_subscripts($1,1) i
$$ LANGUAGE sql;

With a little more work you could even (crazy thought) add some error checking.

It would probably be helpful if the generate_subscripts and array
documentation were cross-referenced a bit better.  There's no
indication on the array page that generate_subscripts() is out there,
and it's clearly both very useful and array-related.

...Robert

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to