Re: function body error checking issues

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: tony_caduto(at)amsoftwaredesign(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: function body error checking issues
Date: 2005-02-25 05:03:58
Message-ID: 200502250503.j1P53wB08744@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

tony_caduto(at)amsoftwaredesign(dot)com wrote:
> Bruce,
> here is a example:
> (there is a simple error in the function that does not get caught when running the query in 8.0)
>
> CREATE or REPLACE FUNCTION annual.get_ratio( float8, float8)
> RETURNS pg_catalog.float8 AS
> $BODY$
> DECLARE
> execptioncount_in alias for $1;
> questioncount_in alias for $2;
> ratio_out float8;
>
> BEGIN
> IF (execptioncount_in >0) AND (questioncount_in >0) THEN
>
> RATIO_OUT = execptioncount_in / questioncount_in;
>
> ELSE
> --this variable is not declared, yet when I run this query no error is raised
> EXCEPTIONRATIO_OUT = 0;
> END IF;
> return ratio_out;
> END;
> $BODY$
> LANGUAGE 'plpgsql' VOLATILE

Syntax error reporting has been improved in our code so 8.1 might be
better and catching such errors.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2005-02-25 05:27:58 Re: [PATCHES] A way to let Vacuum warn if FSM settings are low.
Previous Message Jon Asher 2005-02-25 01:28:39 Re: Which query is less expensive / faster?