2
# Test problem with characters < ' ' at end of strings (Bug #3152)
6
drop table if exists t1;
11
# Test default engine tables.
14
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1));
15
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
17
select * from t1 ignore key (key1) where text1='teststring' or
18
text1 like 'teststring_%' ORDER BY text1;
20
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) not null;
28
select * from t1 ignore key (key1) where text1='teststring' or
29
text1 like 'teststring_%' ORDER BY text1;
31
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
33
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
34
select text1, length(text1) from t1 order by text1;
35
select text1, length(text1) from t1 order by text1;
37
alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20));
38
insert into t1 values ('teststring ');
39
select concat('|', text1, '|') from t1 order by text1;
41
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
43
select concat('|', text1, '|') from t1 where text1='teststring';
45
select concat('|', text1, '|') from t1 where text1='teststring ';
47
alter table t1 modify text1 text not null;
49
select concat('|', text1, '|') from t1 where text1='teststring';
51
select concat('|', text1, '|') from t1 where text1='teststring ';
52
explain select concat('|', text1, '|') from t1 where text1='teststring ';
54
select concat('|', text1, '|') from t1 where text1 like 'teststring_%';
56
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
58
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
59
select concat('|', text1, '|') from t1 order by text1;
62
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1));
63
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
65
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
67
select concat('|', text1, '|') from t1 where text1='teststring' or text1 >= 'teststring\t';
70
# Test MEMORY tables (with BTREE keys)
72
create temporary table t1 (text1 varchar(32) not NULL, KEY key1 using BTREE (text1)) engine=MEMORY;
73
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
74
select * from t1 ignore key (key1) where text1='teststring' or
75
text1 like 'teststring_%' ORDER BY text1;
76
select * from t1 where text1='teststring' or text1 like 'teststring_%';
77
select * from t1 where text1='teststring' or text1 >= 'teststring\t';
78
select * from t1 order by text1;
79
explain select * from t1 order by text1;
81
alter table t1 modify text1 char(32) not null;
82
select * from t1 order by text1;
89
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) engine=innodb;
90
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
93
select * from t1 where text1='teststring' or text1 like 'teststring_%';
95
select * from t1 where text1='teststring' or text1 > 'teststring\t';
96
select * from t1 order by text1;
97
explain select * from t1 order by text1;
99
alter table t1 modify text1 char(32) not null;
100
select * from t1 order by text1;
102
alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20));
103
insert into t1 values ('teststring ');
104
select concat('|', text1, '|') from t1 order by text1;
106
alter table t1 modify text1 text not null;
108
select * from t1 where text1 like 'teststring_%';
110
# The following gives wrong result in InnoDB
112
select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%';
114
select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t';
115
select concat('|', text1, '|') from t1 order by text1;