Re: [HACKERS] AGREGATE FUNCTIONS
> 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. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [HACKERS] AGREGATE FUNCTIONS
Roberto Rezende de Assis wrote: 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. http://projects.commandprompt.com/public/pgsql/browser/trunk/pgsql/src/backend/utils/adt http://projects.commandprompt.com/public/pgsql/browser/trunk/pgsql/src/backend/utils/adt/numeric.c http://projects.commandprompt.com/public/pgsql/browser/trunk/pgsql/src/backend/utils/adt That will give you and easy interface to view the code and everything after browser is the CVS source tree so you can look for yourself within your copy of HEAD or 8.1 or whatever. Sincerely, Joshua D. Drake Thanks ___ Navegue com o Yahoo! Acesso Grátis, assista aos jogos do Brasil na Copa e ganhe prêmios de hora em hora! http://br.yahoo.com/artilheirodacopa/ ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match -- === The PostgreSQL Company: Command Prompt, Inc. === Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 Providing the most comprehensive PostgreSQL solutions since 1997 http://www.commandprompt.com/ ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [HACKERS] AGREGATE FUNCTIONS
On Tue, 6 Jun 2006, Roberto Rezende de Assis wrote: Hello, I would like to know where in the source-code of postgres is located the code of the aggregate functions min, max, avg. They're in src/backend/utils/adt/numeric.c I wish to develop more statistical aggregate functions, and I prefer to use C than to write then in the PL/R. Make sure you read section "32.10 User-Defined aggregates" in the manual: http://www.postgresql.org/docs/current/interactive/xaggr.html Also, take a look at contrib/intagg for another example. - Heikki ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
[HACKERS] AGREGATE FUNCTIONS
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. Thanks ___ Navegue com o Yahoo! Acesso Grátis, assista aos jogos do Brasil na Copa e ganhe prêmios de hora em hora! http://br.yahoo.com/artilheirodacopa/ ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match