1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-12672 Replicated TIMESTAMP fields given wrong value near DST change

Implement a special Copy_field method for timestamps, that copies
timestamps without converting them to MYSQL_TIME (the conversion
is lossy around DST change dates).
This commit is contained in:
Sergei Golubchik
2017-09-19 11:18:45 +02:00
parent 46a2917c0f
commit f4f48e0621
5 changed files with 120 additions and 1 deletions

View File

@ -127,3 +127,26 @@ Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'b' at row 1
DROP TABLE t1;
SET @@global.mysql56_temporal_format=DEFAULT;
set time_zone='Europe/Moscow';
set global mysql56_temporal_format=false;
create table t1 (a timestamp);
set timestamp=1288477526;
insert t1 values (null);
set timestamp=1288481126;
insert t1 values (null);
select a, unix_timestamp(a) from t1;
a unix_timestamp(a)
2010-10-31 02:25:26 1288477526
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 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 1288481126
drop table t1;
set time_zone=DEFAULT;