| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
use test; |
| 4 |
create table t1 (id int primary key, c1 int default 10, c2 varchar(20) default 'holiday') engine = innodb; |
| 5 |
insert into t1 values(1, 12345, 'abcde'), (2, default, default), (3, 23456, 'xyzab'); |
| 6 |
set time_zone='+03:00'; |
| 7 |
set timestamp = 1; |
| 8 |
alter table t1 add column d1 timestamp not null default current_timestamp; |
| 9 |
select * from t1; |
| 10 |
id c1 c2 d1 |
| 11 |
1 12345 abcde 1970-01-01 03:00:01 |
| 12 |
2 10 holiday 1970-01-01 03:00:01 |
| 13 |
3 23456 xyzab 1970-01-01 03:00:01 |
| 14 |
connection slave; |
| 15 |
connection slave; |
| 16 |
set time_zone='+03:00'; |
| 17 |
select * from t1; |
| 18 |
id c1 c2 d1 |
| 19 |
1 12345 abcde 1970-01-01 03:00:01 |
| 20 |
2 10 holiday 1970-01-01 03:00:01 |
| 21 |
3 23456 xyzab 1970-01-01 03:00:01 |
| 22 |
connection master; |
| 23 |
alter table t1 add column d2 timestamp not null default current_timestamp, ALGORITHM=copy; |
| 24 |
connection slave; |
| 25 |
connection slave; |
| 26 |
select * from t1; |
| 27 |
id c1 c2 d1 d2 |
| 28 |
1 12345 abcde 1970-01-01 03:00:01 1970-01-01 03:00:01 |
| 29 |
2 10 holiday 1970-01-01 03:00:01 1970-01-01 03:00:01 |
| 30 |
3 23456 xyzab 1970-01-01 03:00:01 1970-01-01 03:00:01 |
| 31 |
connection master; |
| 32 |
drop table t1; |
| 33 |
create table t4 (id int primary key, c2 int); |
| 34 |
insert into t4 values(1,1),(2,2),(3,3); |
| 35 |
set timestamp = 1000; |
| 36 |
alter table t4 add column (c3 datetime default current_timestamp(), c4 timestamp not null default current_timestamp()); |
| 37 |
select * from t4; |
| 38 |
id c2 c3 c4 |
| 39 |
1 1 1970-01-01 03:16:40 1970-01-01 03:16:40 |
| 40 |
2 2 1970-01-01 03:16:40 1970-01-01 03:16:40 |
| 41 |
3 3 1970-01-01 03:16:40 1970-01-01 03:16:40 |
| 42 |
alter table t4 add column c5 time not null default current_timestamp(); |
| 43 |
Warnings: |
| 44 |
Note 1265 Data truncated for column 'c5' at row 1 |
| 45 |
Note 1265 Data truncated for column 'c5' at row 2 |
| 46 |
Note 1265 Data truncated for column 'c5' at row 3 |
| 47 |
alter table t4 add column c6 date not null default current_timestamp(); |
| 48 |
Warnings: |
| 49 |
Note 1265 Data truncated for column 'c6' at row 1 |
| 50 |
Note 1265 Data truncated for column 'c6' at row 2 |
| 51 |
Note 1265 Data truncated for column 'c6' at row 3 |
| 52 |
select * from t4; |
| 53 |
id c2 c3 c4 c5 c6 |
| 54 |
1 1 1970-01-01 03:16:40 1970-01-01 03:16:40 03:16:40 1970-01-01 |
| 55 |
2 2 1970-01-01 03:16:40 1970-01-01 03:16:40 03:16:40 1970-01-01 |
| 56 |
3 3 1970-01-01 03:16:40 1970-01-01 03:16:40 03:16:40 1970-01-01 |
| 57 |
connection slave; |
| 58 |
connection slave; |
| 59 |
select * from t4; |
| 60 |
id c2 c3 c4 c5 c6 |
| 61 |
1 1 1970-01-01 03:16:40 1970-01-01 03:16:40 03:16:40 1970-01-01 |
| 62 |
2 2 1970-01-01 03:16:40 1970-01-01 03:16:40 03:16:40 1970-01-01 |
| 63 |
3 3 1970-01-01 03:16:40 1970-01-01 03:16:40 03:16:40 1970-01-01 |
| 64 |
connection master; |
| 65 |
drop table t4; |
| 66 |
include/rpl_end.inc |