Re: INSERT ... ON CONFLICT {UPDATE | IGNORE} - Mailing list pgsql-hackers

From Robert Haas
Subject Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}
Date
Msg-id CA+TgmoYuH=sAa9DrdygQ5+RbVZ4u8hGpue-9E-hwT-CE7kgWhA@mail.gmail.com
Whole thread Raw
In response to Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}  (Josh Berkus <josh@agliodbs.com>)
List pgsql-hackers
On Fri, Oct 24, 2014 at 1:18 PM, Josh Berkus <josh@agliodbs.com> wrote:
> On 10/24/2014 10:04 AM, Robert Haas wrote:
>> As far as syntax goes, I thought the INSERT .. ON CONFLICT UPDATE
>> syntax proposed upthread was the best of any mentioned thus far.  The
>> MERGE-based syntaxes proposed upthread were crazily verbose for no
>> discernable benefit.
>
> For those of us who haven't followed every post in this thread, is there
> somewhere I can see the proposed syntax?

There are a couple of different proposals but this should give you a
feeling for where we're at:

http://www.postgresql.org/message-id/CA+TgmoZN=2AJKi1n4Jz5BkmYi8r_CPUDW+DtoppmTeLVmsOoqw@mail.gmail.com

The part I like is the idea of making UPSERT look like an INSERT
statement with an additional clause that says how a unique violation
should be handled.  The part nobody except Peter likes is using
functional notation like CONFLICTING() or EXCLUDED() to pull in values
from the tuple causing the unique violation.  And there are some other
areas of disagreement about particular keywords and so on.  But I
personally like that general style much more than the alternatives
derived from MERGE.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Florian Pflug
Date:
Subject: Re: Question about RI checks
Next
From: Robert Haas
Date:
Subject: Re: Question about RI checks