trapping errors in plpgsql?

From: CSN <cool_screen_name90001(at)yahoo(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: trapping errors in plpgsql?
Date: 2005-10-31 22:47:05
Message-ID: 20051031224705.78851.qmail@web52913.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a table like so:
id|username|email

with unique indices on username and email. In a
plpgsql function if an insert fails because of a
duplicate on one of those fields, is it possible to
trap the error, figure out which unique fields it
applies to, and raise a custom error message?

Thanks,
CSN



__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Simon Riggs 2005-10-31 22:56:06 Re: Starting PostgreSQL 8.0.4 with more memory [FreeBSD
Previous Message Scott Marlowe 2005-10-31 22:26:16 Re: Starting PostgreSQL 8.0.4 with more memory [FreeBSD