On Tue, Mar 20, 2012 at 5:37 AM, Chengjie Qin <cqin3(at)ucmerced(dot)edu> wrote:
> Hi all,
> I'm using the embedded SQL in C to create the User-Defined Aggregate(UDA).
> The command is :
> CREATE AGGREGATE aggname( sfunc=kmeans,
> stype=double precision,
> Since I need to do the aggregation in multiple rounds. I need to initialize
> the INITCOND using the execution result of last execution （aggregation.）
> Any one can tell me how can I initialize the INITCOND using host variables
> instead of hard code the INITCOND?
There is no straight forward way to have 'variable' initial condition.
condition can be a constant string acceptable by state_data_type's in
function. You might be able to achieve what you want by changing sfunc().
Set initial condition as null, and inside sfunc(), i.e. state transition
function, if you see NULL initial condition, pull the initial condition
from the database appropriately. But, this is the last resort. Why do you
need to have variable initial condition? Can you please elaborate the
problem you are solving, there might be simpler ways to handle this.
The Enterprise Postgres Company
In response to
pgsql-in-general by date
|Next:||From: Pavan Deolasee||Date: 2012-03-20 08:13:51|
|Subject: Re: Initialize the User-defined Aggregate in ECPG|
|Previous:||From: Chengjie Qin||Date: 2012-03-20 00:07:53|
|Subject: Initialize the User-defined Aggregate in ECPG|