| From: | Igor Neyman <ineyman(at)perceptron(dot)com> |
|---|---|
| To: | John R Pierce <pierce(at)hogranch(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Why is unique constraint needed for upsert? |
| Date: | 2014-07-23 17:39:08 |
| Message-ID: | A76B25F2823E954C9E45E32FA49D70EC919CFAF3@mail.corp.perceptron.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of John R Pierce
Sent: Wednesday, July 23, 2014 1:32 PM
To: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Why is unique constraint needed for upsert?
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
Well, that's exactly why OP prefers Mongo, which doesn't care about such "small" things as ACID.
Regards,
Igor Neyman
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Francisco Olarte | 2014-07-23 18:03:02 | Re: Referencing serial col's sequence for insert |
| Previous Message | John R Pierce | 2014-07-23 17:32:10 | Re: Why is unique constraint needed for upsert? |