On Mon, May 04, 2009 at 10:42:01AM +0200, A. Kretschmer wrote:
> No, you need a own aggregate function, but it is easy:
>
> test=# CREATE FUNCTION multiply_aggregate(float,float) RETURNS float AS
> ' select $1 * $2; ' language sql IMMUTABLE STRICT; CREATE AGGREGATE
> multiply (basetype=float, sfunc=multiply_aggregate, stype=float,
> initcond=1 ) ;
> CREATE FUNCTION
> CREATE AGGREGATE
Note, you don't have to create your own function here, since there's a
builtin called float8mul. So the following will work:
CREATE AGGREGATE multiply (basetype=float8, sfunc=float8mul, stype=float8, initcond=1);
The rest is the same.
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.