From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
Cc: | Stanislav Grozev <tacho(at)daemonz(dot)org>, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, pg(at)heroku(dot)com |
Subject: | Re: Incorrect UPDATE trigger invocation in the UPDATE clause of an UPSERT statement. |
Date: | 2015-12-03 12:34:22 |
Message-ID: | CAB7nPqRioCgcGydOV5h1raa21QvYR3EiJVKY7UVdwHx=-KhcUw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Thu, Dec 3, 2015 at 5:19 PM, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
> On 3 December 2015 at 07:30, Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote:
>> On Mon, Nov 30, 2015 at 8:43 PM, Stanislav Grozev wrote:
>>> If we do an UPSERT instead, watch how OLD and NEW are the same (NEW):
>>
>> AFAIK, that's the expected behavior. AFTER UPDATE triggers firing for
>> ON CONFLICT DO UPDATE will see the same NEW and OLD values. Comments
>> from others?
>
> That's not what I would expect. I would expect it to be consistent
> with AFTER triggers firing after a plain UPDATE, and also with BEFORE
> triggers for ON CONFLICT DO UPDATE.
triggers.out is telling that this may be intended to work this way:
WARNING: after update (old): (5,"updated green trig modified")
WARNING: after update (new): (5,"updated green trig modified")
Though I agree that it is not instinctive...
Btw, the patch provided fails on an assertion with regression tests:
2426 /* Determine lock mode to use */
2427 lockmode = ExecUpdateLockMode(estate, relinfo);
2428
-> 2429 Assert(HeapTupleIsValid(fdw_trigtuple) ^
ItemPointerIsValid(tupleid));
2430 if (fdw_trigtuple == NULL)
Peter, Andres, thoughts?
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Verite | 2015-12-03 13:08:41 | Re: Possible bug: ALTER TABLE x DROP COLUMN y "column ... does not exist" then it does |
Previous Message | Marko Tiikkaja | 2015-12-03 12:20:04 | Re: Possible bug: ALTER TABLE x DROP COLUMN y "column ... does not exist" then it does |