Re: trapping errors in plpgsql?

From: Teguh R <priska(at)hotpop(dot)com>
To: "pgsql-general-unsubscribe(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: trapping errors in plpgsql?
Date: 2005-11-01 08:20:26
Message-ID: 4367254A.1000401@hotpop.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

CSN wrote:

>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
>
>---------------------------(end of broadcast)---------------------------
>TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2005-11-01 08:24:22 Re: after insert or update or delete of col2
Previous Message Michael Fuhr 2005-11-01 07:15:11 Re: How may I keep prepended array items positive?