Re: duplicate key violates unique constraint - Mailing list pgsql-sql

From Teemu Torma
Subject Re: duplicate key violates unique constraint
Date
Msg-id 200802261617.39936.teemu@torma.org
Whole thread Raw
In response to duplicate key violates unique constraint  ("Shavonne Marietta Wijesinghe" <shavonne.marietta@studioform.it>)
List pgsql-sql
On Tuesday 26 February 2008, Shavonne Marietta Wijesinghe wrote:
> During an "INSERT INTO" I get an "Error - duplicate key violates
> unique constraint...."
>
> Is there any way, that i can test the error. Something like this??
>
> IF error = "duplicate key violates unique constraint" then
>     do something
> else
>     insert into
> end if

insert into ...;
exception when unique_violation then do something;

Teemu


pgsql-sql by date:

Previous
From: "Shavonne Marietta Wijesinghe"
Date:
Subject: duplicate key violates unique constraint
Next
From: "Shavonne Marietta Wijesinghe"
Date:
Subject: Re: duplicate key violates unique constraint