Re: Cumulative aggregate - Mailing list pgsql-general

From Tom Lane
Subject Re: Cumulative aggregate
Date
Msg-id 6618.1159390564@sss.pgh.pa.us
Whole thread Raw
In response to Cumulative aggregate  ("Paolo Saudin" <paolo@ecometer.it>)
List pgsql-general
"Paolo Saudin" <paolo@ecometer.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

pgsql-general by date:

Previous
From: Ray Stell
Date:
Subject: Re: How to Examine a view
Next
From: Tom Lane
Date:
Subject: Re: cyclical redundancy checksum algorithm(s)?