Re: AGREGATE FUNCTIONS

From: "Mark Woodward" <pgsql(at)mohawksoft(dot)com>
To: rezende_assis(at)yahoo(dot)com(dot)br
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: AGREGATE FUNCTIONS
Date: 2006-06-07 03:09:08
Message-ID: 18858.24.91.171.78.1149649748.squirrel@mail.mohawksoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Hello, I would like to know where in the source-code of postgres is
> located the code of the aggregate functions min, max, avg.
> I wish to develop more statistical aggregate functions, and I prefer to
> use C than to write then in the PL/R.

There is a library in "contrib" called "intagg." I wrote it a few years
ago, and I have to laugh at the README file because I must have been
stoned or something, because I can't understand it.

Anyways, if you want to make an aggregate function, it covers what you
need. Feel free to ignore the array stuff, because you probably won't need
to deal with it.

Aggregates have basically two functions, a single function called on every
iteration of the "query" (or GROUP BY) for "state." Then there is a
function that is called at the end called "final." The PostgreSQL docs are
pretty good as well.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Woodward 2006-06-07 03:11:40 Re: How to avoid transaction ID wrap
Previous Message Tom Lane 2006-06-07 02:48:55 Re: table/index fillfactor control