1
by brian
clean slate |
1 |
drop table if exists t1; |
2 |
select 'a' = 'a', 'a' = 'a ', 'a ' = 'a'; |
|
3 |
'a' = 'a' 'a' = 'a ' 'a ' = 'a' |
|
4 |
1 1 1 |
|
5 |
select 'a\0' = 'a', 'a\0' < 'a', 'a\0' > 'a'; |
|
6 |
'a\0' = 'a' 'a\0' < 'a' 'a\0' > 'a' |
|
7 |
0 1 0 |
|
8 |
select 'a' = 'a\0', 'a' < 'a\0', 'a' > 'a\0'; |
|
9 |
'a' = 'a\0' 'a' < 'a\0' 'a' > 'a\0' |
|
10 |
0 0 1 |
|
11 |
select 'a\0' = 'a ', 'a\0' < 'a ', 'a\0' > 'a '; |
|
12 |
'a\0' = 'a ' 'a\0' < 'a ' 'a\0' > 'a ' |
|
13 |
0 1 0 |
|
14 |
select 'a ' = 'a\0', 'a ' < 'a\0', 'a ' > 'a\0'; |
|
15 |
'a ' = 'a\0' 'a ' < 'a\0' 'a ' > 'a\0' |
|
16 |
0 0 1 |
|
17 |
select 'a a' > 'a', 'a \0' < 'a'; |
|
18 |
'a a' > 'a' 'a \0' < 'a' |
|
19 |
1 1 |
|
20 |
select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a'; |
|
21 |
binary 'a a' > 'a' binary 'a \0' > 'a' binary 'a\0' > 'a' |
|
22 |
1 1 1 |
|
23 |
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)); |
|
24 |
insert into t1 values ('teststring'), ('nothing'), ('teststring\t'); |
|
25 |
check table t1; |
|
26 |
Table Op Msg_type Msg_text |
|
27 |
test.t1 check status OK |
|
28 |
select * from t1 ignore key (key1) where text1='teststring' or |
|
29 |
text1 like 'teststring_%' ORDER BY text1; |
|
30 |
text1
|
|
31 |
teststring
|
|
32 |
teststring
|
|
33 |
select * from t1 where text1='teststring' or text1 like 'teststring_%'; |
|
34 |
text1
|
|
35 |
teststring
|
|
36 |
teststring
|
|
37 |
select * from t1 where text1='teststring' or text1 > 'teststring\t'; |
|
38 |
text1
|
|
39 |
teststring
|
|
40 |
select * from t1 order by text1; |
|
41 |
text1
|
|
42 |
nothing
|
|
43 |
teststring
|
|
44 |
teststring
|
|
45 |
explain select * from t1 order by text1; |
|
46 |
id select_type table type possible_keys key key_len ref rows Extra |
|
383.1.16
by Brian Aker
Force client communication into UTF8 |
47 |
1 SIMPLE t1 index NULL key1 130 NULL 3 Using index |
1
by brian
clean slate |
48 |
alter table t1 modify text1 char(32) binary not null; |
49 |
check table t1; |
|
50 |
Table Op Msg_type Msg_text |
|
51 |
test.t1 check status OK |
|
52 |
select * from t1 ignore key (key1) where text1='teststring' or |
|
53 |
text1 like 'teststring_%' ORDER BY text1; |
|
54 |
text1
|
|
55 |
teststring
|
|
56 |
teststring
|
|
57 |
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%'; |
|
58 |
concat('|', text1, '|') |
|
59 |
|teststring | |
|
60 |
|teststring| |
|
61 |
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t'; |
|
62 |
concat('|', text1, '|') |
|
63 |
|teststring| |
|
64 |
select text1, length(text1) from t1 order by text1; |
|
65 |
text1 length(text1) |
|
66 |
nothing 7 |
|
67 |
teststring 11 |
|
68 |
teststring 10 |
|
69 |
select text1, length(text1) from t1 order by binary text1; |
|
70 |
text1 length(text1) |
|
71 |
nothing 7 |
|
72 |
teststring 10 |
|
73 |
teststring 11 |
|
74 |
alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20)); |
|
75 |
insert into t1 values ('teststring '); |
|
76 |
select concat('|', text1, '|') from t1 order by text1; |
|
77 |
concat('|', text1, '|') |
|
78 |
|nothing| |
|
79 |
|teststring| |
|
80 |
|teststring | |
|
81 |
|teststring | |
|
82 |
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t'; |
|
83 |
concat('|', text1, '|') |
|
84 |
|teststring| |
|
85 |
|teststring | |
|
86 |
select concat('|', text1, '|') from t1 where text1='teststring'; |
|
87 |
concat('|', text1, '|') |
|
88 |
|teststring| |
|
89 |
select concat('|', text1, '|') from t1 where text1='teststring '; |
|
90 |
concat('|', text1, '|') |
|
91 |
|teststring | |
|
92 |
alter table t1 modify text1 text not null, pack_keys=1; |
|
93 |
select concat('|', text1, '|') from t1 where text1='teststring'; |
|
94 |
concat('|', text1, '|') |
|
95 |
|teststring| |
|
96 |
|teststring | |
|
97 |
select concat('|', text1, '|') from t1 where text1='teststring '; |
|
98 |
concat('|', text1, '|') |
|
99 |
|teststring| |
|
100 |
|teststring | |
|
101 |
explain select concat('|', text1, '|') from t1 where text1='teststring '; |
|
102 |
id select_type table type possible_keys key key_len ref rows Extra |
|
383.1.16
by Brian Aker
Force client communication into UTF8 |
103 |
1 SIMPLE t1 ref key1 key1 82 const 2 Using where |
1
by brian
clean slate |
104 |
select concat('|', text1, '|') from t1 where text1 like 'teststring_%'; |
105 |
concat('|', text1, '|') |
|
106 |
|teststring | |
|
107 |
|teststring | |
|
108 |
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%'; |
|
109 |
concat('|', text1, '|') |
|
110 |
|teststring | |
|
111 |
|teststring| |
|
112 |
|teststring | |
|
113 |
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t'; |
|
114 |
concat('|', text1, '|') |
|
115 |
|teststring| |
|
116 |
|teststring | |
|
117 |
select concat('|', text1, '|') from t1 order by text1; |
|
118 |
concat('|', text1, '|') |
|
119 |
|nothing| |
|
120 |
|teststring | |
|
121 |
|teststring| |
|
122 |
|teststring | |
|
123 |
drop table t1; |
|
124 |
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) pack_keys=0; |
|
125 |
insert into t1 values ('teststring'), ('nothing'), ('teststring\t'); |
|
126 |
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%'; |
|
127 |
concat('|', text1, '|') |
|
128 |
|teststring | |
|
129 |
|teststring| |
|
130 |
select concat('|', text1, '|') from t1 where text1='teststring' or text1 >= 'teststring\t'; |
|
131 |
concat('|', text1, '|') |
|
132 |
|teststring | |
|
133 |
|teststring| |
|
134 |
drop table t1; |
|
135 |
create table t1 (text1 varchar(32) not NULL, KEY key1 using BTREE (text1)) engine=heap; |
|
136 |
insert into t1 values ('teststring'), ('nothing'), ('teststring\t'); |
|
137 |
select * from t1 ignore key (key1) where text1='teststring' or |
|
138 |
text1 like 'teststring_%' ORDER BY text1; |
|
139 |
text1
|
|
140 |
teststring
|
|
141 |
teststring
|
|
142 |
select * from t1 where text1='teststring' or text1 like 'teststring_%'; |
|
143 |
text1
|
|
144 |
teststring
|
|
145 |
teststring
|
|
146 |
select * from t1 where text1='teststring' or text1 >= 'teststring\t'; |
|
147 |
text1
|
|
148 |
teststring
|
|
149 |
teststring
|
|
150 |
select * from t1 order by text1; |
|
151 |
text1
|
|
152 |
nothing
|
|
153 |
teststring
|
|
154 |
teststring
|
|
155 |
explain select * from t1 order by text1; |
|
156 |
id select_type table type possible_keys key key_len ref rows Extra |
|
157 |
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort |
|
158 |
alter table t1 modify text1 char(32) binary not null; |
|
159 |
select * from t1 order by text1; |
|
160 |
text1
|
|
161 |
nothing
|
|
162 |
teststring
|
|
163 |
teststring
|
|
164 |
drop table t1; |
|
165 |
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) engine=innodb; |
|
166 |
insert into t1 values ('teststring'), ('nothing'), ('teststring\t'); |
|
167 |
check table t1; |
|
168 |
Table Op Msg_type Msg_text |
|
169 |
test.t1 check status OK |
|
170 |
select * from t1 where text1='teststring' or text1 like 'teststring_%'; |
|
171 |
text1
|
|
172 |
teststring
|
|
173 |
teststring
|
|
174 |
select * from t1 where text1='teststring' or text1 > 'teststring\t'; |
|
175 |
text1
|
|
176 |
teststring
|
|
177 |
select * from t1 order by text1; |
|
178 |
text1
|
|
179 |
nothing
|
|
180 |
teststring
|
|
181 |
teststring
|
|
182 |
explain select * from t1 order by text1; |
|
183 |
id select_type table type possible_keys key key_len ref rows Extra |
|
383.1.16
by Brian Aker
Force client communication into UTF8 |
184 |
1 SIMPLE t1 index NULL key1 130 NULL 3 Using index |
1
by brian
clean slate |
185 |
alter table t1 modify text1 char(32) binary not null; |
186 |
select * from t1 order by text1; |
|
187 |
text1
|
|
188 |
nothing
|
|
189 |
teststring
|
|
190 |
teststring
|
|
191 |
alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20)); |
|
192 |
insert into t1 values ('teststring '); |
|
193 |
select concat('|', text1, '|') from t1 order by text1; |
|
194 |
concat('|', text1, '|') |
|
195 |
|nothing| |
|
196 |
|teststring| |
|
197 |
|teststring | |
|
198 |
|teststring | |
|
199 |
alter table t1 modify text1 text not null, pack_keys=1; |
|
200 |
select * from t1 where text1 like 'teststring_%'; |
|
201 |
text1
|
|
202 |
teststring
|
|
203 |
teststring
|
|
204 |
select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%'; |
|
205 |
text1 length(text1) |
|
206 |
teststring 11 |
|
207 |
teststring 10 |
|
208 |
teststring 11 |
|
209 |
select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t'; |
|
210 |
text1 length(text1) |
|
211 |
teststring 11 |
|
212 |
teststring 10 |
|
213 |
teststring 11 |
|
214 |
select concat('|', text1, '|') from t1 order by text1; |
|
215 |
concat('|', text1, '|') |
|
216 |
|nothing| |
|
217 |
|teststring | |
|
218 |
|teststring| |
|
219 |
|teststring | |
|
220 |
drop table t1; |