[MDEV-21287] AFTER UPDATE trigger and ON UPDATE now(): new value <> persisted value Created: 2019-12-11 Updated: 2023-04-27 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Triggers |
| Affects Version/s: | 10.3.18, 10.3.20, 10.3.21, 10.4.10, 10.4.11, 10.5.5 |
| Fix Version/s: | 10.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Pierre-Jean Clement | Assignee: | Oleksandr Byelkin |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux/Debian Buster 10.2 |
||
| Issue Links: |
|
||||||||
| Description |
|
[updated with a more concise example inspired from tests] Summary Steps to reproduce the issue
Expected result
Actual result
Context I've relied on this for years to distinguish updated from non updated rows, including in Mysql, but I skipped a lot of versions. The last working version for me was 10.3.17, and I found out about this when upgrading to 10.3.18 (the current stable Debian packaged version) so this is currently blocking for me. After a chat on irc #maria@freenode I understand it might not be clear what is the expected behavior since it doesn't seem to be documented, but I'll make the case that the NEW value in the trigger should reflect the value that's persisted in the database. Looking forward to reading some feedback on this! |
| Comments |
| Comment by Pierre-Jean Clement [ 2020-01-09 ] |
|
Any thoughts on this? Anyone agrees this behaviour is not desirable? |
| Comment by Jon Armstrong [ 2020-01-09 ] |
|
I agree, as we discussed. For the AFTER UPDATE behavior, the NEW values should reflect the actual values persisted. I'm curious if the change in behavior was intentional or accidental. If intentional, what was the logic behind that decision? |
| Comment by Pierre-Jean Clement [ 2020-01-10 ] |
|
I suspect this might originate from commit c7c481f4d918aaf42cef083b77ab551d69cdae58 as the commit message mentions this :
|
| Comment by Pierre-Jean Clement [ 2020-10-04 ] |
|
This is semantically wrong to consider that BEFORE UPDATE TRIGGER can see values set by ON UPDATE. |
| Comment by Daniel Danek [ 2021-12-07 ] |
|
Same problem in 10.6.5 |