Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0 - Mailing list pgsql-hackers

From Andreas Karlsson
Subject Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0
Date
Msg-id 554ABF43.40708@proxel.se
Whole thread Raw
In response to Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0  (Heikki Linnakangas <hlinnaka@iki.fi>)
List pgsql-hackers
On 05/06/2015 09:51 PM, Heikki Linnakangas wrote:
>> So, yes, DO NOTHING does very little - and that is its appeal.
>> Supporting this behavior does not short change those who actually care
>> about the existing tuple sticking around for the duration of their
>> transaction - they have a way of doing that. If you want to document
>> INSERT IGNORE as being primarily an ETL-orientated thing, that would
>> make sense, but let's not hobble that use case.
>
> Yeah, I agree that DO NOTHING should not lock the rows. It might make
> sense to have a DO LOCK variant, which locks the rows, although I don't
> immediately see what the use case would be.

It seems like a very useful feature to me, if you want to upsert 
something into a table with a serial column and get the value of the 
serial column in a RETURNING clause (but not update any fields if there 
is a conflict). Then I am pretty sure I want to lock the row.

Andreas



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Disabling trust/ident authentication configure option
Next
From: Magnus Hagander
Date:
Subject: Re: Disabling trust/ident authentication configure option