Re: Why is unique constraint needed for upsert?

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Why is unique constraint needed for upsert?
Date: 2014-07-23 17:32:10
Message-ID: 53CFF19A.5050703@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 7/23/2014 10:21 AM, Seamus Abshere wrote:
> hi all,
>
> Upsert is usually defined [1] in reference to a violating a unique key:
>
>> Insert, if unique constraint violation then update; or update, if not
>> found then insert.
>
> Is this theoretically preferable to just looking for a row that
> matches certain criteria, updating it if found or inserting otherwise?

what happens when two connections do this more or less concurrently, in
transactions?

--
john r pierce 37N 122W
somewhere on the middle of the left coast

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Igor Neyman 2014-07-23 17:39:08 Re: Why is unique constraint needed for upsert?
Previous Message Kalai R 2014-07-23 17:30:58 Re: