Re: requesting features in PostgreSQL - Mailing list pgsql-general

From Tom Lane
Subject Re: requesting features in PostgreSQL
Date
Msg-id 26359.1019834347@sss.pgh.pa.us
Whole thread Raw
In response to requesting features in PostgreSQL  (Andrew Gould <andrewgould@yahoo.com>)
Responses Re: requesting features in PostgreSQL  (Andrew Gould <andrewgould@yahoo.com>)
List pgsql-general
Andrew Gould <andrewgould@yahoo.com> writes:
> I need an aggregate function that calculates geometric
> mean, and can be used in SQL statements the same as
> any other aggregate function such as count(), sum()
> and avg().  Rather than have a custom function, I'd
> like to see it added as a standard PostgreSQL feature.

One request does not strike me as sufficient reason to make it a
standard feature.  Extensibility is what Postgres is all about
--- so go ahead and write your own.

AFAICS this should take about ten minutes to prototype (two simple
plpgsql or pltcl functions and a user-defined aggregate).  If you intend
to process very large volumes of data, it might be worth rewriting the
transition function in C for speed.  (You could steal the existing
transition function for avg() as a model.)

            regards, tom lane

pgsql-general by date:

Previous
From: "Robert J. Sanford, Jr."
Date:
Subject: Re: odd psql behaviour on OSX
Next
From: "Dominic J. Eidson"
Date:
Subject: Re: Pam Authentication help needed