1
-- source include/have_innodb_plugin.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 in non-strict mode too.
89
# (The fix of Bug #50945 only affects REDUNDANT and COMPACT tables.)
90
SET SESSION innodb_strict_mode = off;
91
--error ER_TOO_BIG_ROWSIZE
93
c TEXT NOT NULL, d TEXT NOT NULL,
94
PRIMARY KEY (c(767),d(767)))
95
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
96
--error ER_TOO_BIG_ROWSIZE
98
c TEXT NOT NULL, d TEXT NOT NULL,
99
PRIMARY KEY (c(767),d(767)))
100
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
102
c TEXT NOT NULL, d TEXT NOT NULL,
103
PRIMARY KEY (c(767),d(767)))
104
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
106
--error ER_TOO_BIG_ROWSIZE
107
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
108
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
109
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438)))
110
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
111
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
115
# Test blob column inheritance (mantis issue#36)
118
create table t1( c1 int not null, c2 blob, c3 blob, c4 blob,
119
primary key(c1, c2(22), c3(22)))
120
engine = innodb row_format = dynamic;
122
insert into t1 values(1, repeat('A', 20000), repeat('B', 20000),
125
update t1 set c3 = repeat('D', 20000) where c1 = 1;
128
# one blob column which is unchanged in update and part of PK
129
# one blob column which is changed and part of of PK
130
# one blob column which is not part of PK and is unchanged
131
select count(*) from t1 where c2 = repeat('A', 20000);
132
select count(*) from t1 where c3 = repeat('D', 20000);
133
select count(*) from t1 where c4 = repeat('C', 20000);
135
update t1 set c3 = repeat('E', 20000) where c1 = 1;
140
# Test innodb_file_format
142
set global innodb_file_format=`0`;
143
select @@innodb_file_format;
144
set global innodb_file_format=`1`;
145
select @@innodb_file_format;
146
-- error ER_WRONG_ARGUMENTS
147
set global innodb_file_format=`2`;
148
-- error ER_WRONG_ARGUMENTS
149
set global innodb_file_format=`-1`;
150
set global innodb_file_format=`Antelope`;
151
set global innodb_file_format=`Barracuda`;
152
-- error ER_WRONG_ARGUMENTS
153
set global innodb_file_format=`Cheetah`;
154
-- error ER_WRONG_ARGUMENTS
155
set global innodb_file_format=`abc`;
156
-- error ER_WRONG_ARGUMENTS
157
set global innodb_file_format=`1a`;
158
-- error ER_WRONG_ARGUMENTS
159
set global innodb_file_format=``;
162
# this does not work anymore, has been removed from mysqltest
164
set global innodb_file_per_table = on;
165
set global innodb_file_format = `1`;
167
set innodb_strict_mode = off;
168
create table t1 (id int primary key) engine = innodb key_block_size = 0;
172
set innodb_strict_mode = on;
174
#Test different values of KEY_BLOCK_SIZE
176
create table t1 (id int primary key) engine = innodb key_block_size = 0;
178
--error ER_CANT_CREATE_TABLE
179
create table t2 (id int primary key) engine = innodb key_block_size = 9;
183
create table t3 (id int primary key) engine = innodb key_block_size = 1;
184
create table t4 (id int primary key) engine = innodb key_block_size = 2;
185
create table t5 (id int primary key) engine = innodb key_block_size = 4;
186
create table t6 (id int primary key) engine = innodb key_block_size = 8;
187
create table t7 (id int primary key) engine = innodb key_block_size = 16;
189
#check various ROW_FORMAT values.
190
create table t8 (id int primary key) engine = innodb row_format = compressed;
191
create table t9 (id int primary key) engine = innodb row_format = dynamic;
192
create table t10(id int primary key) engine = innodb row_format = compact;
193
create table t11(id int primary key) engine = innodb row_format = redundant;
195
SELECT table_schema, table_name, row_format
196
FROM information_schema.tables WHERE engine='innodb';
197
drop table t1, t3, t4, t5, t6, t7, t8, t9, t10, t11;
199
#test different values of ROW_FORMAT with KEY_BLOCK_SIZE
200
create table t1 (id int primary key) engine = innodb
201
key_block_size = 8 row_format = compressed;
203
--error ER_CANT_CREATE_TABLE
204
create table t2 (id int primary key) engine = innodb
205
key_block_size = 8 row_format = redundant;
208
--error ER_CANT_CREATE_TABLE
209
create table t3 (id int primary key) engine = innodb
210
key_block_size = 8 row_format = compact;
213
--error ER_CANT_CREATE_TABLE
214
create table t4 (id int primary key) engine = innodb
215
key_block_size = 8 row_format = dynamic;
218
create table t5 (id int primary key) engine = innodb
219
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
334
# restore environment to the state it was before this test execution
338
eval set global innodb_file_format=$format;
339
eval set global innodb_file_per_table=$per_table;
340
eval set global innodb_file_format_check=$innodb_file_format_check_orig;