Debian Codegraph @

mysql-test/suite/ndbcluster/row_format.test

raw
1 --source include/have_ndb.inc
2
3 # Tests for CREATE TABLE .. ROW_FORMAT=[DEFAULT|FIXED|DYNAMIC|COMPRESSED|etc.]
4
5 --echo # Create table without specifying ROW_FORMAT, should use default
6 --echo # which is DYNAMIC
7 CREATE TABLE t1_dynamic(
8 a int primary key,
9 b int
10 ) engine = NDB;
11
12 --echo # Create table with ROW_FORMAT=FIXED, should use FIXED
13 CREATE TABLE t2_fixed(
14 a int primary key,
15 b int
16 ) ROW_FORMAT=FIXED engine = NDB;
17
18 --echo # Create table with ROW_FORMAT=DEFAULT, will also use DYNAMIC
19 CREATE TABLE t4_default_dynamic(
20 a int primary key,
21 b int
22 ) ROW_FORMAT=DEFAULT engine = NDB;
23
24 --echo # Show that tables are using the expected row_format
25 SELECT table_name, row_format FROM information_schema.tables
26 WHERE TABLE_SCHEMA = 'test' order by TABLE_NAME;
27
28 --echo #
29 --echo # Check that columns can _not_ be added inplace on a table
30 --echo # which has ROW_FORMAT=FIXED
31 --echo #
32 --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
33 ALTER TABLE t2_fixed
34 algorithm=inplace,
35 ADD COLUMN c int null;
36
37 --echo #
38 --echo # Check that columns can be added inplace on a table
39 --echo # which has ROW_FORMAT=DYNAMIC
40 --echo #
41 ALTER TABLE t1_dynamic
42 algorithm=inplace,
43 ADD COLUMN c int null COLUMN_FORMAT DYNAMIC;
44
45 --echo #
46 --echo # Check that ROW_FORMAT can _not_ be changed with inplace ALTER
47 --echo #
48 --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
49 ALTER TABLE t1_dynamic
50 algorithm=inplace,
51 ROW_FORMAT=FIXED;
52
53 --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
54 ALTER TABLE t2_fixed
55 algorithm=inplace,
56 ROW_FORMAT=DYNAMIC;
57
58 --echo #
59 --echo # Check that ROW_FORMAT can be changed with copying ALTER
60 --echo #
61 --echo # DYNAMIC -> FIXED
62 ALTER TABLE t4_default_dynamic
63 algorithm=copy,
64 ROW_FORMAT=FIXED;
65 let $t4_row_format = `SELECT row_format FROM information_schema.tables
66 WHERE TABLE_NAME='t4_default_dynamic'`;
67 if ($t4_row_format != "Fixed")
68 {
69 echo t4_row_format: $t4_row_format;
70 die Failed to change ROW_FORMAT of t4 to FIXED;
71 }
72
73 --echo # FIXED -> DYNAMIC
74 ALTER TABLE t2_fixed
75 algorithm=copy,
76 ROW_FORMAT=DYNAMIC;
77 let $t2_row_format = `SELECT row_format FROM information_schema.tables
78 WHERE TABLE_NAME='t2_fixed'`;
79 if ($t2_row_format != "Dynamic")
80 {
81 echo t2_row_format: $t2_row_format;
82 die Failed to change ROW_FORMAT of t2 to DYNAMIC;
83 }
84
85 DROP TABLE t1_dynamic,t2_fixed,t4_default_dynamic;
86