Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0

From: Andres Freund <andres(at)anarazel(dot)de>
To: Geoff Winkless <pgsqladmin(at)geoff(dot)dj>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0
Date: 2015-05-08 15:51:30
Message-ID: 20150508155130.GN12950@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin 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.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Geoff Winkless 2015-05-08 16:06:06 Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0
Previous Message John Scalia 2015-05-08 15:38:31 Re: [HACKERS] INSERT ... ON CONFLICT UPDATE/IGNORE 4.0

Browse pgsql-hackers by date

  From Date Subject
Next Message Geoff Winkless 2015-05-08 16:06:06 Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0
Previous Message Christian Ullrich 2015-05-08 15:40:52 Re: transforms vs. CLOBBER_CACHE_ALWAYS