Re: Cumulative aggregate

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Paolo Saudin" <paolo(at)ecometer(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Cumulative aggregate
Date: 2006-09-27 20:56:04
Message-ID: 6618.1159390564@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Paolo Saudin" <paolo(at)ecometer(dot)it> writes:
> -- function for float (NOT WORKING)
> create function myfloat4_sum(float4,float4) returns float4
> as 'select float4pl($1,$2)::float4;'
> language SQL;
> -- aggregate
> create aggregate myagg2_sum (basetype = float4, sfunc = myfloat4_sum, stype
> = float4);
> -- result
> select myagg2_sum(fld2) from mytest; --> NOTHING ??? INSTEAD OF 6.73

> What am I doing wrong ??

(1) not marking the transition function as strict --- this affects the
behavior of the aggregate;
(2) not providing an initial condition.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-09-27 21:01:48 Re: cyclical redundancy checksum algorithm(s)?
Previous Message Tom Lane 2006-09-27 20:52:51 Re: [GENERAL] Restart after power outage: createdb