Re: Hard problem with concurrency - Mailing list pgsql-hackers

From Bruno Wolff III
Subject Re: Hard problem with concurrency
Date
Msg-id 20030217134131.GA17947@wolff.to
Whole thread Raw
In response to Re: Hard problem with concurrency  (Greg Stark <gsstark@mit.edu>)
List pgsql-hackers
On Sun, Feb 16, 2003 at 23:51:49 -0500, Greg Stark <gsstark@mit.edu> wrote:
> 
> Hm, odd, nobody mentioned this solution:
> 
> If you don't have a primary key already, create a unique index on the
> combination you want to be unique. Then:
> 
> . Try to insert the record
> . If you get a duplicate key error
>   then do update instead

I think this solution depends on records not being deleted. Otherwise
a record could be deleted between the insert attempt and the update attempt.


pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: client_encoding directive is ignored in
Next
From: Christoph Haller
Date:
Subject: IpcSemaphoreKill: ...) failed: Invalid argument