2
# Test problem with characters < ' ' at end of strings (Bug #3152)
5
-- source include/have_innodb.inc
7
drop table if exists t1;
10
-- source include/endspace.inc
16
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1));
17
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
19
select * from t1 ignore key (key1) where text1='teststring' or
20
text1 like 'teststring_%' ORDER BY text1;
21
select * from t1 where text1='teststring' or text1 like 'teststring_%';
22
select * from t1 where text1='teststring' or text1 > 'teststring\t';
23
select * from t1 order by text1;
24
explain select * from t1 order by text1;
26
alter table t1 modify text1 char(32) binary not null;
28
select * from t1 ignore key (key1) where text1='teststring' or
29
text1 like 'teststring_%' ORDER BY text1;
30
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
31
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
32
select text1, length(text1) from t1 order by text1;
33
select text1, length(text1) from t1 order by binary text1;
35
alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20));
36
insert into t1 values ('teststring ');
37
select concat('|', text1, '|') from t1 order by text1;
38
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
39
select concat('|', text1, '|') from t1 where text1='teststring';
40
select concat('|', text1, '|') from t1 where text1='teststring ';
42
alter table t1 modify text1 text not null, pack_keys=1;
43
select concat('|', text1, '|') from t1 where text1='teststring';
44
select concat('|', text1, '|') from t1 where text1='teststring ';
45
explain select concat('|', text1, '|') from t1 where text1='teststring ';
46
select concat('|', text1, '|') from t1 where text1 like 'teststring_%';
47
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
48
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
49
select concat('|', text1, '|') from t1 order by text1;
52
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) pack_keys=0;
53
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
54
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
55
select concat('|', text1, '|') from t1 where text1='teststring' or text1 >= 'teststring\t';
58
# Test HEAP tables (with BTREE keys)
60
create table t1 (text1 varchar(32) not NULL, KEY key1 using BTREE (text1)) engine=heap;
61
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
62
select * from t1 ignore key (key1) where text1='teststring' or
63
text1 like 'teststring_%' ORDER BY text1;
64
select * from t1 where text1='teststring' or text1 like 'teststring_%';
65
select * from t1 where text1='teststring' or text1 >= 'teststring\t';
66
select * from t1 order by text1;
67
explain select * from t1 order by text1;
69
alter table t1 modify text1 char(32) binary not null;
70
select * from t1 order by text1;
77
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) engine=innodb;
78
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
80
select * from t1 where text1='teststring' or text1 like 'teststring_%';
81
select * from t1 where text1='teststring' or text1 > 'teststring\t';
82
select * from t1 order by text1;
83
explain select * from t1 order by text1;
85
alter table t1 modify text1 char(32) binary not null;
86
select * from t1 order by text1;
88
alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20));
89
insert into t1 values ('teststring ');
90
select concat('|', text1, '|') from t1 order by text1;
92
alter table t1 modify text1 text not null, pack_keys=1;
93
select * from t1 where text1 like 'teststring_%';
95
# The following gives wrong result in InnoDB
96
select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%';
97
select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t';
98
select concat('|', text1, '|') from t1 order by text1;