Re: [GENERAL] Trapping errors from pl/perl (trigger) functions

2007-07-01 Thread Wiebe Cazemier
On Sunday 01 July 2007 21:50, Tom Lane wrote: > Why would you expect it to? The raise_exception SQLSTATE applies > specifically and solely to the plpgsql RAISE command. The entire > point of those identifiers is to match fairly narrow classes of > exceptions, not anything thrown by anyone. > >

Re: [GENERAL] Trapping errors from pl/perl (trigger) functions

2007-07-01 Thread Michael Fuhr
On Sun, Jul 01, 2007 at 03:50:09PM -0400, Tom Lane wrote: > IMHO the real problem with both RAISE and the plperl elog command > is there's no way to specify which SQLSTATE to throw. In the case > of the elog command I think you just get a default. That default is XX000 (internal_error): test=> c

Re: [GENERAL] Trapping errors from pl/perl (trigger) functions

2007-07-01 Thread Tom Lane
Wiebe Cazemier <[EMAIL PROTECTED]> writes: > When I do something on the table which the trigger function prevents, I get a > message saying ERROR: blablabla. When such an error is generated by a pl/pgsql > trigger function, I can trap the error with WHEN raise_exception. This does > not work for th

Re: [GENERAL] Trapping errors from pl/perl (trigger) functions

2007-07-01 Thread Wiebe Cazemier
On Sunday 01 July 2007 21:16, Michael Fuhr wrote: > What have you tried and how did the outcome differ from your > expectations? The pl/perl trigger function in question generates an exception by elog(ERROR, "message"). I also tried die(), which didn't make a difference. When I do something on t

Re: [GENERAL] Trapping errors from pl/perl (trigger) functions

2007-07-01 Thread Michael Fuhr
On Sat, Jun 30, 2007 at 10:30:32PM +0200, Wiebe Cazemier wrote: > I have a pl/perl trigger function which can give an error, and I would like to > catch it in a pl/pgsql function, but I can't seem to trap it. What have you tried and how did the outcome differ from your expectations? > Is it possi

[GENERAL] Trapping errors from pl/perl (trigger) functions

2007-06-30 Thread Wiebe Cazemier
Hi, I have a pl/perl trigger function which can give an error, and I would like to catch it in a pl/pgsql function, but I can't seem to trap it. Is it possible to catch errors generated pl/perl functions in a BEGIN ... EXCEPTION WHEN ... END block? Or perhaps in some other way?