1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-6849 ON UPDATE CURRENT_TIMESTAMP doesn't always work

reset default fields not for every modified row, but only once,
at the beginning, as the set of modified fields doesn't change.

exception: INSERT ... ON DUPLICATE KEY UPDATE - the set of fields
does change per row and in that case we reset default fields per row.
This commit is contained in:
Sergei Golubchik
2014-11-13 13:40:11 +01:00
parent 815667086c
commit 6a2c170141
7 changed files with 74 additions and 15 deletions

View File

@ -407,16 +407,29 @@ SELECT * FROM t1;
UPDATE t1 SET c = 2;
SELECT * FROM t1;
--echo #
--echo # Test that ON UPDATE CURRENT_TIMESTAMP works after non-changing UPDATE.
--echo #
--echo # 2011-04-20 09:54:13 UTC
SET TIMESTAMP = 1303293253.794613;
UPDATE t1 SET c = 2, b = '2011-04-20 09:53:41.794613';
SELECT * FROM t1;
UPDATE t1 SET c = 3;
SELECT * FROM t1;
--echo #
--echo # Test of multiple-table UPDATE for ON UPDATE CURRENT_TIMESTAMP
--echo #
--echo # 2011-04-20 15:06:13 UTC
SET TIMESTAMP = 1303311973.534231;
UPDATE t1 t11, t1 t12 SET t11.c = 2;
UPDATE t1 t11, t1 t12 SET t11.c = 3;
SELECT * FROM t1;
UPDATE t1 t11, t1 t12 SET t11.c = 3;
UPDATE t1 t11, t1 t12 SET t11.c = 2;
SELECT * FROM t1;
DROP TABLE t1;