On Sat, 16 Oct 2004 00:59:34 -0600, Michael Fuhr <mike(at)fuhr(dot)org> wrote:
> Add some RAISE INFO statements to print variables' values at key
> places. I wonder if one of your SUMs is returning NULL, causing
> your addition to evaluate to NULL. If so, then perhaps you should
> use COALESCE to turn those NULLs into zeros.
>
> If I've misunderstood the problem then please clarify.
>
> --
> Michael Fuhr
> http://www.fuhr.org/~mfuhr/
Thanks. That's exactly what was happening. I'm still new to postgres.
This is actually the first function I've wrote. I didn't even know
about RAISE or COALESCE. I added them both and it works great now!
Thanks.
-Josh