Bug #73290 Unnecessary set via CURRENT_TIMESTAMP in transactions
Submitted: 14 Jul 2014 10:30
Reporter: Marco Rossi Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: Data Types Severity:S4 (Feature request)
Version:5.6 OS:Any
Assigned to: CPU Architecture:Any

[14 Jul 2014 10:30] Marco Rossi
Description:
Unnecessary set via CURRENT_TIMESTAMP in transactions

How to repeat:
Let's say you have a row that is:

id | name | mtime
 1 | test | 2013-02-02 02:02:02

and mtime column has ON UPDATE CURRENT_TIMESTAMP.

I think in this transaction the mtime shouldn't be touched...

START TRANSACTION;
UPDATE mytable SET name = 'something' WHERE id = 1;
...
...
...
UPDATE mytable SET name = 'test' WHERE id = 1;
COMMIT;

...since the row wasn't actually modified at the time of the commit.

Just a cosmetic issue, don't know if makes sense, but I'd have expected the datetime value to remain unchanged since changes are made within a transaction.
[4 Aug 2014 15:49] Hartmut Holzgraefe
Interesting idea, but would it really be worth the effort of tracking/caching all value changes throughout the lifetime of a transaction and compare changes against the list of already performed changes to identify possible "value change reverted later in transaction" situations just for this?

(with InnoDB extra storage/tracking may not be needed as UNDO records could be checked for this, but it would still be quite a bit of effort to check them for previous changes ...