Re: INSERT ... ON CONFLICT syntax issues

From: Geoff Winkless <pgsqladmin(at)geoff(dot)dj>
To: Stephen Frost <sfrost(at)snowman(dot)net>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: INSERT ... ON CONFLICT syntax issues
Date: 2015-04-28 14:57:07
Message-ID: CAEzk6fcevLR82Sdr8Cd0Tp9XkLbzKSGyNYng7SM+JaT10pWhjw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 28 April 2015 at 15:46, Stephen Frost <sfrost(at)snowman(dot)net> wrote:

> +1, NEW/OLD seem pretty natural and I'm not worried about what they look
> like in rules, and their usage in triggers matches up with what they'd
> mean here, I'd think.
>

Since I've stuck my head above the parapet once I figured I'd give m
y 2p's worth:
​IMHO ​
NEW/OLD doesn't fit at all.

In triggers you're applying it to something that (without the trigger)
would be the new or old version of a matching row
​, so it's completely intuitive​
; in this instance without the ON CONFLICT there would never be a
​"​
new
​"​
, because it would be
​a ​
failure
​​
.
​​

​MySQL uses VALUES(columnname) to reference the intended INSERT value (what
you might term "NEW") and the target name to reference "OLD". I understand
that people might think the bracketed syntax isn't very pleasant because
that looks like a function, but it seems more reasonable than NEW (can we
use VALUES.columname?); finally I don't see why we need an "OLD" (or
TARGET) at all - am I missing the point?

Geoff

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Geoff Winkless 2015-04-28 15:12:11 Re: INSERT ... ON CONFLICT syntax issues
Previous Message David Steele 2015-04-28 14:56:26 Re: Proposal: knowing detail of config files via SQL