Search Postgresql Archives

Re: example of aggregate function for product

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux