how do you write aggregate function - Mailing list pgsql-general

From Justin
Subject how do you write aggregate function
Date
Msg-id 47CD7C72.2010604@emproshunts.com
Whole thread Raw
Responses Re: how do you write aggregate function  (Colin Wetherbee <cww@denterprises.org>)
Re: how do you write aggregate function  ("Richard Broersma" <richard.broersma@gmail.com>)
List pgsql-general
The help is not real clear nor can i find examples how to write an aggregate function. 

I searched the archive of the mail list and did not find anything

I need to write Weighted Average function so the need to keep track of multiple variables between function calls is must?

 I see how the sfunc( internal-state, next-data-values )   keeps track of the passed values with the internal state.  Can the internal state be an array type where i  just adding new entries to a multi-dimensional array then on ffunc do all the math in.

One person pointed out the pl/r plugin but what i'm working on gets tied into the PostBooks/OpenMfg project and they are not real big fans on adding another language and plugin they have to make sure their customers have deployed (which i'm one of those customers).

PostBooks/OpenMfg will want all the functions in pl/pgsql  does this present any major problems??

pgsql-general by date:

Previous
From: "Douglas McNaught"
Date:
Subject: Re: Build 8.3 with OpenSSL on CentOS 5.x?
Next
From: Colin Wetherbee
Date:
Subject: Re: how do you write aggregate function