Re: INSERT ... ON CONFLICT DO UPDATE with _any_ constraint

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Peter Geoghegan <pg(at)heroku(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Geoff Winkless <pgsqladmin(at)geoff(dot)dj>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: INSERT ... ON CONFLICT DO UPDATE with _any_ constraint
Date: 2015-05-19 21:28:52
Message-ID: CANP8+jJEW6aapVMhTXkibp1Tccz-7PNO=uv6ucfbvrQx4ms7Ww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 19 May 2015 at 17:10, Peter Geoghegan <pg(at)heroku(dot)com> wrote:

> On Tue, May 19, 2015 at 1:57 PM, Simon Riggs <simon(at)2ndquadrant(dot)com>
> wrote:
> > We should allow DO UPDATE to exclude a constraint and apply a
> deterministic
> > order to the constraints. 1. PK if it exists. 2. Replica Identity, when
> not
> > PK, 3. UNIQUE constraints in name order, like triggers, so users can
> define
> > a default evaluation order, just like they do with triggers.
>
> That seems like something way worse than just allowing it for all
> constraints.
>

I'm talking about the evaluation order; it would still match all
constraints, otherwise they wouldn't be constraints.

> 2) Compatibility with MySQL
>
> But what you describe isn't compatible with MySQL. It's totally novel.
>

Upthread you said

"It's trivial to modify Postgres to not require that a specific unique
index be inferred, so that you can omit the inference specification
for DO UPDATE just as you can for DO NOTHING. That would make it work
in a similar way to MySQL"

Similar is good and useful. Full compatibility is even better.

--
Simon Riggs http://www.2ndQuadrant.com/
<http://www.2ndquadrant.com/>
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2015-05-19 21:30:42 Rewriting backup.sgml (patch attached)
Previous Message Andres Freund 2015-05-19 21:23:19 Re: Minor ON CONFLICT related fixes