| 1 |
--source include/have_innodb.inc |
| 2 |
|
| 3 |
create table t1(f1 int not null, f2 int not null, f3 int not null)engine=innodb; |
| 4 |
insert into t1 values(1, 2, 3),(4, 5, 6); |
| 5 |
alter table t1 drop column f2, algorithm=instant; |
| 6 |
select * from t1; |
| 7 |
insert into t1 values(1,2); |
| 8 |
select * from t1; |
| 9 |
alter table t1 add column f4 int not null default 5, algorithm=instant; |
| 10 |
select * from t1; |
| 11 |
alter table t1 drop column f1, algorithm=instant; |
| 12 |
select * from t1; |
| 13 |
insert into t1 values(7, 9); |
| 14 |
select * from t1; |
| 15 |
alter table t1 add column f5 blob default repeat('aaa', 950), drop column f4, algorithm=instant; |
| 16 |
select * from t1; |
| 17 |
select f3 from t1; |
| 18 |
update t1 set f3 = 10 where f3 > 2; |
| 19 |
select * from t1; |
| 20 |
delete from t1 where f3 = 10; |
| 21 |
show create table t1; |
| 22 |
select f3 from t1; |
| 23 |
update t1 set f5 = 'world'; |
| 24 |
select * from t1; |
| 25 |
drop table t1; |
| 26 |
|
| 27 |
create table t1(f1 int, f2 int not null, index idx(f2))engine=innodb; |
| 28 |
insert into t1 values(1, 2); |
| 29 |
alter table t1 drop column f1, add column f3 varchar(100) default 'thiru', algorithm=instant; |
| 30 |
select * from t1 force index (idx); |
| 31 |
alter table t1 drop column f3, algorithm=instant; |
| 32 |
select * from t1; |
| 33 |
begin; |
| 34 |
insert into t1 values(10); |
| 35 |
select * from t1; |
| 36 |
update t1 set f2 = 100; |
| 37 |
select * from t1; |
| 38 |
delete from t1 where f2 = 100; |
| 39 |
select * from t1; |
| 40 |
rollback; |
| 41 |
select * from t1; |
| 42 |
show create table t1; |
| 43 |
drop table t1; |
| 44 |
|
| 45 |
create table t1(f1 int, f2 int not null)engine=innodb; |
| 46 |
insert into t1 values(1, 2); |
| 47 |
alter table t1 drop column f2, algorithm=instant; |
| 48 |
insert into t1 values(NULL); |
| 49 |
select * from t1; |
| 50 |
drop table t1; |
| 51 |
|
| 52 |
create table t1(f1 int not null, f2 int not null)engine=innodb; |
| 53 |
insert into t1 values(1, 2); |
| 54 |
alter table t1 add column f5 int default 10, algorithm=instant; |
| 55 |
alter table t1 add column f3 int not null default 100, algorithm=instant; |
| 56 |
alter table t1 add column f4 int default 100, drop column f3, algorithm=instant; |
| 57 |
insert into t1 values(2, 3, 20, 100); |
| 58 |
select * from t1; |
| 59 |
drop table t1; |
| 60 |
|
| 61 |
create table t1(f1 int not null, f2 int not null) engine=innodb; |
| 62 |
insert into t1 values(1, 1); |
| 63 |
alter table t1 drop column f2, add column f3 int default 3, algorithm=instant; |
| 64 |
select * from t1; |
| 65 |
update t1 set f3 = 19; |
| 66 |
select * from t1; |
| 67 |
alter table t1 drop column f1, add column f5 tinyint default 10 first, |
| 68 |
algorithm=instant; |
| 69 |
insert into t1 values(4, 10); |
| 70 |
select * from t1; |
| 71 |
|
| 72 |
create table t2(f1 int, f2 int not null) engine=innodb; |
| 73 |
insert into t2(f1, f2) values(1, 2); |
| 74 |
alter table t2 drop column f2, add column f4 varchar(100) default repeat('a', 20), add column f5 int default 10, algorithm=instant; |
| 75 |
select * from t2; |
| 76 |
show create table t2; |
| 77 |
alter table t2 add column f6 char(100) default repeat('a', 99), algorithm=instant; |
| 78 |
|
| 79 |
create table t3(f1 int, f2 int not null)engine=innodb; |
| 80 |
insert into t3 values(1, 2); |
| 81 |
alter table t3 drop column f2, add column f3 int default 1, add column f4 int default 4, algorithm=instant; |
| 82 |
|
| 83 |
create table t4(a varchar(1), b int, c int, primary key(a,b))engine=innodb; |
| 84 |
insert into t4 values('4',5,6); |
| 85 |
alter table t4 drop column c; |
| 86 |
|
| 87 |
--source include/restart_mysqld.inc |
| 88 |
select * from t1; |
| 89 |
alter table t1 add column f6 int default 9,drop column f5, algorithm = instant; |
| 90 |
insert into t1 values(4, 9); |
| 91 |
alter table t1 force, algorithm=inplace; |
| 92 |
select * from t1; |
| 93 |
|
| 94 |
select * from t2; |
| 95 |
alter table t2 force, algorithm=inplace; |
| 96 |
select * from t2; |
| 97 |
show create table t2; |
| 98 |
|
| 99 |
select * from t3; |
| 100 |
alter table t3 add column f5 char(100) default repeat('a', 99), algorithm=instant; |
| 101 |
|
| 102 |
select * from t4; |
| 103 |
alter table t4 add column d varchar(5) default 'fubar'; |
| 104 |
insert into t4 values('',0,'snafu'); |
| 105 |
--source include/restart_mysqld.inc |
| 106 |
select * from t3; |
| 107 |
select * from t4; |
| 108 |
drop table t1,t2,t3,t4; |