1
-- source include/have_innodb.inc
2
-- source suite/innodb/include/have_innodb_plugin.inc
4
let $per_table=`select @@innodb_file_per_table`;
5
let $format=`select @@innodb_file_format`;
6
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
7
set global innodb_file_per_table=off;
8
set global innodb_file_format=`0`;
10
create table t0(a int primary key) engine=innodb row_format=compressed;
11
create table t00(a int primary key) engine=innodb
12
key_block_size=4 row_format=compressed;
13
create table t1(a int primary key) engine=innodb row_format=dynamic;
14
create table t2(a int primary key) engine=innodb row_format=redundant;
15
create table t3(a int primary key) engine=innodb row_format=compact;
16
create table t4(a int primary key) engine=innodb key_block_size=9;
17
create table t5(a int primary key) engine=innodb
18
key_block_size=1 row_format=redundant;
20
set global innodb_file_per_table=on;
21
create table t6(a int primary key) engine=innodb
22
key_block_size=1 row_format=redundant;
23
set global innodb_file_format=`1`;
24
create table t7(a int primary key) engine=innodb
25
key_block_size=1 row_format=redundant;
26
create table t8(a int primary key) engine=innodb
27
key_block_size=1 row_format=fixed;
28
create table t9(a int primary key) engine=innodb
29
key_block_size=1 row_format=compact;
30
create table t10(a int primary key) engine=innodb
31
key_block_size=1 row_format=dynamic;
32
create table t11(a int primary key) engine=innodb
33
key_block_size=1 row_format=compressed;
34
create table t12(a int primary key) engine=innodb
36
create table t13(a int primary key) engine=innodb
37
row_format=compressed;
38
create table t14(a int primary key) engine=innodb key_block_size=9;
40
SELECT table_schema, table_name, row_format
41
FROM information_schema.tables WHERE engine='innodb';
43
drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
44
alter table t1 key_block_size=0;
45
alter table t1 row_format=dynamic;
46
SELECT table_schema, table_name, row_format
47
FROM information_schema.tables WHERE engine='innodb';
48
alter table t1 row_format=compact;
49
SELECT table_schema, table_name, row_format
50
FROM information_schema.tables WHERE engine='innodb';
51
alter table t1 row_format=redundant;
52
SELECT table_schema, table_name, row_format
53
FROM information_schema.tables WHERE engine='innodb';
56
create table t1(a int not null, b text, index(b(10))) engine=innodb
59
create table t2(b text)engine=innodb;
60
insert into t2 values(concat('1abcdefghijklmnopqrstuvwxyz', repeat('A',5000)));
62
insert into t1 select 1, b from t2;
65
connect (a,localhost,root,,);
66
connect (b,localhost,root,,);
70
update t1 set b=repeat('B',100);
73
select a,left(b,40) from t1 natural join t2;
79
select a,left(b,40) from t1 natural join t2;
85
SELECT table_schema, table_name, row_format
86
FROM information_schema.tables WHERE engine='innodb';
89
# The following should fail even in non-strict mode.
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
--error ER_CANT_CREATE_TABLE
177
create table t1 (id int primary key) engine = innodb key_block_size = 0;
180
--error ER_CANT_CREATE_TABLE
181
create table t2 (id int primary key) engine = innodb key_block_size = 9;
185
create table t3 (id int primary key) engine = innodb key_block_size = 1;
186
create table t4 (id int primary key) engine = innodb key_block_size = 2;
187
create table t5 (id int primary key) engine = innodb key_block_size = 4;
188
create table t6 (id int primary key) engine = innodb key_block_size = 8;
189
create table t7 (id int primary key) engine = innodb key_block_size = 16;
191
#check various ROW_FORMAT values.
192
create table t8 (id int primary key) engine = innodb row_format = compressed;
193
create table t9 (id int primary key) engine = innodb row_format = dynamic;
194
create table t10(id int primary key) engine = innodb row_format = compact;
195
create table t11(id int primary key) engine = innodb row_format = redundant;
197
SELECT table_schema, table_name, row_format
198
FROM information_schema.tables WHERE engine='innodb';
199
drop table t3, t4, t5, t6, t7, t8, t9, t10, t11;
201
#test different values of ROW_FORMAT with KEY_BLOCK_SIZE
202
create table t1 (id int primary key) engine = innodb
203
key_block_size = 8 row_format = compressed;
205
--error ER_CANT_CREATE_TABLE
206
create table t2 (id int primary key) engine = innodb
207
key_block_size = 8 row_format = redundant;
210
--error ER_CANT_CREATE_TABLE
211
create table t3 (id int primary key) engine = innodb
212
key_block_size = 8 row_format = compact;
215
--error ER_CANT_CREATE_TABLE
216
create table t4 (id int primary key) engine = innodb
217
key_block_size = 8 row_format = dynamic;
220
--error ER_CANT_CREATE_TABLE
221
create table t5 (id int primary key) engine = innodb
222
key_block_size = 8 row_format = default;
225
SELECT table_schema, table_name, row_format
226
FROM information_schema.tables WHERE engine='innodb';
229
#test multiple errors
230
--error ER_CANT_CREATE_TABLE
231
create table t1 (id int primary key) engine = innodb
232
key_block_size = 9 row_format = redundant;
235
--error ER_CANT_CREATE_TABLE
236
create table t2 (id int primary key) engine = innodb
237
key_block_size = 9 row_format = compact;
240
--error ER_CANT_CREATE_TABLE
241
create table t2 (id int primary key) engine = innodb
242
key_block_size = 9 row_format = dynamic;
245
SELECT table_schema, table_name, row_format
246
FROM information_schema.tables WHERE engine='innodb';
248
#test valid values with innodb_file_per_table unset
249
set global innodb_file_per_table = off;
251
--error ER_CANT_CREATE_TABLE
252
create table t1 (id int primary key) engine = innodb key_block_size = 1;
254
--error ER_CANT_CREATE_TABLE
255
create table t2 (id int primary key) engine = innodb key_block_size = 2;
257
--error ER_CANT_CREATE_TABLE
258
create table t3 (id int primary key) engine = innodb key_block_size = 4;
260
--error ER_CANT_CREATE_TABLE
261
create table t4 (id int primary key) engine = innodb key_block_size = 8;
263
--error ER_CANT_CREATE_TABLE
264
create table t5 (id int primary key) engine = innodb key_block_size = 16;
266
--error ER_CANT_CREATE_TABLE
267
create table t6 (id int primary key) engine = innodb row_format = compressed;
269
--error ER_CANT_CREATE_TABLE
270
create table t7 (id int primary key) engine = innodb row_format = dynamic;
272
create table t8 (id int primary key) engine = innodb row_format = compact;
273
create table t9 (id int primary key) engine = innodb row_format = redundant;
275
SELECT table_schema, table_name, row_format
276
FROM information_schema.tables WHERE engine='innodb';
279
#test valid values with innodb_file_format unset
280
set global innodb_file_per_table = on;
281
set global innodb_file_format = `0`;
283
--error ER_CANT_CREATE_TABLE
284
create table t1 (id int primary key) engine = innodb key_block_size = 1;
286
--error ER_CANT_CREATE_TABLE
287
create table t2 (id int primary key) engine = innodb key_block_size = 2;
289
--error ER_CANT_CREATE_TABLE
290
create table t3 (id int primary key) engine = innodb key_block_size = 4;
292
--error ER_CANT_CREATE_TABLE
293
create table t4 (id int primary key) engine = innodb key_block_size = 8;
295
--error ER_CANT_CREATE_TABLE
296
create table t5 (id int primary key) engine = innodb key_block_size = 16;
298
--error ER_CANT_CREATE_TABLE
299
create table t6 (id int primary key) engine = innodb row_format = compressed;
301
--error ER_CANT_CREATE_TABLE
302
create table t7 (id int primary key) engine = innodb row_format = dynamic;
304
create table t8 (id int primary key) engine = innodb row_format = compact;
305
create table t9 (id int primary key) engine = innodb row_format = redundant;
307
SELECT table_schema, table_name, row_format
308
FROM information_schema.tables WHERE engine='innodb';
311
eval set global innodb_file_per_table=$per_table;
312
eval set global innodb_file_format=$format;
314
# Testing of tablespace tagging
317
set global innodb_file_per_table=on;
318
set global innodb_file_format=`Barracuda`;
319
set global innodb_file_format_check=`Antelope`;
320
create table normal_table (
323
select @@innodb_file_format_check;
324
create table zip_table (
326
) engine = innodb key_block_size = 8;
327
select @@innodb_file_format_check;
328
set global innodb_file_format_check=`Antelope`;
329
select @@innodb_file_format_check;
330
-- disable_result_log
333
select @@innodb_file_format_check;
334
drop table normal_table, zip_table;
335
-- disable_result_log
338
# restore environment to the state it was before this test execution
342
eval set global innodb_file_format=$format;
343
eval set global innodb_file_per_table=$per_table;
344
eval set global innodb_file_format_check=$innodb_file_format_check_orig;