1--echo # INPLACE ALTER WITH INPLACE_IGNORE FLAG AND CHANGE CREATE OPTION
2
3--echo # CHANGE THE COLUMN DEFAULT (INPLACE_IGNORE)
4--echo # AND TABLE CHARSET(CHANGE CREATE)
5
6CREATE TABLE t1(
7	id INT PRIMARY KEY,
8	f1 INT NOT NULL DEFAULT 0)ENGINE=INNODB;
9
10INSERT INTO t1 VALUES(1, 2);
11
12let id_before_alter =`SELECT table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name="test/t1"`;
13
14ALTER TABLE t1 MODIFY COLUMN f1 INT NOT NULL DEFAULT 0,
15	       DEFAULT CHARSET=latin1, ALGORITHM=INPLACE;
16
17let id_after_alter =`SELECT table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name="test/t1"`;
18
19if ($id_before_alter != $id_after_alter)
20{
21  --echo "Table rebuild happened";
22}
23
24DROP TABLE t1;
25
26--echo # CHANGE THE STORAGE TYPE OF COLUMN(INPLACE IGNORE)
27--echo # AND TABLE CHARSET(CHANGE CREATE)
28
29CREATE TABLE t1(
30	id INT STORAGE DISK)ENGINE=INNODB;
31
32INSERT INTO t1 values(1);
33
34let id_before_alter =`SELECT table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name="test/t1"`;
35
36ALTER TABLE t1 MODIFY COLUMN id INT STORAGE MEMORY,
37	       DEFAULT CHARSET=latin1, ALGORITHM=INPLACE;
38
39let id_after_alter =`SELECT table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name="test/t1"`;
40
41if ($id_before_alter != $id_after_alter)
42{
43  --echo "Table rebuild happened";
44}
45
46DROP TABLE t1;
47
48--echo # RENAME THE TABLE(INPLACE IGNORE)
49--echo # AND CHANGE TABLE CHARSET(CHANGE CREATE)
50
51CREATE TABLE t1(
52	f1 INT NOT NULL,
53	f2 INT NOT NULL)ENGINE=INNODB;
54
55INSERT INTO t1 VALUES(1, 2);
56
57let id_before_alter =`SELECT table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name="test/t1"`;
58
59ALTER TABLE t1 RENAME t2, DEFAULT CHARSET=latin1, ALGORITHM=INPLACE;
60
61let id_after_alter =`SELECT table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name="test/t2"`;
62
63if ($id_before_alter != $id_after_alter)
64{
65  --echo "Table rebuild happened";
66}
67
68DROP TABLE t2;
69