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

From: philip(at)utiba(dot)com
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>, kdio(at)uenf(dot)br, pgsql-docs(at)postgresql(dot)org
Subject: Re: Table A-1. PostgreSQL Error Codes (WITH constants)
Date: 2005-12-01 22:51:34
Message-ID: 49275.192.168.0.49.1133477494.squirrel@support.utiba.melb
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message kdio 2005-12-02 11:30:51 Re: Table A-1. PostgreSQL Error Codes (WITH constants)
Previous Message Tom Lane 2005-12-01 20:57:03 Re: Table A-1. PostgreSQL Error Codes (WITH constants)