RE: Use of RETURN in pl/pgsql function - Mailing list pgsql-sql

From Jeff Eckermann
Subject RE: Use of RETURN in pl/pgsql function
Date
Msg-id 08CD1781F85AD4118E0800A0C9B8580B0948FF@NEZU
Whole thread Raw
In response to Use of RETURN in pl/pgsql function  (Jeff Eckermann <jeckermann@verio.net>)
Responses Re: Use of RETURN in pl/pgsql function
List pgsql-sql
I'll be hornswoggled: that works.
I hadn't expected a problem, simply because I knew the range in advance:
here is the distribution for the select that I was working with:
extracts=# select billing_frequency, count (*) from report_table group by
billing_frequency;billing_frequency | count 
-------------------+-------Monthly           | 50431Quarterly         |  7742Semi-Annual       |   167Yearly
| 8573
 
(4 rows)
Nevertheless, just adding an "...else return new;" did the trick.
I don't understand the logic of this, but then, if I stopped to consider
every mystery, I'd never get any work done:-).
Thanks very much for your help (again).

> -----Original Message-----
> From:    Tom Lane [SMTP:tgl@sss.pgh.pa.us]
> Sent:    Wednesday, February 07, 2001 12:48 PM
> To:    Jeff Eckermann
> Cc:    'pgsql-sql@postgresql.org'
> Subject:    Re: [SQL] Use of RETURN in pl/pgsql function 
> 
> Jeff Eckermann <jeckermann@verio.net> writes:
> > I thought (based on recent posts) that this use of RETURN is allowed,
> but
> > when trying an insert to report_table, I get the following error:
> > ERROR:  control reaches end of trigger procedure without RETURN
> 
> Looks to me like you didn't cover the case where billing_frequency is
> not any of the values you tested for.  Maybe you just want to raise
> an error in that case...
> 
>             regards, tom lane


pgsql-sql by date:

Previous
From: Josh Berkus
Date:
Subject: Bug reports for 7.1 beta?
Next
From: Tom Lane
Date:
Subject: Re: Use of RETURN in pl/pgsql function