2
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
5
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
7
set @my_time_zone= @@global.time_zone;
8
set timestamp=100000000;
9
create table t1 (t timestamp, n int not null auto_increment, PRIMARY KEY(n));
10
create table t2 (t char(32), n int not null auto_increment, PRIMARY KEY(n));
17
insert into t1 values ('20050101000000', NULL), ('20050611093902',NULL);
18
insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
19
SELECT * FROM t1 ORDER BY n;
25
SELECT * FROM t1 ORDER BY n;
32
set time_zone='Europe/Moscow';
33
insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
34
SELECT * FROM t1 ORDER BY n;
38
set time_zone='Europe/Moscow';
39
SELECT * FROM t1 ORDER BY n;
45
load data infile '../std_data_ln/rpl_timezone2.dat' into table t1;
47
Warning 1265 Data truncated for column 't' at row 1
48
Warning 1261 Row 1 doesn't contain data for all columns
49
Warning 1265 Data truncated for column 't' at row 2
50
Warning 1261 Row 2 doesn't contain data for all columns
51
SELECT * FROM t1 ORDER BY n;
56
SELECT * FROM t1 ORDER BY n;
60
set time_zone='Europe/Moscow';
61
set time_zone='Europe/Moscow';
63
insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
65
insert into t2 (select * from t1);
66
SELECT * FROM t1 ORDER BY n;
69
2004-06-11 07:39:02 10
70
SELECT * FROM t2 ORDER BY n;
73
2004-06-11 07:39:02 10
75
set timestamp=1000072000;
76
insert into t2 values (current_timestamp,NULL), (current_date,NULL), (current_time,NULL);
77
SELECT * FROM t2 ORDER BY n;
79
2001-09-09 23:46:40 11
83
insert into t2 values (from_unixtime(1000000000),NULL),
84
(unix_timestamp('2001-09-09 03:46:40'),NULL);
85
SELECT * FROM t2 ORDER BY n;
87
2001-09-09 03:46:40 14
89
SELECT * FROM t2 ORDER BY n;
91
2001-09-09 03:46:40 14
93
set global time_zone='MET';
96
insert into t2 values(convert_tz('2004-01-01 00:00:00','MET',@@time_zone),NULL);
97
insert into t2 values(convert_tz('2005-01-01 00:00:00','MET','Japan'),NULL);
98
SELECT * FROM t2 ORDER BY n;
100
2003-12-31 23:00:00 16
101
2005-01-01 08:00:00 17
102
SELECT * FROM t2 ORDER BY n;
104
2003-12-31 23:00:00 16
105
2005-01-01 08:00:00 17
107
set global time_zone= @my_time_zone;
109
CREATE TABLE t1 (a INT, b TIMESTAMP);
110
INSERT INTO t1 VALUES (1, NOW());
111
SET @@session.time_zone='Japan';
112
UPDATE t1 SET b= '1970-01-01 08:59:59' WHERE a= 1;
114
Warning 1264 Out of range value for column 'b' at row 1
115
SELECT * FROM t1 ORDER BY a;
117
1 0000-00-00 00:00:00
118
SET @@session.time_zone='Japan';
119
SELECT * FROM t1 ORDER BY a;
121
1 0000-00-00 00:00:00
122
SET @@session.time_zone = default;
124
SET @@session.time_zone = default;