Re: UPSERT

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Hannu Krosing <hannu(at)skype(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Jonathan Scher <js(at)oxado(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: UPSERT
Date: 2007-03-04 13:46:58
Message-ID: 20070304134658.GA14429@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Mar 04, 2007 at 14:55:47 +0200,
Hannu Krosing <hannu(at)skype(dot)net> wrote:
>
> UPDATE
> IF NOT FOUND THEN
> INSERT
> IF DUPLICATE KEY THEN
> UPDATE
> END IF
> END IF

I believe it is possible for the above to fail. For example another
transaction could create a matching record between the update and insert
and then another transaction could delete it between the insert and the
second update.

In response to

  • Re: UPSERT at 2007-03-04 12:55:47 from Hannu Krosing

Responses

  • Re: UPSERT at 2007-03-04 13:54:54 from Hannu Krosing
  • Re: UPSERT at 2007-03-04 15:06:05 from Petr Jelinek

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2007-03-04 13:54:54 Re: UPSERT
Previous Message Hannu Krosing 2007-03-04 12:55:47 Re: UPSERT