Re: aggregate function for median calculation - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: aggregate function for median calculation
Date
Msg-id Pine.LNX.4.30.0106192249250.724-100000@peter.localdomain
Whole thread Raw
In response to Re: aggregate function for median calculation  ("Thalis A. Kalfigopoulos" <thalis@cs.pitt.edu>)
Responses Re: aggregate function for median calculation
List pgsql-general
Thalis A. Kalfigopoulos writes:

> So is there a way I can actually have a variable (the array with the elements) maintained between calls of the same
function?I'm trying to figure how to design the aggregate's state_function that will do the element accumulation
(beforeactually passing this array to the final to calculate the median). 

Sure, you create a (static) global variable and reallocate memory for it
in each call and free it by the finalizer function.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


pgsql-general by date:

Previous
From: "Thalis A. Kalfigopoulos"
Date:
Subject: Re: aggregate function for median calculation
Next
From: "Thalis A. Kalfigopoulos"
Date:
Subject: postgres.h missing?