Debian Codegraph @

mysql-test/suite/innodb/t/instant_alter_null.test

raw
1 --source include/have_innodb.inc
2
3 --disable_query_log
4 SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
5 SET GLOBAL innodb_read_only_compressed=OFF;
6 --enable_query_log
7
8 create table t (a int NOT NULL) engine=innodb row_format= compressed;
9 --error ER_ALTER_OPERATION_NOT_SUPPORTED
10 alter table t modify a int NULL, algorithm=instant;
11
12 --disable_query_log
13 SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
14 --enable_query_log
15
16 drop table t;
17
18 create table t (a int NOT NULL) engine=innodb row_format= dynamic;
19 --error ER_ALTER_OPERATION_NOT_SUPPORTED
20 alter table t modify a int NULL, algorithm=instant;
21 drop table t;
22
23 create table t (a int NOT NULL) engine=innodb row_format= compact;
24 --error ER_ALTER_OPERATION_NOT_SUPPORTED
25 alter table t modify a int NULL, algorithm=instant;
26 drop table t;
27
28 create table t (
29 id int primary key,
30 a int NOT NULL default 0,
31 b int NOT NULL default 0,
32 c int NOT NULL default 0,
33 index idx (a,b,c)
34 ) engine=innodb row_format=redundant;
35
36 --error ER_BAD_NULL_ERROR
37 insert into t (id, a) values (0, NULL);
38 --error ER_BAD_NULL_ERROR
39 insert into t (id, b) values (0, NULL);
40 --error ER_BAD_NULL_ERROR
41 insert into t (id, c) values (0, NULL);
42
43 insert into t values (1,1,1,1);
44
45 set @id = (select table_id from information_schema.innodb_sys_tables
46 where name = 'test/t');
47
48 --replace_column 1 TABLE_ID
49 select * from information_schema.innodb_sys_columns where table_id=@id;
50
51 alter table t modify a int NULL, algorithm=instant;
52 insert into t values (2, NULL, 2, 2);
53
54 alter table t modify b int NULL, algorithm=nocopy;
55 insert into t values (3, NULL, NULL, 3);
56
57 alter table t modify c int NULL, algorithm=inplace;
58 insert into t values (4, NULL, NULL, NULL);
59
60 --replace_column 1 TABLE_ID
61 select * from information_schema.innodb_sys_columns where table_id=@id;
62
63 select * from t;
64
65 check table t;
66
67 drop table t;