1
-- source include/have_innodb.inc
3
let $per_table=`select @@innodb_file_per_table`;
4
let $format=`select @@innodb_file_format`;
5
set global innodb_file_per_table=off;
6
set global innodb_file_format=`0`;
8
create table t0(a int primary key) engine=innodb row_format=compressed;
9
create table t00(a int primary key) engine=innodb
10
key_block_size=4 row_format=compressed;
11
create table t1(a int primary key) engine=innodb row_format=dynamic;
12
create table t2(a int primary key) engine=innodb row_format=redundant;
13
create table t3(a int primary key) engine=innodb row_format=compact;
14
create table t4(a int primary key) engine=innodb key_block_size=9;
15
create table t5(a int primary key) engine=innodb
16
key_block_size=1 row_format=redundant;
18
set global innodb_file_per_table=on;
19
create table t6(a int primary key) engine=innodb
20
key_block_size=1 row_format=redundant;
21
set global innodb_file_format=`1`;
22
create table t7(a int primary key) engine=innodb
23
key_block_size=1 row_format=redundant;
24
create table t8(a int primary key) engine=innodb
25
key_block_size=1 row_format=fixed;
26
create table t9(a int primary key) engine=innodb
27
key_block_size=1 row_format=compact;
28
create table t10(a int primary key) engine=innodb
29
key_block_size=1 row_format=dynamic;
30
create table t11(a int primary key) engine=innodb
31
key_block_size=1 row_format=compressed;
32
create table t12(a int primary key) engine=innodb
34
create table t13(a int primary key) engine=innodb
35
row_format=compressed;
36
create table t14(a int primary key) engine=innodb key_block_size=9;
38
SELECT table_schema, table_name, row_format
39
FROM information_schema.tables WHERE engine='innodb';
41
drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
42
alter table t1 key_block_size=0;
43
alter table t1 row_format=dynamic;
44
SELECT table_schema, table_name, row_format
45
FROM information_schema.tables WHERE engine='innodb';
46
alter table t1 row_format=compact;
47
SELECT table_schema, table_name, row_format
48
FROM information_schema.tables WHERE engine='innodb';
49
alter table t1 row_format=redundant;
50
SELECT table_schema, table_name, row_format
51
FROM information_schema.tables WHERE engine='innodb';
54
create table t1(a int not null, b text, index(b(10))) engine=innodb
57
create table t2(b text)engine=innodb;
58
insert into t2 values(concat('1abcdefghijklmnopqrstuvwxyz', repeat('A',5000)));
60
insert into t1 select 1, b from t2;
63
connect (a,localhost,root,,);
64
connect (b,localhost,root,,);
68
update t1 set b=repeat('B',100);
71
select a,left(b,40) from t1 natural join t2;
77
select a,left(b,40) from t1 natural join t2;
83
SELECT table_schema, table_name, row_format
84
FROM information_schema.tables WHERE engine='innodb';
87
SET SESSION innodb_strict_mode = on;
88
--error ER_TOO_BIG_ROWSIZE
90
c TEXT NOT NULL, d TEXT NOT NULL,
91
PRIMARY KEY (c(767),d(767)))
92
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
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=2 CHARSET=ASCII;
99
c TEXT NOT NULL, d TEXT NOT NULL,
100
PRIMARY KEY (c(767),d(767)))
101
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
103
--error ER_TOO_BIG_ROWSIZE
104
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
105
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
106
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(439)))
107
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
108
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
112
# Test blob column inheritance (mantis issue#36)
115
create table t1( c1 int not null, c2 blob, c3 blob, c4 blob,
116
primary key(c1, c2(22), c3(22)))
117
engine = innodb row_format = dynamic;
119
insert into t1 values(1, repeat('A', 20000), repeat('B', 20000),
122
update t1 set c3 = repeat('D', 20000) where c1 = 1;
125
# one blob column which is unchanged in update and part of PK
126
# one blob column which is changed and part of of PK
127
# one blob column which is not part of PK and is unchanged
128
select count(*) from t1 where c2 = repeat('A', 20000);
129
select count(*) from t1 where c3 = repeat('D', 20000);
130
select count(*) from t1 where c4 = repeat('C', 20000);
132
update t1 set c3 = repeat('E', 20000) where c1 = 1;
137
# Test innodb_file_format
139
set global innodb_file_format=`0`;
140
select @@innodb_file_format;
141
set global innodb_file_format=`1`;
142
select @@innodb_file_format;
143
-- error ER_WRONG_ARGUMENTS
144
set global innodb_file_format=`2`;
145
-- error ER_WRONG_ARGUMENTS
146
set global innodb_file_format=`-1`;
147
set global innodb_file_format=`Antelope`;
148
set global innodb_file_format=`Barracuda`;
149
-- error ER_WRONG_ARGUMENTS
150
set global innodb_file_format=`Cheetah`;
151
-- error ER_WRONG_ARGUMENTS
152
set global innodb_file_format=`abc`;
153
-- error ER_WRONG_ARGUMENTS
154
set global innodb_file_format=`1a`;
155
-- error ER_WRONG_ARGUMENTS
156
set global innodb_file_format=``;
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
--error ER_CANT_CREATE_TABLE
173
create table t1 (id int primary key) engine = innodb key_block_size = 0;
176
--error ER_CANT_CREATE_TABLE
177
create table t2 (id int primary key) engine = innodb key_block_size = 9;
181
create table t3 (id int primary key) engine = innodb key_block_size = 1;
182
create table t4 (id int primary key) engine = innodb key_block_size = 2;
183
create table t5 (id int primary key) engine = innodb key_block_size = 4;
184
create table t6 (id int primary key) engine = innodb key_block_size = 8;
185
create table t7 (id int primary key) engine = innodb key_block_size = 16;
187
#check various ROW_FORMAT values.
188
create table t8 (id int primary key) engine = innodb row_format = compressed;
189
create table t9 (id int primary key) engine = innodb row_format = dynamic;
190
create table t10(id int primary key) engine = innodb row_format = compact;
191
create table t11(id int primary key) engine = innodb row_format = redundant;
193
SELECT table_schema, table_name, row_format
194
FROM information_schema.tables WHERE engine='innodb';
195
drop table t3, t4, t5, t6, t7, t8, t9, t10, t11;
197
#test different values of ROW_FORMAT with KEY_BLOCK_SIZE
198
create table t1 (id int primary key) engine = innodb
199
key_block_size = 8 row_format = compressed;
201
--error ER_CANT_CREATE_TABLE
202
create table t2 (id int primary key) engine = innodb
203
key_block_size = 8 row_format = redundant;
206
--error ER_CANT_CREATE_TABLE
207
create table t3 (id int primary key) engine = innodb
208
key_block_size = 8 row_format = compact;
211
--error ER_CANT_CREATE_TABLE
212
create table t4 (id int primary key) engine = innodb
213
key_block_size = 8 row_format = dynamic;
216
--error ER_CANT_CREATE_TABLE
217
create table t5 (id int primary key) engine = innodb
218
key_block_size = 8 row_format = default;
221
SELECT table_schema, table_name, row_format
222
FROM information_schema.tables WHERE engine='innodb';
225
#test multiple errors
226
--error ER_CANT_CREATE_TABLE
227
create table t1 (id int primary key) engine = innodb
228
key_block_size = 9 row_format = redundant;
231
--error ER_CANT_CREATE_TABLE
232
create table t2 (id int primary key) engine = innodb
233
key_block_size = 9 row_format = compact;
236
--error ER_CANT_CREATE_TABLE
237
create table t2 (id int primary key) engine = innodb
238
key_block_size = 9 row_format = dynamic;
241
SELECT table_schema, table_name, row_format
242
FROM information_schema.tables WHERE engine='innodb';
244
#test valid values with innodb_file_per_table unset
245
set global innodb_file_per_table = off;
247
--error ER_CANT_CREATE_TABLE
248
create table t1 (id int primary key) engine = innodb key_block_size = 1;
250
--error ER_CANT_CREATE_TABLE
251
create table t2 (id int primary key) engine = innodb key_block_size = 2;
253
--error ER_CANT_CREATE_TABLE
254
create table t3 (id int primary key) engine = innodb key_block_size = 4;
256
--error ER_CANT_CREATE_TABLE
257
create table t4 (id int primary key) engine = innodb key_block_size = 8;
259
--error ER_CANT_CREATE_TABLE
260
create table t5 (id int primary key) engine = innodb key_block_size = 16;
262
--error ER_CANT_CREATE_TABLE
263
create table t6 (id int primary key) engine = innodb row_format = compressed;
265
--error ER_CANT_CREATE_TABLE
266
create table t7 (id int primary key) engine = innodb row_format = dynamic;
268
create table t8 (id int primary key) engine = innodb row_format = compact;
269
create table t9 (id int primary key) engine = innodb row_format = redundant;
271
SELECT table_schema, table_name, row_format
272
FROM information_schema.tables WHERE engine='innodb';
275
#test valid values with innodb_file_format unset
276
set global innodb_file_per_table = on;
277
set global innodb_file_format = `0`;
279
--error ER_CANT_CREATE_TABLE
280
create table t1 (id int primary key) engine = innodb key_block_size = 1;
282
--error ER_CANT_CREATE_TABLE
283
create table t2 (id int primary key) engine = innodb key_block_size = 2;
285
--error ER_CANT_CREATE_TABLE
286
create table t3 (id int primary key) engine = innodb key_block_size = 4;
288
--error ER_CANT_CREATE_TABLE
289
create table t4 (id int primary key) engine = innodb key_block_size = 8;
291
--error ER_CANT_CREATE_TABLE
292
create table t5 (id int primary key) engine = innodb key_block_size = 16;
294
--error ER_CANT_CREATE_TABLE
295
create table t6 (id int primary key) engine = innodb row_format = compressed;
297
--error ER_CANT_CREATE_TABLE
298
create table t7 (id int primary key) engine = innodb row_format = dynamic;
300
create table t8 (id int primary key) engine = innodb row_format = compact;
301
create table t9 (id int primary key) engine = innodb row_format = redundant;
303
SELECT table_schema, table_name, row_format
304
FROM information_schema.tables WHERE engine='innodb';
307
eval set global innodb_file_per_table=$per_table;
308
eval set global innodb_file_format=$format;
310
# Testing of tablespace tagging
313
set global innodb_file_per_table=on;
314
set global innodb_file_format=`Barracuda`;
315
set global innodb_file_format_check=`Antelope`;
316
create table normal_table (
319
select @@innodb_file_format_check;
320
create table zip_table (
322
) engine = innodb key_block_size = 8;
323
select @@innodb_file_format_check;
324
set global innodb_file_format_check=`Antelope`;
325
select @@innodb_file_format_check;
326
-- disable_result_log
329
select @@innodb_file_format_check;
330
drop table normal_table, zip_table;
331
-- disable_result_log