1
by brian
clean slate |
1 |
# Initialise |
2 |
--disable_warnings |
|
3 |
drop table if exists t1,t2,t3; |
|
4 |
--enable_warnings |
|
5 |
||
6 |
disable_query_log; |
|
7 |
select "--- Testing varchar ---"; |
|
8 |
enable_query_log; |
|
9 |
||
10 |
#
|
|
11 |
# Simple basic test that endspace is saved |
|
12 |
#
|
|
13 |
||
1063.9.13
by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit. |
14 |
eval create $temp table t1 (v varchar(10), c char(10), t text); |
1
by brian
clean slate |
15 |
insert into t1 values('+ ', '+ ', '+ '); |
16 |
set @a=repeat(' ',20); |
|
1637
by Brian Aker
Merge in changes to call error on bad data input. |
17 |
--error 1406 |
18 |
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); |
|
19 |
set @a=repeat(' ',10); |
|
20 |
--error 1406 |
|
21 |
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); |
|
22 |
set @a=repeat(' ',9); |
|
1
by brian
clean slate |
23 |
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); |
24 |
select concat('*',v,'*',c,'*',t,'*') from t1; |
|
25 |
||
26 |
# Check how columns are copied |
|
27 |
show create table t1; |
|
1063.9.13
by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit. |
28 |
eval create $temp table t2 like t1; |
1
by brian
clean slate |
29 |
show create table t2; |
1063.9.13
by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit. |
30 |
eval create $temp table t3 select * from t1; |
1
by brian
clean slate |
31 |
show create table t3; |
32 |
alter table t1 modify c varchar(10); |
|
33 |
show create table t1; |
|
34 |
alter table t1 modify v char(10); |
|
35 |
show create table t1; |
|
36 |
alter table t1 modify t varchar(10); |
|
37 |
show create table t1; |
|
38 |
select concat('*',v,'*',c,'*',t,'*') from t1; |
|
39 |
drop table t1,t2,t3; |
|
40 |
||
41 |
#
|
|
42 |
# Testing of keys |
|
43 |
#
|
|
1063.9.13
by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit. |
44 |
eval create $temp table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10))); |
1
by brian
clean slate |
45 |
show create table t1; |
46 |
disable_query_log; |
|
910.4.13
by Stewart Smith
batch up more INSERTs into transactions to help tests run quicker. |
47 |
begin; |
1
by brian
clean slate |
48 |
let $1=10; |
49 |
while ($1) |
|
50 |
{
|
|
51 |
let $2=27; |
|
52 |
eval set @space=repeat(' ',10-$1); |
|
53 |
while ($2) |
|
54 |
{
|
|
55 |
eval set @char=char(ascii('a')+$2-1); |
|
56 |
insert into t1 values(concat(@char,@space),concat(@char,@space),concat(@char,@space)); |
|
57 |
dec $2; |
|
58 |
}
|
|
59 |
dec $1; |
|
60 |
}
|
|
910.4.13
by Stewart Smith
batch up more INSERTs into transactions to help tests run quicker. |
61 |
commit; |
1
by brian
clean slate |
62 |
enable_query_log; |
63 |
select count(*) from t1; |
|
64 |
insert into t1 values(concat('a',char(1)),concat('a',char(1)),concat('a',char(1))); |
|
65 |
select count(*) from t1 where v='a'; |
|
66 |
select count(*) from t1 where c='a'; |
|
67 |
select count(*) from t1 where t='a'; |
|
68 |
select count(*) from t1 where v='a '; |
|
69 |
select count(*) from t1 where c='a '; |
|
70 |
select count(*) from t1 where t='a '; |
|
71 |
select count(*) from t1 where v between 'a' and 'a '; |
|
72 |
select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; |
|
73 |
select count(*) from t1 where v like 'a%'; |
|
74 |
select count(*) from t1 where c like 'a%'; |
|
75 |
select count(*) from t1 where t like 'a%'; |
|
76 |
select count(*) from t1 where v like 'a %'; |
|
77 |
# Test results differ for BDB, see comments in bdb.test |
|
78 |
# and they are also different from MySAM test results. |
|
79 |
--replace_column 9 # |
|
80 |
explain select count(*) from t1 where v='a '; |
|
81 |
--replace_column 9 # |
|
82 |
explain select count(*) from t1 where c='a '; |
|
83 |
--replace_column 9 # |
|
84 |
explain select count(*) from t1 where t='a '; |
|
85 |
--replace_column 9 # |
|
86 |
explain select count(*) from t1 where v like 'a%'; |
|
87 |
--replace_column 9 # |
|
88 |
explain select count(*) from t1 where v between 'a' and 'a '; |
|
89 |
--replace_column 9 # |
|
90 |
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; |
|
91 |
||
92 |
--error ER_DUP_ENTRY |
|
93 |
alter table t1 add unique(v); |
|
94 |
alter table t1 add key(v); |
|
95 |
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a'; |
|
96 |
--replace_column 6 # 9 # |
|
97 |
explain select * from t1 where v='a'; |
|
98 |
||
99 |
# GROUP BY |
|
100 |
||
101 |
select v,count(*) from t1 group by v limit 10; |
|
102 |
select v,count(t) from t1 group by v limit 10; |
|
103 |
select v,count(c) from t1 group by v limit 10; |
|
104 |
select sql_big_result v,count(t) from t1 group by v limit 10; |
|
105 |
select sql_big_result v,count(c) from t1 group by v limit 10; |
|
106 |
select c,count(*) from t1 group by c limit 10; |
|
107 |
select c,count(t) from t1 group by c limit 10; |
|
108 |
select sql_big_result c,count(t) from t1 group by c limit 10; |
|
109 |
select t,count(*) from t1 group by t limit 10; |
|
110 |
select t,count(t) from t1 group by t limit 10; |
|
111 |
select sql_big_result t,count(t) from t1 group by t limit 10; |
|
112 |
||
113 |
#
|
|
114 |
# Test varchar > 255 bytes |
|
115 |
#
|
|
116 |
||
117 |
alter table t1 modify v varchar(300), drop key v, drop key v_2, add key v (v); |
|
118 |
show create table t1; |
|
119 |
select count(*) from t1 where v='a'; |
|
120 |
select count(*) from t1 where v='a '; |
|
121 |
select count(*) from t1 where v between 'a' and 'a '; |
|
122 |
select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; |
|
123 |
select count(*) from t1 where v like 'a%'; |
|
124 |
select count(*) from t1 where v like 'a %'; |
|
125 |
--replace_column 9 # |
|
126 |
explain select count(*) from t1 where v='a '; |
|
127 |
--replace_column 9 # |
|
128 |
explain select count(*) from t1 where v like 'a%'; |
|
129 |
--replace_column 9 # |
|
130 |
explain select count(*) from t1 where v between 'a' and 'a '; |
|
131 |
--replace_column 9 # |
|
132 |
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; |
|
133 |
--replace_column 9 # |
|
134 |
explain select * from t1 where v='a'; |
|
135 |
||
136 |
# GROUP BY |
|
137 |
||
138 |
select v,count(*) from t1 group by v limit 10; |
|
139 |
select v,count(t) from t1 group by v limit 10; |
|
140 |
select sql_big_result v,count(t) from t1 group by v limit 10; |
|
141 |
||
142 |
#
|
|
143 |
# Test varchar > 255 bytes, key < 255 |
|
144 |
#
|
|
145 |
||
146 |
alter table t1 drop key v, add key v (v(30)); |
|
147 |
show create table t1; |
|
148 |
select count(*) from t1 where v='a'; |
|
149 |
select count(*) from t1 where v='a '; |
|
150 |
select count(*) from t1 where v between 'a' and 'a '; |
|
151 |
select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; |
|
152 |
select count(*) from t1 where v like 'a%'; |
|
153 |
select count(*) from t1 where v like 'a %'; |
|
154 |
--replace_column 9 # |
|
155 |
explain select count(*) from t1 where v='a '; |
|
156 |
--replace_column 9 # |
|
157 |
explain select count(*) from t1 where v like 'a%'; |
|
158 |
--replace_column 9 # |
|
159 |
explain select count(*) from t1 where v between 'a' and 'a '; |
|
160 |
--replace_column 9 # |
|
161 |
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; |
|
162 |
--replace_column 9 # |
|
163 |
explain select * from t1 where v='a'; |
|
164 |
||
165 |
# GROUP BY |
|
166 |
||
167 |
select v,count(*) from t1 group by v limit 10; |
|
168 |
select v,count(t) from t1 group by v limit 10; |
|
169 |
select sql_big_result v,count(t) from t1 group by v limit 10; |
|
170 |
||
171 |
#
|
|
172 |
# Test varchar > 512 (special case for GROUP BY becasue of |
|
173 |
# CONVERT_IF_BIGGER_TO_BLOB define) |
|
174 |
#
|
|
175 |
||
176 |
alter table t1 modify v varchar(600), drop key v, add key v (v); |
|
177 |
show create table t1; |
|
178 |
select v,count(*) from t1 group by v limit 10; |
|
179 |
select v,count(t) from t1 group by v limit 10; |
|
180 |
select sql_big_result v,count(t) from t1 group by v limit 10; |
|
181 |
||
182 |
drop table t1; |
|
183 |
||
184 |
#
|
|
185 |
# Test unique keys |
|
186 |
#
|
|
187 |
||
1063.9.13
by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit. |
188 |
eval create $temp table t1 (a char(10), unique (a)); |
1
by brian
clean slate |
189 |
insert into t1 values ('a '); |
190 |
--error ER_DUP_ENTRY |
|
191 |
insert into t1 values ('a '); |
|
192 |
||
193 |
alter table t1 modify a varchar(10); |
|
194 |
--error ER_DUP_ENTRY |
|
195 |
insert into t1 values ('a '),('a '),('a '),('a '); |
|
196 |
--error ER_DUP_ENTRY |
|
197 |
insert into t1 values ('a '); |
|
1637
by Brian Aker
Merge in changes to call error on bad data input. |
198 |
--error 1406 |
1
by brian
clean slate |
199 |
insert into t1 values ('a '); |
200 |
--error ER_DUP_ENTRY |
|
201 |
insert into t1 values ('a '); |
|
202 |
update t1 set a='a ' where a like 'a%'; |
|
203 |
select concat(a,'.') from t1; |
|
204 |
update t1 set a='abc ' where a like 'a '; |
|
205 |
select concat(a,'.') from t1; |
|
206 |
update t1 set a='a ' where a like 'a %'; |
|
207 |
select concat(a,'.') from t1; |
|
208 |
update t1 set a='a ' where a like 'a '; |
|
209 |
select concat(a,'.') from t1; |
|
210 |
drop table t1; |
|
211 |
||
212 |
#
|
|
213 |
# test show create table |
|
214 |
#
|
|
215 |
||
1063.9.13
by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit. |
216 |
eval create $temp table t1 (v varchar(10), c char(10), t text, key(v(5)), key(c(5)), key(t(5))); |
1
by brian
clean slate |
217 |
show create table t1; |
218 |
drop table t1; |
|
1063.9.13
by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit. |
219 |
eval create $temp table t1 (v char(10)); |
1
by brian
clean slate |
220 |
show create table t1; |
221 |
drop table t1; |
|
222 |
||
1222.1.6
by Brian Aker
Fix engines to not rely on HA_CREATE_INFO. |
223 |
eval create $temp table t1 (v varchar(10), c char(10)); |
1
by brian
clean slate |
224 |
show create table t1; |
225 |
insert into t1 values('a','a'),('a ','a '); |
|
226 |
select concat('*',v,'*',c,'*') from t1; |
|
227 |
drop table t1; |
|
228 |
||
229 |
#
|
|
230 |
# Test long varchars |
|
231 |
#
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
232 |
# @TODO The below fails because it assumes latin1 |
233 |
# as the charset. Possibly re-enable a similar test |
|
234 |
# for UTF8-only in future |
|
1063.9.13
by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit. |
235 |
#create $temp table t1 (v varchar(65530), key(v(10))); |
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
236 |
#insert into t1 values(repeat('a',65530)); |
237 |
#select length(v) from t1 where v=repeat('a',65530); |
|
238 |
#drop table t1; |
|
1
by brian
clean slate |
239 |
|
240 |
#
|
|
241 |
# Bug #9489: problem with hash indexes |
|
242 |
# Bug #10802: Index is not used if table using BDB engine on HP-UX |
|
243 |
#
|
|
244 |
||
1063.9.13
by Stewart Smith
Modify include/mix2, include/varchar, mix2_myisam.test (and innodb.result as it includes the test and is affected by only whitespace from the enabling of testing against temporary tables) to deal with MyISAM being a temporary only engine. This commit includse the correct result file, which means it is affected by BUG lp:387627 and as such mix2_myisam fails on this commit. |
245 |
eval create $temp table t1(a int, b varchar(12), key ba(b, a)); |
1
by brian
clean slate |
246 |
insert into t1 values (1, 'A'), (20, NULL); |
247 |
explain select * from t1 where a=20 and b is null; |
|
248 |
select * from t1 where a=20 and b is null; |
|
249 |
drop table t1; |