Re: exception handling in plpgsql

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Korry <korry(at)starband(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: exception handling in plpgsql
Date: 2005-01-01 18:53:16
Message-ID: 20050101185316.GA12048@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jan 01, 2005 at 10:04:57AM -0500, Korry wrote:

> 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).

src/pl/plpgsql/src/plerrcodes.h contains the following comment:

/* Success and warnings can't be caught, so omit them from table */

Maybe an IF NOT FOUND test could substitute for trapping NO DATA.
As for SUCCESSFUL COMPLETION, it seems reasonable to infer that the
operation was successful if an exception *isn't* raised (for some
definition of "successful" -- additional logic might be necessary).
Or maybe I'm misunderstanding the purpose of trapping these conditions.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-01-01 18:55:10 Re: 'COPY ... FROM' inserts to btree, blocks on buffer writeout
Previous Message Tom Lane 2005-01-01 18:22:58 Re: [HACKERS] Bgwriter behavior