Re: exception handling in plpgsql

From: Korry <korry(at)starband(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: exception handling in plpgsql
Date: 2005-01-01 15:04:57
Message-ID: 1104591897.11849.4.camel@sakai
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> I am using the following sytex to handle exceptions in
> plpgsql (I am using postgres 8 rc1)
>
> ....some code ........
>
> EXCEPTION
> WHEN NO_DATA THEN
> RAISE NOTICE 'NO DATA';
> WHEN OTHERS THEN
> RAISE NOTICE 'An exception occurred';
> RETURN emp_rec;
>
> and i receive the following error
> ERROR: unrecognized exception condition "no_data"
>
> How can i rectify this error?

It seems you can’t trap every condition listed in errocodes-
appendix.html; in particular, you can’t trap SUCCESSFUL_COMPLETION, any
of the conditions listed in the WARNING category, or any of the
conditions listed in the NO DATA category. (At least through 8.0 rc1 -
I haven't checked in later versions).

-- Korry

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2005-01-01 15:43:55 Re: [HACKERS] Bgwriter behavior
Previous Message Jeff Davis 2005-01-01 14:33:38 Re: Where do I get the spec for PostgreSQL