Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0 - Mailing list pgsql-hackers

From Andres Freund
Subject Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0
Date
Msg-id 20150508155130.GN12950@alap3.anarazel.de
Whole thread Raw
In response to Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0  (Geoff Winkless <pgsqladmin@geoff.dj>)
Responses Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0  (Geoff Winkless <pgsqladmin@geoff.dj>)
List pgsql-hackers
On 2015-05-08 16:36:07 +0100, Geoff Winkless wrote:
> Omitted only has one m.
> 
> There's an extra space in "error . (See".
> 
> Otherwise it reads fine to me, although I've only skimmed it.

Thanks, I'll push fixes for those.

> I may have misunderstood: there is only one ON CONFLICT action
> allowed?

Yes.

> I thought the previous version suggested multiple possible targets and
> actions, this suggests that while there can be multiple targets the
> action is always the same.

I don't think any version of the patch included that functionality. I
can see it being useful, but it'd make a bunch of things more
complicated, so I doubt we'll get there for 9.5.

> So I thought I could have
> 
> INSERT INTO distributors (did, dname)
>   ON CONFLICT (did) DO UPDATE dname=target.dname
>   ON CONFLICT (dname) DO NOTHING;
> 
> Did I misunderstand?
> 
> Finally there's no
> 
> INSERT INTO distributors (did, dname)
>   SELECT did, dname FROM otherdists
> ON CONFLICT (did) DO NOTHING;
> 
> example (or similar); do we think people will be smart enough to realise
> that's possible without one?​

Hm. I'm tempted to say that the synopis makes that clear enough.  I
personally never check such examples though, so maybe I'm the wrong
person to judge.



pgsql-hackers by date:

Previous
From: Christian Ullrich
Date:
Subject: Re: transforms vs. CLOBBER_CACHE_ALWAYS
Next
From: Geoff Winkless
Date:
Subject: Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0