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:09:53
Message-ID: 20140929220953.GJ2084@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-09-29 15:08:36 -0700, Kevin Grittner wrote:
> Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
> > On 2014-09-29 14:57:45 -0700, Kevin Grittner wrote:
>
> >> The initial implementation could restrict to these exact clauses
> >> and require that the boolean-expression used equality-quals on all
> >> columns of a unique index on only NOT NULL columns.
> >
> > That'll make it really hard to actually implement real MERGE.
> >
> > Because suddenly there's no way for the user to know whether he's
> > written a ON condition that can implement UPSERT like properties
> > (i.e. the *precise* column list of an index) or not.
>
> Well, unless we abandon transactional semantics for other MERGE
> statements, we should have a way that UPSERT logic continues to
> work if you don't match a suitable index; it will just be slower --
> potentially a lot slower, but that's what indexes are for. I don't
> think we need a separate statement type for the one we "do well",
> because I don't think we should do the other one without proper
> transactional semantics.

Wrong. You can't realistically implement the guarantees of UPSERT
without a corresponding UNIQUE index.

Greetings,

Andres Freund

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

In response to

Responses

Browse pgsql-hackers by date

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