Re: INSERT ... ON CONFLICT syntax issues - Mailing list pgsql-hackers

From Geoff Winkless
Subject Re: INSERT ... ON CONFLICT syntax issues
Date
Msg-id CAEzk6fcevLR82Sdr8Cd0Tp9XkLbzKSGyNYng7SM+JaT10pWhjw@mail.gmail.com
Whole thread Raw
In response to Re: INSERT ... ON CONFLICT syntax issues  (Stephen Frost <sfrost@snowman.net>)
Responses Re: INSERT ... ON CONFLICT syntax issues
List pgsql-hackers
On 28 April 2015 at 15:46, Stephen Frost <sfrost@snowman.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


pgsql-hackers by date:

Previous
From: David Steele
Date:
Subject: Re: Proposal: knowing detail of config files via SQL
Next
From: Geoff Winkless
Date:
Subject: Re: INSERT ... ON CONFLICT syntax issues