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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Trapping errors from pl/perl (trigger) functions
Дата
Msg-id 16470.1183319409@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Trapping errors from pl/perl (trigger) functions  (Wiebe Cazemier <halfgaar@gmx.net>)
Ответы Re: Trapping errors from pl/perl (trigger) functions  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-general
Wiebe Cazemier <halfgaar@gmx.net> 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 the exception generated by the pl/perl function.

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.

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.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Wiebe Cazemier
Дата:
Сообщение: Re: Trapping errors from pl/perl (trigger) functions
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: [pgsql-general] In memory tables/databases