From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de> |
Cc: | Peter Geoghegan <pg(at)heroku(dot)com>, hlinnaka <hlinnaka(at)iki(dot)fi>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0 |
Date: | 2015-05-01 14:51:36 |
Message-ID: | CA+TgmoayLYzJcKEz-ybBNfQ2kFdf30Wwk9a1Un_gV-Q7WXqtvQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-hackers |
On Fri, May 1, 2015 at 10:49 AM, Andres Freund <andres(at)anarazel(dot)de> wrote:
>> One idea is to decide that an INSERT with an ON CONFLICT UPDATE
>> handler is still an INSERT. Period. So the INSERT triggers run, the
>> UPDATE triggers don't, and that's it.
>
> I think that'd be much worse.
OK. Well, in that case, I guess I'm inclined to think that we
shouldn't throw away the tuple the BEFORE trigger constructs.
> One question, that I was wondering about earlier, that also might
> influence this discussion, is what happens if you change the key we're
> using for resolution during either the BEFORE trigger or the ON CONFLICT
> ... SET. Right now the conflict will be on the version *after* the
> BEFORE INSERT, which I think think is the only reasonable option.
>
> And if you're mad enough to change the key in the ON CONFLICT ... SET
> ... you'll possibly get conflicts. I was, over IM, arguing for that to
> be forbidden to protect users against themselves, but Heikki said people
> might e.g. want to set a column in a key to NULL in that case.
I'm not a big fan of trying to protect users against themselves. I'm
fine with stupid user decisions resulting in errors.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2015-05-01 15:11:29 | Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0 |
Previous Message | Andres Freund | 2015-05-01 14:49:21 | Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0 |
From | Date | Subject | |
---|---|---|---|
Next Message | Euler Taveira | 2015-05-01 14:55:03 | Re: initdb start server recommendation |
Previous Message | Andres Freund | 2015-05-01 14:49:21 | Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0 |