Getting exception information (SQLERRM, SQLSTATE, etc.)

Поиск
Список
Период
Сортировка
От Lance Arlaus
Тема Getting exception information (SQLERRM, SQLSTATE, etc.)
Дата
Msg-id 008601c59d37$ed9c4210$6401a8c0@LanceLaptop
обсуждение исходный текст
Ответы Re: Getting exception information (SQLERRM, SQLSTATE, etc.)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice

Is there a way to get information on an exception inside an exception block?

I’ve looked on the net and saw some postings regarding a patch for 8.0 that may or may not be integrated into the main release at this point.

I’m currently running 8.0.3, writing a function using the plpgsql language and have tried several options, albeit unsuccessfully.

I want to enable something like the following:

 

BEGIN

            [ STATEMENT THAT THROWS AN EXCEPTION]

EXCEPTION WHEN OTHERS THEN

            RAISE NOTICE ‘exception (code=%): %’, SQLCODE, SQLERRM;

            [ DO SOMETHING ELSE]

END;

 

Thanks,

Lance

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

Предыдущее
От: Sean Davis
Дата:
Сообщение: Re: Suspend Referential Integrity?
Следующее
От: James Nobles
Дата:
Сообщение: loading data for newb