Re: Table A-1. PostgreSQL Error Codes (WITH constants)

Поиск
Список
Период
Сортировка
От philip@utiba.com
Тема Re: Table A-1. PostgreSQL Error Codes (WITH constants)
Дата
Msg-id 49275.192.168.0.49.1133477494.squirrel@support.utiba.melb
обсуждение исходный текст
Ответ на Re: Table A-1. PostgreSQL Error Codes (WITH constants)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-docs
> What exactly is the point of the change at all?

Take a typical line in the table:

Error Code | Meaning
23502      | NOT NULL VIOLATION

Now assume I want to catch this exception in a plpgsql function:

CREATE OR REPLACE FUNCTION foo()
/* boilerplate omitted */

EXCEPTION
    WHEN NOT_NULL_VIOLATION THEN
       RAISE WARNING 'Crikey!';
    WHEN OTHERS THEN
       RAISE NOTICE 'Oh well, [%,%]', SQLSTATE, SQLERRM;

Making the "Meaning" column almost-usable as the exception name is
frustrating. This patch would allow people writing functions to copy and
paste the exception names directly.

It's not a big deal, but it would save some re-typing for people writing a
lot of functions (me, for example).



-----------------
Utiba Pty Ltd
This message has been scanned for viruses and
dangerous content by Utiba mail server and is
believed to be clean.


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Table A-1. PostgreSQL Error Codes (WITH constants)
Следующее
От: kdio@uenf.br
Дата:
Сообщение: Re: Table A-1. PostgreSQL Error Codes (WITH constants)