Re: Errors attempting to insert duplicate values

Martijn van Oosterhout <kleptog@cupid.suninternet.com>

From: Martijn van Oosterhout <kleptog@cupid.suninternet.com>
To: Bryan White <bryan@arcamax.com>
Cc: pgsql-general <pgsql-general@postgreSQL.org>
Date: 2000-06-06T14:19:45Z
Lists: 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/