| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
set @my_time_zone= @@global.time_zone; |
| 4 |
set timestamp=100000000; |
| 5 |
create table t1 (t timestamp, n int not null auto_increment, PRIMARY KEY(n)); |
| 6 |
create table t2 (t char(32), n int not null auto_increment, PRIMARY KEY(n)); |
| 7 |
connection slave; |
| 8 |
select @@time_zone; |
| 9 |
@@time_zone |
| 10 |
Japan |
| 11 |
connection master; |
| 12 |
select @@time_zone; |
| 13 |
@@time_zone |
| 14 |
Europe/Moscow |
| 15 |
insert into t1 values ('20050101000000', NULL), ('20050611093902',NULL); |
| 16 |
insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL); |
| 17 |
SELECT * FROM t1 ORDER BY n; |
| 18 |
t n |
| 19 |
2005-01-01 00:00:00 1 |
| 20 |
2005-06-11 09:39:02 2 |
| 21 |
2004-01-01 00:00:00 3 |
| 22 |
2004-06-11 09:39:02 4 |
| 23 |
connection slave; |
| 24 |
SELECT * FROM t1 ORDER BY n; |
| 25 |
t n |
| 26 |
2005-01-01 06:00:00 1 |
| 27 |
2005-06-11 14:39:02 2 |
| 28 |
2004-01-01 06:00:00 3 |
| 29 |
2004-06-11 14:39:02 4 |
| 30 |
connection master; |
| 31 |
delete from t1; |
| 32 |
set time_zone='Europe/Moscow'; |
| 33 |
insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL); |
| 34 |
SELECT * FROM t1 ORDER BY n; |
| 35 |
t n |
| 36 |
2004-01-01 00:00:00 5 |
| 37 |
2004-06-11 09:39:02 6 |
| 38 |
connection slave; |
| 39 |
set time_zone='Europe/Moscow'; |
| 40 |
SELECT * FROM t1 ORDER BY n; |
| 41 |
t n |
| 42 |
2004-01-01 00:00:00 5 |
| 43 |
2004-06-11 09:39:02 6 |
| 44 |
connection master; |
| 45 |
connection master; |
| 46 |
delete from t1; |
| 47 |
set time_zone='UTC'; |
| 48 |
load data infile '../../std_data/rpl_timezone2.dat' ignore into table t1; |
| 49 |
Warnings: |
| 50 |
Warning 1265 Data truncated for column 't' at row 1 |
| 51 |
Warning 1261 Row 1 doesn't contain data for all columns |
| 52 |
Warning 1265 Data truncated for column 't' at row 2 |
| 53 |
Warning 1261 Row 2 doesn't contain data for all columns |
| 54 |
SELECT * FROM t1 ORDER BY n; |
| 55 |
t n |
| 56 |
0000-00-00 00:00:00 7 |
| 57 |
0000-00-00 00:00:00 8 |
| 58 |
connection slave; |
| 59 |
set time_zone='UTC'; |
| 60 |
SELECT * FROM t1 ORDER BY n; |
| 61 |
t n |
| 62 |
0000-00-00 00:00:00 7 |
| 63 |
0000-00-00 00:00:00 8 |
| 64 |
set time_zone='Europe/Moscow'; |
| 65 |
connection master; |
| 66 |
set time_zone='Europe/Moscow'; |
| 67 |
delete from t1; |
| 68 |
insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL); |
| 69 |
set time_zone='MET'; |
| 70 |
insert into t2 (select * from t1); |
| 71 |
SELECT * FROM t1 ORDER BY n; |
| 72 |
t n |
| 73 |
2003-12-31 22:00:00 9 |
| 74 |
2004-06-11 07:39:02 10 |
| 75 |
connection slave; |
| 76 |
SELECT * FROM t2 ORDER BY n; |
| 77 |
t n |
| 78 |
2003-12-31 22:00:00 9 |
| 79 |
2004-06-11 07:39:02 10 |
| 80 |
connection master; |
| 81 |
delete from t2; |
| 82 |
set timestamp=1000072000; |
| 83 |
insert into t2 values (current_timestamp,NULL), (current_date,NULL), (current_time,NULL); |
| 84 |
connection slave; |
| 85 |
SELECT * FROM t2 ORDER BY n; |
| 86 |
t n |
| 87 |
2001-09-09 23:46:40 11 |
| 88 |
2001-09-09 12 |
| 89 |
23:46:40 13 |
| 90 |
connection master; |
| 91 |
delete from t2; |
| 92 |
insert into t2 values (from_unixtime(1000000000),NULL), |
| 93 |
(unix_timestamp('2001-09-09 03:46:40'),NULL); |
| 94 |
SELECT * FROM t2 ORDER BY n; |
| 95 |
t n |
| 96 |
2001-09-09 03:46:40 14 |
| 97 |
1000000000 15 |
| 98 |
connection slave; |
| 99 |
SELECT * FROM t2 ORDER BY n; |
| 100 |
t n |
| 101 |
2001-09-09 03:46:40 14 |
| 102 |
1000000000 15 |
| 103 |
connection master; |
| 104 |
set global time_zone='MET'; |
| 105 |
delete from t2; |
| 106 |
set time_zone='UTC'; |
| 107 |
insert into t2 values(convert_tz('2004-01-01 00:00:00','MET',@@time_zone),NULL); |
| 108 |
insert into t2 values(convert_tz('2005-01-01 00:00:00','MET','Japan'),NULL); |
| 109 |
SELECT * FROM t2 ORDER BY n; |
| 110 |
t n |
| 111 |
2003-12-31 23:00:00 16 |
| 112 |
2005-01-01 08:00:00 17 |
| 113 |
connection slave; |
| 114 |
SELECT * FROM t2 ORDER BY n; |
| 115 |
t n |
| 116 |
2003-12-31 23:00:00 16 |
| 117 |
2005-01-01 08:00:00 17 |
| 118 |
connection master; |
| 119 |
drop table t1, t2; |
| 120 |
connection slave; |
| 121 |
connection master; |
| 122 |
set global time_zone= @my_time_zone; |
| 123 |
End of 4.1 tests |
| 124 |
connection master; |
| 125 |
CREATE TABLE t1 (a INT, b TIMESTAMP); |
| 126 |
INSERT INTO t1 VALUES (1, NOW()); |
| 127 |
SET @@session.time_zone='Japan'; |
| 128 |
UPDATE IGNORE t1 SET b= '1970-01-01 08:59:59' WHERE a= 1; |
| 129 |
SELECT * FROM t1 ORDER BY a; |
| 130 |
a b |
| 131 |
1 0000-00-00 00:00:00 |
| 132 |
connection slave; |
| 133 |
SET @@session.time_zone='Japan'; |
| 134 |
SELECT * FROM t1 ORDER BY a; |
| 135 |
a b |
| 136 |
1 0000-00-00 00:00:00 |
| 137 |
SET @@session.time_zone = default; |
| 138 |
connection master; |
| 139 |
DROP TABLE t1; |
| 140 |
SET @@session.time_zone = default; |
| 141 |
connection slave; |
| 142 |
include/stop_slave.inc |
| 143 |
connection master; |
| 144 |
reset master; |
| 145 |
CREATE TABLE t1 (date timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, a int(11) default NULL); |
| 146 |
SET @@session.time_zone='+01:00'; |
| 147 |
insert into t1 values('2008-12-23 19:39:39',1); |
| 148 |
connection master1; |
| 149 |
SET @@session.time_zone='+02:00'; |
| 150 |
insert delayed into t1 values ('2008-12-23 19:39:39',2); |
| 151 |
flush table t1; |
| 152 |
flush logs; |
| 153 |
select * from t1; |
| 154 |
date a |
| 155 |
2008-12-23 20:39:39 1 |
| 156 |
2008-12-23 19:39:39 2 |
| 157 |
DROP TABLE t1; |
| 158 |
connection master1; |
| 159 |
select * from t1 order by a; |
| 160 |
date a |
| 161 |
2008-12-23 20:39:39 1 |
| 162 |
2008-12-23 19:39:39 2 |
| 163 |
DROP TABLE t1; |
| 164 |
SET @@session.time_zone = default; |
| 165 |
include/rpl_end.inc |
| 166 |
End of 5.0 tests |