Re: AGREGATE FUNCTIONS - Mailing list pgsql-hackers

From Mark Woodward
Subject Re: AGREGATE FUNCTIONS
Date
Msg-id 18858.24.91.171.78.1149649748.squirrel@mail.mohawksoft.com
Whole thread Raw
In response to AGREGATE FUNCTIONS  (Roberto Rezende de Assis <rezende_assis@yahoo.com.br>)
List 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.



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: That EXPLAIN ANALYZE patch still needs work
Next
From: "Mark Woodward"
Date:
Subject: Re: How to avoid transaction ID wrap