Re: Errors attempting to insert duplicate values - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Errors attempting to insert duplicate values
Date
Msg-id 393D0881.50782DB1@cupid.suninternet.com
Whole thread Raw
In response to Errors attempting to insert duplicate values  ("Bryan White" <bryan@arcamax.com>)
List pgsql-general
Bryan White wrote:
>
> I have a table with a unique index.  When I go to insert a new value into
> the table my code does not know if the record is already there.  To me there
> are two choices:
>
> 1) Do a select for the record and insert only if not found.
>
> 2) Do a blind insert and relay on the unique index to fail the insert if
> there is a duplicate.

3) Use a sequence to generate unique indicies for you?
--
Martijn van Oosterhout <kleptog@cupid.suninternet.com>
http://cupid.suninternet.com/~kleptog/

pgsql-general by date:

Previous
From: Ed Loehr
Date:
Subject: Re: Vacuum Question
Next
From: Patrick Welche
Date:
Subject: Re: 32KB Tuples