Re: example of aggregate function for product

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Whit Armstrong <armstrong(dot)whit(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: example of aggregate function for product
Date: 2009-06-24 23:04:50
Message-ID: 20090624230450.GG16227@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Whit Armstrong escribió:

> Ansis <ansis_no_ AT inbox.lv>13 Jan 2006 16:41:05
> An aggregate multiplication function, an analog of "sum" (the same
> should be defined also for other numeric types):
>
> CREATE OR REPLACE FUNCTION mul2(FLOAT,FLOAT)
> RETURNS FLOAT AS '
> DECLARE
> a ALIAS FOR $1;
> b ALIAS FOR $2;

[...]

> but that example looks pretty different than the ones found in the 8.3
> manual (avg for instance):

The main difference is that the 8.3 docs example piggybacks on C
language functions that you must compile and install separately, whereas
the comment function uses a plpgsql function and is self-contained.
Other than that (and the fact that the second one is for averages not
multiplication), both examples are technically identical ...

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-06-24 23:49:36 Re: Serious JDBC problem
Previous Message Scott Mead 2009-06-24 22:45:58 Re: [BUGS] Integrity check