1
-- source include/have_innodb.inc
3
let $per_table=`select @@innodb_file_per_table`;
4
let $format=`select @@innodb_file_format`;
5
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
6
set global innodb_file_per_table=off;
7
set global innodb_file_format=`0`;
9
create table t0(a int primary key) engine=innodb row_format=compressed;
10
create table t00(a int primary key) engine=innodb
11
key_block_size=4 row_format=compressed;
12
create table t1(a int primary key) engine=innodb row_format=dynamic;
13
create table t2(a int primary key) engine=innodb row_format=redundant;
14
create table t3(a int primary key) engine=innodb row_format=compact;
15
create table t4(a int primary key) engine=innodb key_block_size=9;
16
create table t5(a int primary key) engine=innodb
17
key_block_size=1 row_format=redundant;
19
set global innodb_file_per_table=on;
20
create table t6(a int primary key) engine=innodb
21
key_block_size=1 row_format=redundant;
22
set global innodb_file_format=`1`;
23
create table t7(a int primary key) engine=innodb
24
key_block_size=1 row_format=redundant;
25
create table t8(a int primary key) engine=innodb
26
key_block_size=1 row_format=fixed;
27
create table t9(a int primary key) engine=innodb
28
key_block_size=1 row_format=compact;
29
create table t10(a int primary key) engine=innodb
30
key_block_size=1 row_format=dynamic;
31
create table t11(a int primary key) engine=innodb
32
key_block_size=1 row_format=compressed;
33
create table t12(a int primary key) engine=innodb
35
create table t13(a int primary key) engine=innodb
36
row_format=compressed;
37
create table t14(a int primary key) engine=innodb key_block_size=9;
39
SELECT table_schema, table_name, row_format
40
FROM information_schema.tables WHERE engine='innodb';
42
drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
43
alter table t1 key_block_size=0;
44
alter table t1 row_format=dynamic;
45
SELECT table_schema, table_name, row_format
46
FROM information_schema.tables WHERE engine='innodb';
47
alter table t1 row_format=compact;
48
SELECT table_schema, table_name, row_format
49
FROM information_schema.tables WHERE engine='innodb';
50
alter table t1 row_format=redundant;
51
SELECT table_schema, table_name, row_format
52
FROM information_schema.tables WHERE engine='innodb';
55
create table t1(a int not null, b text, index(b(10))) engine=innodb
58
create table t2(b text)engine=innodb;
59
insert into t2 values(concat('1abcdefghijklmnopqrstuvwxyz', repeat('A',5000)));
61
insert into t1 select 1, b from t2;
64
connect (a,localhost,root,,);
65
connect (b,localhost,root,,);
69
update t1 set b=repeat('B',100);
72
select a,left(b,40) from t1 natural join t2;
78
select a,left(b,40) from t1 natural join t2;
84
SELECT table_schema, table_name, row_format
85
FROM information_schema.tables WHERE engine='innodb';
88
# The following should fail even in non-strict mode.
89
SET SESSION innodb_strict_mode = off;
90
--error ER_TOO_BIG_ROWSIZE
92
c TEXT NOT NULL, d TEXT NOT NULL,
93
PRIMARY KEY (c(767),d(767)))
94
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
95
--error ER_TOO_BIG_ROWSIZE
97
c TEXT NOT NULL, d TEXT NOT NULL,
98
PRIMARY KEY (c(767),d(767)))
99
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
101
c TEXT NOT NULL, d TEXT NOT NULL,
102
PRIMARY KEY (c(767),d(767)))
103
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
105
--error ER_TOO_BIG_ROWSIZE
106
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
107
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
108
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(439)))
109
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
110
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
114
# Test blob column inheritance (mantis issue#36)
117
create table t1( c1 int not null, c2 blob, c3 blob, c4 blob,
118
primary key(c1, c2(22), c3(22)))
119
engine = innodb row_format = dynamic;
121
insert into t1 values(1, repeat('A', 20000), repeat('B', 20000),
124
update t1 set c3 = repeat('D', 20000) where c1 = 1;
127
# one blob column which is unchanged in update and part of PK
128
# one blob column which is changed and part of of PK
129
# one blob column which is not part of PK and is unchanged
130
select count(*) from t1 where c2 = repeat('A', 20000);
131
select count(*) from t1 where c3 = repeat('D', 20000);
132
select count(*) from t1 where c4 = repeat('C', 20000);
134
update t1 set c3 = repeat('E', 20000) where c1 = 1;
139
# Test innodb_file_format
141
set global innodb_file_format=`0`;
142
select @@innodb_file_format;
143
set global innodb_file_format=`1`;
144
select @@innodb_file_format;
145
-- error ER_WRONG_ARGUMENTS
146
set global innodb_file_format=`2`;
147
-- error ER_WRONG_ARGUMENTS
148
set global innodb_file_format=`-1`;
149
set global innodb_file_format=`Antelope`;
150
set global innodb_file_format=`Barracuda`;
151
-- error ER_WRONG_ARGUMENTS
152
set global innodb_file_format=`Cheetah`;
153
-- error ER_WRONG_ARGUMENTS
154
set global innodb_file_format=`abc`;
155
-- error ER_WRONG_ARGUMENTS
156
set global innodb_file_format=`1a`;
157
-- error ER_WRONG_ARGUMENTS
158
set global innodb_file_format=``;
161
# this does not work anymore, has been removed from mysqltest
163
set global innodb_file_per_table = on;
164
set global innodb_file_format = `1`;
166
set innodb_strict_mode = off;
167
create table t1 (id int primary key) engine = innodb key_block_size = 0;
171
set innodb_strict_mode = on;
173
#Test different values of KEY_BLOCK_SIZE
175
--error ER_CANT_CREATE_TABLE
176
create table t1 (id int primary key) engine = innodb key_block_size = 0;
179
--error ER_CANT_CREATE_TABLE
180
create table t2 (id int primary key) engine = innodb key_block_size = 9;
184
create table t3 (id int primary key) engine = innodb key_block_size = 1;
185
create table t4 (id int primary key) engine = innodb key_block_size = 2;
186
create table t5 (id int primary key) engine = innodb key_block_size = 4;
187
create table t6 (id int primary key) engine = innodb key_block_size = 8;
188
create table t7 (id int primary key) engine = innodb key_block_size = 16;
190
#check various ROW_FORMAT values.
191
create table t8 (id int primary key) engine = innodb row_format = compressed;
192
create table t9 (id int primary key) engine = innodb row_format = dynamic;
193
create table t10(id int primary key) engine = innodb row_format = compact;
194
create table t11(id int primary key) engine = innodb row_format = redundant;
196
SELECT table_schema, table_name, row_format
197
FROM information_schema.tables WHERE engine='innodb';
198
drop table t3, t4, t5, t6, t7, t8, t9, t10, t11;
200
#test different values of ROW_FORMAT with KEY_BLOCK_SIZE
201
create table t1 (id int primary key) engine = innodb
202
key_block_size = 8 row_format = compressed;
204
--error ER_CANT_CREATE_TABLE
205
create table t2 (id int primary key) engine = innodb
206
key_block_size = 8 row_format = redundant;
209
--error ER_CANT_CREATE_TABLE
210
create table t3 (id int primary key) engine = innodb
211
key_block_size = 8 row_format = compact;
214
--error ER_CANT_CREATE_TABLE
215
create table t4 (id int primary key) engine = innodb
216
key_block_size = 8 row_format = dynamic;
219
--error ER_CANT_CREATE_TABLE
220
create table t5 (id int primary key) engine = innodb
221
key_block_size = 8 row_format = default;
224
SELECT table_schema, table_name, row_format
225
FROM information_schema.tables WHERE engine='innodb';
228
#test multiple errors
229
--error ER_CANT_CREATE_TABLE
230
create table t1 (id int primary key) engine = innodb
231
key_block_size = 9 row_format = redundant;
234
--error ER_CANT_CREATE_TABLE
235
create table t2 (id int primary key) engine = innodb
236
key_block_size = 9 row_format = compact;
239
--error ER_CANT_CREATE_TABLE
240
create table t2 (id int primary key) engine = innodb
241
key_block_size = 9 row_format = dynamic;
244
SELECT table_schema, table_name, row_format
245
FROM information_schema.tables WHERE engine='innodb';
247
#test valid values with innodb_file_per_table unset
248
set global innodb_file_per_table = off;
250
--error ER_CANT_CREATE_TABLE
251
create table t1 (id int primary key) engine = innodb key_block_size = 1;
253
--error ER_CANT_CREATE_TABLE
254
create table t2 (id int primary key) engine = innodb key_block_size = 2;
256
--error ER_CANT_CREATE_TABLE
257
create table t3 (id int primary key) engine = innodb key_block_size = 4;
259
--error ER_CANT_CREATE_TABLE
260
create table t4 (id int primary key) engine = innodb key_block_size = 8;
262
--error ER_CANT_CREATE_TABLE
263
create table t5 (id int primary key) engine = innodb key_block_size = 16;
265
--error ER_CANT_CREATE_TABLE
266
create table t6 (id int primary key) engine = innodb row_format = compressed;
268
--error ER_CANT_CREATE_TABLE
269
create table t7 (id int primary key) engine = innodb row_format = dynamic;
271
create table t8 (id int primary key) engine = innodb row_format = compact;
272
create table t9 (id int primary key) engine = innodb row_format = redundant;
274
SELECT table_schema, table_name, row_format
275
FROM information_schema.tables WHERE engine='innodb';
278
#test valid values with innodb_file_format unset
279
set global innodb_file_per_table = on;
280
set global innodb_file_format = `0`;
282
--error ER_CANT_CREATE_TABLE
283
create table t1 (id int primary key) engine = innodb key_block_size = 1;
285
--error ER_CANT_CREATE_TABLE
286
create table t2 (id int primary key) engine = innodb key_block_size = 2;
288
--error ER_CANT_CREATE_TABLE
289
create table t3 (id int primary key) engine = innodb key_block_size = 4;
291
--error ER_CANT_CREATE_TABLE
292
create table t4 (id int primary key) engine = innodb key_block_size = 8;
294
--error ER_CANT_CREATE_TABLE
295
create table t5 (id int primary key) engine = innodb key_block_size = 16;
297
--error ER_CANT_CREATE_TABLE
298
create table t6 (id int primary key) engine = innodb row_format = compressed;
300
--error ER_CANT_CREATE_TABLE
301
create table t7 (id int primary key) engine = innodb row_format = dynamic;
303
create table t8 (id int primary key) engine = innodb row_format = compact;
304
create table t9 (id int primary key) engine = innodb row_format = redundant;
306
SELECT table_schema, table_name, row_format
307
FROM information_schema.tables WHERE engine='innodb';
310
eval set global innodb_file_per_table=$per_table;
311
eval set global innodb_file_format=$format;
313
# Testing of tablespace tagging
316
set global innodb_file_per_table=on;
317
set global innodb_file_format=`Barracuda`;
318
set global innodb_file_format_check=`Antelope`;
319
create table normal_table (
322
select @@innodb_file_format_check;
323
create table zip_table (
325
) engine = innodb key_block_size = 8;
326
select @@innodb_file_format_check;
327
set global innodb_file_format_check=`Antelope`;
328
select @@innodb_file_format_check;
329
-- disable_result_log
332
select @@innodb_file_format_check;
333
drop table normal_table, zip_table;
334
-- disable_result_log
337
# restore environment to the state it was before this test execution
341
eval set global innodb_file_format=$format;
342
eval set global innodb_file_per_table=$per_table;
343
eval set global innodb_file_format_check=$innodb_file_format_check_orig;