Re: exception handling in plpgsql - Mailing list pgsql-hackers

From Korry
Subject Re: exception handling in plpgsql
Date
Msg-id 1104591897.11849.4.camel@sakai
Whole thread Raw
In response to exception handling in plpgsql  (Sibtay Abbas <sibtay_abbas@yahoo.com>)
Responses Re: exception handling in plpgsql  (Michael Fuhr <mike@fuhr.org>)
Re: exception handling in plpgsql  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
<blockquote type="CITE"><pre>
<font color="#000000">I am using the following sytex to handle exceptions in</font>
<font color="#000000">plpgsql (I am using postgres 8 rc1)</font>

<font color="#000000">....some code ........</font>

<font color="#000000">EXCEPTION</font>
<font color="#000000">    WHEN NO_DATA THEN      </font>
<font color="#000000">       RAISE NOTICE 'NO DATA';</font>
<font color="#000000">    WHEN OTHERS THEN</font>
<font color="#000000">        RAISE NOTICE 'An exception occurred';</font>
<font color="#000000">        RETURN emp_rec;</font>

<font color="#000000">and i receive the following error </font>
<font color="#000000">ERROR:  unrecognized exception condition "no_data"</font>

<font color="#000000">How can i rectify this error?</font>
</pre></blockquote><br /> It seems you can’t trap every condition listed in errocodes-appendix.html; in particular, you
can’ttrap <tt>SUCCESSFUL_COMPLETION</tt>, any of the conditions listed in the <tt>WARNING</tt> category, or any of the
conditionslisted in the <tt>NO DATA</tt> category.  (At least through 8.0 rc1 - I haven't checked in later
versions).<br/><br />         -- Korry  

pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Where do I get the spec for PostgreSQL
Next
From: Simon Riggs
Date:
Subject: Re: [PATCHES] Bgwriter behavior