summaryrefslogtreecommitdiff
path: root/mysql-test/main/insert_update.result
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/main/insert_update.result')
-rw-r--r--mysql-test/main/insert_update.result41
1 files changed, 41 insertions, 0 deletions
diff --git a/mysql-test/main/insert_update.result b/mysql-test/main/insert_update.result
index 68a1003ad85..83344971c59 100644
--- a/mysql-test/main/insert_update.result
+++ b/mysql-test/main/insert_update.result
@@ -412,3 +412,44 @@ select if( @stamp1 = @stamp2, "correct", "wrong");
if( @stamp1 = @stamp2, "correct", "wrong")
correct
drop table t1;
+#
+# MDEV-31164 default current_timestamp() not working when used INSERT ON DUPLICATE KEY in some cases
+#
+set timestamp=unix_timestamp('2000-10-20 0:0:0');
+create table t1 (pk integer primary key, val varchar(20) not null, ts timestamp);
+insert t1 (pk, val) values(1, 'val1');
+select * from t1;
+pk val ts
+1 val1 2000-10-20 00:00:00
+set timestamp=unix_timestamp('2000-10-20 1:0:0');
+insert t1 (pk, val) select 2, 'val3' union select 3, 'val4'
+ on duplicate key update ts=now();
+select * from t1;
+pk val ts
+1 val1 2000-10-20 00:00:00
+2 val3 2000-10-20 01:00:00
+3 val4 2000-10-20 01:00:00
+set timestamp=unix_timestamp('2000-10-20 2:0:0');
+insert t1 (pk, val) select 1, 'val1' union select 4, 'val2'
+ on duplicate key update ts=now();
+select * from t1;
+pk val ts
+1 val1 2000-10-20 02:00:00
+2 val3 2000-10-20 01:00:00
+3 val4 2000-10-20 01:00:00
+4 val2 2000-10-20 02:00:00
+set timestamp=unix_timestamp('2000-10-20 3:0:0');
+insert t1 (pk, val) select 5, 'val1' union select 1, 'val2'
+ on duplicate key update ts=now();
+select * from t1;
+pk val ts
+1 val1 2000-10-20 03:00:00
+2 val3 2000-10-20 01:00:00
+3 val4 2000-10-20 01:00:00
+4 val2 2000-10-20 02:00:00
+5 val1 2000-10-20 03:00:00
+drop table t1;
+set timestamp=default;
+#
+# End of 10.4 tests
+#