Re: New array functions - Mailing list pgsql-hackers

From Greg Stark
Subject Re: New array functions
Date
Msg-id 871xv5liyl.fsf@stark.dyndns.tv
Whole thread Raw
In response to Re: New array functions  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
Joe Conway <mail@joeconway.com> writes:

> Greg Stark wrote:
> > So where are the new array functions and syntaces documented?
> 
> Mainly here:
> http://developer.postgresql.org/docs/postgres/arrays.html

excellent. thank you.

> > Specifically I want to know how to replace my int_array_aggregate(int) and
> > int_array_enum(_int) calls.
> 
> I have no idea what those are -- are they from contrib?

indeed in contrib/intagg

> You can create an aggregate to turn arbitrary datatype elements into arrays
> like this:
> 
> CREATE AGGREGATE array_aggregate
> (
>    BASETYPE = anyelement,
>    SFUNC = array_append,
>    STYPE = anyarray,
>    INITCOND = '{}'
> );

Hm, perhaps there should be a standard name for this, rather than have
everyone's code do their own thing.

> If int_array_enum() is supposed to take '{1,2,3}' and produce three rows, that
> function was proposed but rejected. Subsequently Peter Eisentraut pointed out a
> SQL99 syntax that does this, but I did not get it done for 7.4. Perhaps for 7.5.

That's exactly what it does. Hm, I guess I misinterpreted that post. Hm I have
some work to do.

Thanks. And thanks a LOT for doing the work, it'll makes a big difference
and make arrays much more practical to use.

-- 
greg



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: bug with constraint dependencies? or bug with
Next
From: Tom Lane
Date:
Subject: Re: bug with constraint dependencies? or bug with