Re: example of aggregate function for product

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Whit Armstrong *EXTERN*" <armstrong(dot)whit(at)gmail(dot)com>, "pgsql-general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: example of aggregate function for product
Date: 2009-06-25 07:46:57
Message-ID: D960CB61B694CF459DCFB4B0128514C202FF6683@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Whit Armstrong wrote:
> I needed to write a product aggregate function, and just happened to
> find this example in the nodes to the 8.0 manual:
>
[...]
>
> but that example looks pretty different than the ones found in the 8.3
> manual (avg for instance):
>
[...]
>
> Are there any experts out there who have defined a product or
> cumulative product function that abides best practices who would be
> willing to share?

I don't know what "best practices" are, but the following works
fine on PostgreSQL 8.3 and 8.4:

CREATE AGGREGATE mul(double precision) (SFUNC=float8mul, STYPE=double precision, INITCOND=1);

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dave Page 2009-06-25 08:06:04 Re: 8.4 RC1 on ubuntu 9.04 jaunty, problems after install
Previous Message Albe Laurenz 2009-06-25 06:59:44 Re: JDBC prepared statements & server-side prepared statements