Re: aggregate function for median calculation

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: "Thalis A(dot) Kalfigopoulos" <thalis(at)cs(dot)pitt(dot)edu>
Cc: Alex Pilosov <alex(at)pilosoft(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: aggregate function for median calculation
Date: 2001-06-19 20:51:51
Message-ID: Pine.LNX.4.30.0106192249250.724-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 (before actually 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(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martin Jacobs 2001-06-19 21:13:10 Re: Re: Replace MSSQL by PostgreSQL ?
Previous Message Thalis A. Kalfigopoulos 2001-06-19 20:20:10 Re: aggregate function for median calculation