From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, Peter Geoghegan <pg(at)heroku(dot)com>, hlinnaka <hlinnaka(at)iki(dot)fi>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, 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 15:11:29 |
Message-ID: | 20150501151129.GI30322@tamriel.snowman.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-hackers |
* Robert Haas (robertmhaas(at)gmail(dot)com) wrote:
> OK. In that case, I'm a lot less sure what the right decision is. It
> seems weird for both the BEFORE INSERT and BEFORE UPDATE triggers to
> get a crack at the same tuple, so your way might be better after all.
> But on the other hand, the BEFORE INSERT trigger might have had side
> effects, so we can't just pretend it didn't happen.
I agree that having the before-insert and before-update triggers both
fire is a bit odd, but I also think it's the right thing to do. If the
statements were independent instead of an INSERT .. ON CONFLICT, then
both sets of before triggers would very clearly fire.
> 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.
Another option would be to have an independent "INSERT-ON-CONFLICT"
before trigger which fires.. but, for my 2c, I'm happy to just fire
both.
I definitely feel that the EXCLUDED tuple should refer to the post
before-insert trigger; having it refer to a tuple that may not have
actually conflicted doesn't seem correct to me.
Thanks!
Stephen
From | Date | Subject | |
---|---|---|---|
Next Message | Susan K. McClure | 2015-05-01 15:16:21 | pg_dump and pg_restore with multiple streams does Not seem to improve overall times |
Previous Message | Robert Haas | 2015-05-01 14:51:36 | Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0 |
From | Date | Subject | |
---|---|---|---|
Next Message | Fabrízio de Royes Mello | 2015-05-01 15:18:59 | Re: cache invalidation for PL/pgsql functions |
Previous Message | Andrew Dunstan | 2015-05-01 15:09:13 | Re: initdb start server recommendation |