Re: plpgsql loop not returning value

From: Josh Close <narshe(at)gmail(dot)com>
To: POSTGRES <pgsql-general(at)postgresql(dot)org>
Subject: Re: plpgsql loop not returning value
Date: 2004-10-16 14:30:32
Message-ID: 4a0cafe204101607301152c6d2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mark Dexter 2004-10-16 15:11:00 Re: Complex Update Queries with Fromlist
Previous Message Martijn van Oosterhout 2004-10-16 14:19:21 Re: Avoiding sequential scans with OR join condition