Catching errors - Mailing list pgsql-general

From CSN
Subject Catching errors
Date
Msg-id 20040623225425.64697.qmail@web52905.mail.yahoo.com
Whole thread Raw
Responses Re: Catching errors  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
List pgsql-general
Is it possible to "catch" errors in pl/pgsql? For
example, instead of the function exiting with (from an
INSERT attempt):

ERROR:  duplicate key violates unique constraint
"user_name"
CONTEXT:  PL/pgSQL function "add_user" line 12 at SQL
statement

The function could catch the error, then generate it's
own custom error message:

raise exception ''user name already exists'';

Thanks,
CSN



__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Dump produces file with new line characters
Next
From: Paul Thomas
Date:
Subject: Re: pgHoster.com woes and looking for a new host