Re: I probably don't understand aggregates.

Поиск
Список
Период
Сортировка
Искать
От
David G Johnston
Тема
Re: I probably don't understand aggregates.
Дата
Msg-id
1402519308856-5806885.post@n5.nabble.com
Ответ на
Список
Дерево обсуждения
I probably don't understand aggregates. Markus Neumann <markus.neumann@math.uzh.ch>
Re: I probably don't understand aggregates. David G Johnston <david.g.johnston@gmail.com>
Re: I probably don't understand aggregates. Tom Lane <tgl@sss.pgh.pa.us>
Markus Neumann wrote
> I'm new to postgres, sql and mailing lists, so I think I'm in the right 
> place here.
> 
> I have a pl/pgsql function, that calls a selfwritten aggregate function 
> (consisting of stepfunction and finalfunction) and afterwards processes 
> the results.
> 
> The Problem:
> 
> if I call
>    SELECT myAggrFunction(x) FROM table;
> I get the correct and expected output.
> 
> but when myAggrFunction gets called inside the "wrapper"-function, the 
> finalfunction gets executed before all rows are processed and hence I 
> get a "Division by zero" error.
> 
> E.g.
>    SELECT myWrapperFunction(x) FROM table;
>    ERROR: division by zero
> 
> 
> myWrapperFunction would look something like:
> 
>    BEGIN
>      M := myAggrFunction(x);
>      --do some more stuff
>      RETURN M;
>    END;
> 
> I hope the description is somehow understandable.
> 
> Any feedback will be highly appreciated.
> 
> Markus

Is there a reason you cannot provide a self-contained example?

David J.




--
View this message in context: http://postgresql.1045698.n5.nabble.com/I-probably-don-t-understand-aggregates-tp5806879p5806885.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.

В списке pgsql-novice по дате отправления
От: Shubhra Sharma
Дата:
От: David G Johnston
Дата:
FAQ