Re: Hard problem with concurrency

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Hard problem with concurrency
Date: 2003-02-17 13:41:31
Message-ID: 20030217134131.GA17947@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Feb 16, 2003 at 23:51:49 -0500,
Greg Stark <gsstark(at)mit(dot)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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Haller 2003-02-17 14:45:24 IpcSemaphoreKill: ...) failed: Invalid argument
Previous Message Tatsuo Ishii 2003-02-17 12:44:45 Re: client_encoding directive is ignored in