From: | Markus Neumann <markus(dot)neumann(at)math(dot)uzh(dot)ch> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | I probably don't understand aggregates. |
Date: | 2014-06-11 19:55:01 |
Message-ID: | 5398B415.70304@math.uzh.ch |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Shubhra Sharma | 2014-06-11 20:40:07 | Need help with this Function. I'm getting an error |
Previous Message | David G Johnston | 2014-06-11 16:25:37 | Re: Need help. Getting an error in my function when I do a select * from foo_bar() |