Catching internal error ID's to throw custom errors. Is it possib le in PostGreSQL?

From: Stefan(dot)Ardeleanu(at)siveco(dot)ro
To: pgsql-general(at)postgresql(dot)org
Subject: Catching internal error ID's to throw custom errors. Is it possib le in PostGreSQL?
Date: 2005-02-23 10:24:53
Message-ID: E383500F7C4E70448157685481BF824801ACAF92@internets3.main.siveco.ro
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a lot of plpgsql functions and I would like to catch the original
postgresql error and, based on that value, to throw with a raise or
something my custom error. In SQL Server, for example, I have the
sysmessages table in which I have all the possible values if the original
errors. I catch that value (named @@error) and I call a function who have a
parameter this value and who will return my custom value. This kind of error
treatment permit me to have the same error ID's in Oracle, SQL Server and
DB2, using a raise with the same error value. Is it possible to do the same
in PostGreSQL using plpgsql language.
Thanks in advanced.

Stefan Ardeleanu
Database Expert / Business Analyst
SIVECO Romania SA

Business Address: 8-10 Bd. Maresal Averescu
71316 Bucuresti, Sector 1, România
Web: http://www.siveco.ro

Business 1: +40 (21) 224 2531
Business 2: +40 (21) 224 2577
Business Fax: +40 (21) 224 4108

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2005-02-23 10:48:33 Re: Catching internal error ID's to throw custom errors.
Previous Message Terry Lee Tucker 2005-02-23 10:12:30 Re: Simple client messages from within pgPL/SQL