Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: Peter Geoghegan <pg(at)heroku(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Craig Ringer <craig(at)2ndquadrant(dot)com>
Subject: Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}
Date: 2014-09-29 22:20:37
Message-ID: 20140929222037.GK2084@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-09-29 15:16:49 -0700, Kevin Grittner wrote:
> Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
>
> > Wrong. You can't realistically implement the guarantees of UPSERT
> > without a corresponding UNIQUE index.
>
> You definitely can do it; the question is what you consider
> reasonable in terms of development effort, performance, and
> concurrency.

Right. You can exclusively lock the table and such. The point is just
that nobody wants that. I.e. people want to be warned about it.

> I think the problem can be solved with non-scary values of pretty much
> any two of those. I guess my assumption is that we won't handle the
> general case until someone wants to put the substantial development
> effort into making the other two acceptable.

Which would be a major loss because MERGE is rather useful outside of
atomic upsert.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2014-09-29 22:21:30 Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}
Previous Message Kevin Grittner 2014-09-29 22:16:49 Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}