3
let $per_table=`select @@innodb_file_per_table`;
4
let $format=`select @@innodb_file_format`;
5
let $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
7
set session innodb_strict_mode=0;
8
set global innodb_file_per_table=off;
9
set global innodb_file_format=`0`;
11
create table t0(a int primary key) engine=innodb row_format=compressed;
12
create table t00(a int primary key) engine=innodb
13
key_block_size=4 row_format=compressed;
14
create table t1(a int primary key) engine=innodb row_format=dynamic;
15
create table t2(a int primary key) engine=innodb row_format=redundant;
16
create table t3(a int primary key) engine=innodb row_format=compact;
17
create table t4(a int primary key) engine=innodb key_block_size=9;
18
create table t5(a int primary key) engine=innodb
19
key_block_size=1 row_format=redundant;
21
set global innodb_file_per_table=on;
22
create table t6(a int primary key) engine=innodb
23
key_block_size=1 row_format=redundant;
24
set global innodb_file_format=`1`;
25
create table t7(a int primary key) engine=innodb
26
key_block_size=1 row_format=redundant;
27
create table t8(a int primary key) engine=innodb
28
key_block_size=1 row_format=fixed;
29
create table t9(a int primary key) engine=innodb
30
key_block_size=1 row_format=compact;
31
create table t10(a int primary key) engine=innodb
32
key_block_size=1 row_format=dynamic;
33
create table t11(a int primary key) engine=innodb
34
key_block_size=1 row_format=compressed;
35
create table t12(a int primary key) engine=innodb
37
create table t13(a int primary key) engine=innodb
38
row_format=compressed;
39
create table t14(a int primary key) engine=innodb key_block_size=9;
41
SELECT table_schema, table_name, row_format, data_length, index_length
42
FROM information_schema.tables WHERE engine='innodb';
44
drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
45
alter table t1 key_block_size=0;
46
alter table t1 row_format=dynamic;
47
SELECT table_schema, table_name, row_format, data_length, index_length
48
FROM information_schema.tables WHERE engine='innodb';
49
alter table t1 row_format=compact;
50
SELECT table_schema, table_name, row_format, data_length, index_length
51
FROM information_schema.tables WHERE engine='innodb';
52
alter table t1 row_format=redundant;
53
SELECT table_schema, table_name, row_format, data_length, index_length
54
FROM information_schema.tables WHERE engine='innodb';
57
create table t1(a int not null, b text, index(b(10))) engine=innodb
60
create table t2(b text)engine=innodb;
61
insert into t2 values(concat('1abcdefghijklmnopqrstuvwxyz', repeat('A',5000)));
63
insert into t1 select 1, b from t2;
66
connect (a,localhost,root,,);
67
connect (b,localhost,root,,);
71
update t1 set b=repeat('B',100);
74
select a,left(b,40) from t1 natural join t2;
80
select a,left(b,40) from t1 natural join t2;
86
SELECT table_schema, table_name, row_format, data_length, index_length
87
FROM information_schema.tables WHERE engine='innodb';
90
# The following should fail in non-strict mode too.
91
# (The fix of Bug #50945 only affects REDUNDANT and COMPACT tables.)
92
SET SESSION innodb_strict_mode = off;
93
--error ER_TOO_BIG_ROWSIZE
95
c TEXT NOT NULL, d TEXT NOT NULL,
96
PRIMARY KEY (c(767),d(767)))
97
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
98
--error ER_TOO_BIG_ROWSIZE
100
c TEXT NOT NULL, d TEXT NOT NULL,
101
PRIMARY KEY (c(767),d(767)))
102
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
104
c TEXT NOT NULL, d TEXT NOT NULL,
105
PRIMARY KEY (c(767),d(767)))
106
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
108
--error ER_TOO_BIG_ROWSIZE
109
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
110
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
111
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438)))
112
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
113
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
117
# Test blob column inheritance (mantis issue#36)
120
create table t1( c1 int not null, c2 blob, c3 blob, c4 blob,
121
primary key(c1, c2(22), c3(22)))
122
engine = innodb row_format = dynamic;
124
insert into t1 values(1, repeat('A', 20000), repeat('B', 20000),
127
update t1 set c3 = repeat('D', 20000) where c1 = 1;
130
# one blob column which is unchanged in update and part of PK
131
# one blob column which is changed and part of of PK
132
# one blob column which is not part of PK and is unchanged
133
select count(*) from t1 where c2 = repeat('A', 20000);
134
select count(*) from t1 where c3 = repeat('D', 20000);
135
select count(*) from t1 where c4 = repeat('C', 20000);
137
update t1 set c3 = repeat('E', 20000) where c1 = 1;
142
# Test innodb_file_format
144
set global innodb_file_format=`0`;
145
select @@innodb_file_format;
146
set global innodb_file_format=`1`;
147
select @@innodb_file_format;
148
set global innodb_file_format=`2`;
149
set global innodb_file_format=`-1`;
150
set global innodb_file_format=`Antelope`;
151
set global innodb_file_format=`Barracuda`;
152
set global innodb_file_format=`Cheetah`;
153
set global innodb_file_format=`abc`;
154
set global innodb_file_format=`1a`;
155
set global innodb_file_format=``;
158
# this does not work anymore, has been removed from mysqltest
160
set global innodb_file_per_table = on;
161
set global innodb_file_format = `1`;
163
set innodb_strict_mode = off;
164
create table t1 (id int primary key) engine = innodb key_block_size = 0;
168
set innodb_strict_mode = on;
170
#Test different values of KEY_BLOCK_SIZE
172
create table t1 (id int primary key) engine = innodb key_block_size = 0;
174
--error ER_CANT_CREATE_TABLE
175
create table t2 (id int primary key) engine = innodb key_block_size = 9;
179
create table t3 (id int primary key) engine = innodb key_block_size = 1;
180
create table t4 (id int primary key) engine = innodb key_block_size = 2;
181
create table t5 (id int primary key) engine = innodb key_block_size = 4;
182
create table t6 (id int primary key) engine = innodb key_block_size = 8;
183
create table t7 (id int primary key) engine = innodb key_block_size = 16;
185
#check various ROW_FORMAT values.
186
create table t8 (id int primary key) engine = innodb row_format = compressed;
187
create table t9 (id int primary key) engine = innodb row_format = dynamic;
188
create table t10(id int primary key) engine = innodb row_format = compact;
189
create table t11(id int primary key) engine = innodb row_format = redundant;
191
SELECT table_schema, table_name, row_format, data_length, index_length
192
FROM information_schema.tables WHERE engine='innodb';
193
drop table t1, t3, t4, t5, t6, t7, t8, t9, t10, t11;
195
#test different values of ROW_FORMAT with KEY_BLOCK_SIZE
196
create table t1 (id int primary key) engine = innodb
197
key_block_size = 8 row_format = compressed;
199
--error ER_CANT_CREATE_TABLE
200
create table t2 (id int primary key) engine = innodb
201
key_block_size = 8 row_format = redundant;
204
--error ER_CANT_CREATE_TABLE
205
create table t3 (id int primary key) engine = innodb
206
key_block_size = 8 row_format = compact;
209
--error ER_CANT_CREATE_TABLE
210
create table t4 (id int primary key) engine = innodb
211
key_block_size = 8 row_format = dynamic;
214
create table t5 (id int primary key) engine = innodb
215
key_block_size = 8 row_format = default;
217
SELECT table_schema, table_name, row_format, data_length, index_length
218
FROM information_schema.tables WHERE engine='innodb';
221
#test multiple errors
222
--error ER_CANT_CREATE_TABLE
223
create table t1 (id int primary key) engine = innodb
224
key_block_size = 9 row_format = redundant;
227
--error ER_CANT_CREATE_TABLE
228
create table t2 (id int primary key) engine = innodb
229
key_block_size = 9 row_format = compact;
232
--error ER_CANT_CREATE_TABLE
233
create table t2 (id int primary key) engine = innodb
234
key_block_size = 9 row_format = dynamic;
237
SELECT table_schema, table_name, row_format, data_length, index_length
238
FROM information_schema.tables WHERE engine='innodb';
240
#test valid values with innodb_file_per_table unset
241
set global innodb_file_per_table = off;
243
--error ER_CANT_CREATE_TABLE
244
create table t1 (id int primary key) engine = innodb key_block_size = 1;
246
--error ER_CANT_CREATE_TABLE
247
create table t2 (id int primary key) engine = innodb key_block_size = 2;
249
--error ER_CANT_CREATE_TABLE
250
create table t3 (id int primary key) engine = innodb key_block_size = 4;
252
--error ER_CANT_CREATE_TABLE
253
create table t4 (id int primary key) engine = innodb key_block_size = 8;
255
--error ER_CANT_CREATE_TABLE
256
create table t5 (id int primary key) engine = innodb key_block_size = 16;
258
--error ER_CANT_CREATE_TABLE
259
create table t6 (id int primary key) engine = innodb row_format = compressed;
261
--error ER_CANT_CREATE_TABLE
262
create table t7 (id int primary key) engine = innodb row_format = dynamic;
264
create table t8 (id int primary key) engine = innodb row_format = compact;
265
create table t9 (id int primary key) engine = innodb row_format = redundant;
267
SELECT table_schema, table_name, row_format, data_length, index_length
268
FROM information_schema.tables WHERE engine='innodb';
271
#test valid values with innodb_file_format unset
272
set global innodb_file_per_table = on;
273
set global innodb_file_format = `0`;
275
--error ER_CANT_CREATE_TABLE
276
create table t1 (id int primary key) engine = innodb key_block_size = 1;
278
--error ER_CANT_CREATE_TABLE
279
create table t2 (id int primary key) engine = innodb key_block_size = 2;
281
--error ER_CANT_CREATE_TABLE
282
create table t3 (id int primary key) engine = innodb key_block_size = 4;
284
--error ER_CANT_CREATE_TABLE
285
create table t4 (id int primary key) engine = innodb key_block_size = 8;
287
--error ER_CANT_CREATE_TABLE
288
create table t5 (id int primary key) engine = innodb key_block_size = 16;
290
--error ER_CANT_CREATE_TABLE
291
create table t6 (id int primary key) engine = innodb row_format = compressed;
293
--error ER_CANT_CREATE_TABLE
294
create table t7 (id int primary key) engine = innodb row_format = dynamic;
296
create table t8 (id int primary key) engine = innodb row_format = compact;
297
create table t9 (id int primary key) engine = innodb row_format = redundant;
299
SELECT table_schema, table_name, row_format, data_length, index_length
300
FROM information_schema.tables WHERE engine='innodb';
303
eval set global innodb_file_per_table=$per_table;
304
eval set global innodb_file_format=$format;
306
# Testing of tablespace tagging
308
set global innodb_file_per_table=on;
309
set global innodb_file_format=`Barracuda`;
310
set global innodb_file_format_max=`Antelope`;
311
create table normal_table (
314
select @@innodb_file_format_max;
315
create table zip_table (
317
) engine = innodb key_block_size = 8;
318
select @@innodb_file_format_max;
319
set global innodb_file_format_max=`Antelope`;
320
select @@innodb_file_format_max;
322
select @@innodb_file_format_max;
323
drop table normal_table, zip_table;
326
# restore environment to the state it was before this test execution
329
eval set global innodb_file_format=$format;
330
eval set global innodb_file_per_table=$per_table;
331
eval set session innodb_strict_mode=$innodb_strict_mode_orig;