summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-09-22 01:12:00 +0200
committerSergei Golubchik <serg@mariadb.org>2017-09-22 13:58:00 +0200
commitbc4409ab4ee3729f09151a4d7bdc6d95fdcaa3a1 (patch)
treec4b485a50df1e5ee8608d6d10599b250df65203d /mysql-test
parentf1ce69f3a9c01877c588c28eab9484fba8cd0e56 (diff)
downloadmariadb-git-bc4409ab4ee3729f09151a4d7bdc6d95fdcaa3a1.tar.gz
MDEV-13868 cannot insert 1288481126 in a timestamp column in Europe/Moscow
make insert NULL into a timestamp mark the field as having an explicit value. So that the field won't be assigned the value again in TABLE::update_default_field() make Item_func_now_local::save_in_field(timestamp_field) not to go through MYSQL_TIME - this conversion is lossy around DST change times. This fixes inserting a default value into a timestamp field.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/old-mode.result8
-rw-r--r--mysql-test/t/old-mode.test2
2 files changed, 10 insertions, 0 deletions
diff --git a/mysql-test/r/old-mode.result b/mysql-test/r/old-mode.result
index 61987c398b9..73ad613048a 100644
--- a/mysql-test/r/old-mode.result
+++ b/mysql-test/r/old-mode.result
@@ -132,21 +132,29 @@ set global mysql56_temporal_format=false;
create table t1 (a timestamp);
set timestamp=1288477526;
insert t1 values (null);
+insert t1 values ();
set timestamp=1288481126;
insert t1 values (null);
+insert t1 values ();
select a, unix_timestamp(a) from t1;
a unix_timestamp(a)
2010-10-31 02:25:26 1288477526
+2010-10-31 02:25:26 1288477526
+2010-10-31 02:25:26 1288481126
2010-10-31 02:25:26 1288481126
set global mysql56_temporal_format=true;
select a, unix_timestamp(a) from t1;
a unix_timestamp(a)
2010-10-31 02:25:26 1288477526
+2010-10-31 02:25:26 1288477526
+2010-10-31 02:25:26 1288481126
2010-10-31 02:25:26 1288481126
alter table t1 modify a timestamp;
select a, unix_timestamp(a) from t1;
a unix_timestamp(a)
2010-10-31 02:25:26 1288477526
+2010-10-31 02:25:26 1288477526
+2010-10-31 02:25:26 1288481126
2010-10-31 02:25:26 1288481126
drop table t1;
set global mysql56_temporal_format=false;
diff --git a/mysql-test/t/old-mode.test b/mysql-test/t/old-mode.test
index 3b763ae5158..d7e8ce8ee55 100644
--- a/mysql-test/t/old-mode.test
+++ b/mysql-test/t/old-mode.test
@@ -93,8 +93,10 @@ set global mysql56_temporal_format=false;
create table t1 (a timestamp);
set timestamp=1288477526;
insert t1 values (null);
+insert t1 values ();
set timestamp=1288481126;
insert t1 values (null);
+insert t1 values ();
select a, unix_timestamp(a) from t1;
set global mysql56_temporal_format=true;
select a, unix_timestamp(a) from t1;