Re: Why is unique constraint needed for upsert? - Mailing list pgsql-general

From John R Pierce
Subject Re: Why is unique constraint needed for upsert?
Date
Msg-id 53CFF19A.5050703@hogranch.com
Whole thread Raw
In response to Why is unique constraint needed for upsert?  (Seamus Abshere <seamus@abshere.net>)
Responses Re: Why is unique constraint needed for upsert?
Re: Why is unique constraint needed for upsert?
List 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



pgsql-general by date:

Previous
From: Kalai R
Date:
Subject: Re:
Next
From: Igor Neyman
Date:
Subject: Re: Why is unique constraint needed for upsert?