Commit 8763d941 authored by marko's avatar marko

branches/zip: innodb-index.test: Make the column b much longer, to hit

the 65,535-byte VARCHAR length limit of MySQL.
parent 1fabfe9c
......@@ -1012,21 +1012,21 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index
drop table t1;
create table t1(a int, b blob, c text, d text not null) engine=innodb default charset = utf8;
insert into t1 values (22,repeat('jejdkrun87',220),repeat('jejdkrun87',440),'jejdkrun87');
insert into t1 values (44,repeat('adfd72nh9k',440),repeat('adfd72nh9k',880),'adfd72nh9k');
insert into t1 values (22,repeat('jejdkrun87',2200),repeat('jejdkrun87',440),'jejdkrun87');
insert into t1 values (44,repeat('adfd72nh9k',4400),repeat('adfd72nh9k',880),'adfd72nh9k');
insert into t1 values (null,null,null,'null');
select count(*) from t1 where a=44;
count(*)
1
select a,b=repeat(d,10*a),c=repeat(d,20*a) from t1;
a b=repeat(d,10*a) c=repeat(d,20*a)
select a,b=repeat(d,100*a),c=repeat(d,20*a) from t1;
a b=repeat(d,100*a) c=repeat(d,20*a)
22 1 1
44 1 1
NULL NULL NULL
select a,length(b),length(c),d from t1;
a length(b) length(c) d
22 2200 4400 jejdkrun87
44 4400 8800 adfd72nh9k
22 22000 4400 jejdkrun87
44 44000 8800 adfd72nh9k
NULL NULL NULL null
alter table t1 add primary key (a), add key (b(20));
ERROR 42000: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead
......@@ -1035,17 +1035,21 @@ alter table t1 add primary key (a), add key (b(20));
select count(*) from t1 where a=44;
count(*)
1
select a,b=repeat(d,10*a),c=repeat(d,20*a) from t1;
a b=repeat(d,10*a) c=repeat(d,20*a)
select a,b=repeat(d,100*a),c=repeat(d,20*a) from t1;
a b=repeat(d,100*a) c=repeat(d,20*a)
22 1 1
44 1 1
select a,length(b),length(c),d from t1;
a length(b) length(c) d
22 2200 4400 jejdkrun87
44 4400 8800 adfd72nh9k
insert into t1 values (33,repeat('adfdpplkeock',330),repeat('adfdpplkeock',660),'adfdpplkeock');
insert into t1 values (55,repeat('adfdijnmnb78k',550),repeat('adfdijnmnb78k',1100),'adfdijnmnb78k');
insert into t1 values (66,repeat('adfdijn0loKNHJik',660),repeat('adfdijn0loKNHJik',1320),'adfdijn0loKNHJik');
22 22000 4400 jejdkrun87
44 44000 8800 adfd72nh9k
insert into t1 values (33,repeat('adfdpplkeock',3300),repeat('adfdpplkeock',660),'adfdpplkeock');
insert into t1 values (55,repeat('adfdijnmnb78k',5500),repeat('adfdijnmnb78k',1100),'adfdijnmnb78k');
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
insert into t1 values (66,repeat('adfdijn0loKNHJik',6600),repeat('adfdijn0loKNHJik',1320),'adfdijn0loKNHJik');
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
......@@ -1062,18 +1066,18 @@ test.t1 check status OK
explain select * from t1 where b like 'adfd%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 23 NULL 2 Using where
select a,b=repeat(d,10*a),c=repeat(d,20*a) from t1;
a b=repeat(d,10*a) c=repeat(d,20*a)
select a,b=repeat(d,100*a),c=repeat(d,20*a) from t1;
a b=repeat(d,100*a) c=repeat(d,20*a)
22 1 1
33 1 1
44 1 1
55 1 1
66 1 1
55 0 1
66 0 1
select a,length(b),length(c),d from t1;
a length(b) length(c) d
22 2200 4400 jejdkrun87
33 3960 7920 adfdpplkeock
44 4400 8800 adfd72nh9k
55 7150 14300 adfdijnmnb78k
66 10560 21120 adfdijn0loKNHJik
22 22000 4400 jejdkrun87
33 39600 7920 adfdpplkeock
44 44000 8800 adfd72nh9k
55 65535 14300 adfdijnmnb78k
66 65535 21120 adfdijn0loKNHJik
drop table t1;
......@@ -307,26 +307,26 @@ explain select * from t1 order by a;
drop table t1;
create table t1(a int, b blob, c text, d text not null) engine=innodb default charset = utf8;
insert into t1 values (22,repeat('jejdkrun87',220),repeat('jejdkrun87',440),'jejdkrun87');
insert into t1 values (44,repeat('adfd72nh9k',440),repeat('adfd72nh9k',880),'adfd72nh9k');
insert into t1 values (22,repeat('jejdkrun87',2200),repeat('jejdkrun87',440),'jejdkrun87');
insert into t1 values (44,repeat('adfd72nh9k',4400),repeat('adfd72nh9k',880),'adfd72nh9k');
insert into t1 values (null,null,null,'null');
select count(*) from t1 where a=44;
select a,b=repeat(d,10*a),c=repeat(d,20*a) from t1;
select a,b=repeat(d,100*a),c=repeat(d,20*a) from t1;
select a,length(b),length(c),d from t1;
--error ER_PRIMARY_CANT_HAVE_NULL
alter table t1 add primary key (a), add key (b(20));
delete from t1 where d='null';
alter table t1 add primary key (a), add key (b(20));
select count(*) from t1 where a=44;
select a,b=repeat(d,10*a),c=repeat(d,20*a) from t1;
select a,b=repeat(d,100*a),c=repeat(d,20*a) from t1;
select a,length(b),length(c),d from t1;
insert into t1 values (33,repeat('adfdpplkeock',330),repeat('adfdpplkeock',660),'adfdpplkeock');
insert into t1 values (55,repeat('adfdijnmnb78k',550),repeat('adfdijnmnb78k',1100),'adfdijnmnb78k');
insert into t1 values (66,repeat('adfdijn0loKNHJik',660),repeat('adfdijn0loKNHJik',1320),'adfdijn0loKNHJik');
insert into t1 values (33,repeat('adfdpplkeock',3300),repeat('adfdpplkeock',660),'adfdpplkeock');
insert into t1 values (55,repeat('adfdijnmnb78k',5500),repeat('adfdijnmnb78k',1100),'adfdijnmnb78k');
insert into t1 values (66,repeat('adfdijn0loKNHJik',6600),repeat('adfdijn0loKNHJik',1320),'adfdijn0loKNHJik');
show create table t1;
check table t1;
explain select * from t1 where b like 'adfd%';
select a,b=repeat(d,10*a),c=repeat(d,20*a) from t1;
select a,b=repeat(d,100*a),c=repeat(d,20*a) from t1;
select a,length(b),length(c),d from t1;
drop table t1;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment