Re: Table A-1. PostgreSQL Error Codes (WITH constants) - Mailing list pgsql-docs

From philip@utiba.com
Subject Re: Table A-1. PostgreSQL Error Codes (WITH constants)
Date
Msg-id 49275.192.168.0.49.1133477494.squirrel@support.utiba.melb
Whole thread Raw
In response to Re: Table A-1. PostgreSQL Error Codes (WITH constants)  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: Table A-1. PostgreSQL Error Codes (WITH constants)
Next
From: kdio@uenf.br
Date:
Subject: Re: Table A-1. PostgreSQL Error Codes (WITH constants)