1
by brian
clean slate |
1 |
drop table if exists t1,t2; |
1063.9.18
by Stewart Smith
null_key for MyISAM temp only: use temp myisam tables |
2 |
create temporary table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam; |
1
by brian
clean slate |
3 |
insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6); |
4 |
explain select * from t1 where a is null; |
|
5 |
id select_type table type possible_keys key key_len ref rows Extra |
|
6 |
1 SIMPLE t1 ref a a 5 const 3 Using where; Using index |
|
7 |
explain select * from t1 where a is null and b = 2; |
|
8 |
id select_type table type possible_keys key key_len ref rows Extra |
|
9 |
1 SIMPLE t1 ref a,b a 9 const,const 1 Using where; Using index |
|
10 |
explain select * from t1 where a is null and b = 7; |
|
11 |
id select_type table type possible_keys key key_len ref rows Extra |
|
12 |
1 SIMPLE t1 ref a,b a 9 const,const 1 Using where; Using index |
|
13 |
explain select * from t1 where a=2 and b = 2; |
|
14 |
id select_type table type possible_keys key key_len ref rows Extra |
|
15 |
1 SIMPLE t1 const a,b a 9 const,const 1 Using index |
|
16 |
explain select * from t1 where a<=>b limit 2; |
|
17 |
id select_type table type possible_keys key key_len ref rows Extra |
|
18 |
1 SIMPLE t1 index NULL a 9 NULL 12 Using where; Using index |
|
19 |
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3; |
|
20 |
id select_type table type possible_keys key key_len ref rows Extra |
|
21 |
1 SIMPLE t1 range a,b a 9 NULL 3 Using where; Using index |
|
22 |
explain select * from t1 where (a is null or a = 7) and b=7; |
|
23 |
id select_type table type possible_keys key key_len ref rows Extra |
|
1685.7.6
by Patrick Crews
Updated test results with changes due to optimizer bug fix. EXPLAIN output now includes 'Using where' for several queries that didn't previously have this output |
24 |
1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using where; Using index |
1
by brian
clean slate |
25 |
explain select * from t1 where (a is null or a = 7) and b=7 order by a; |
26 |
id select_type table type possible_keys key key_len ref rows Extra |
|
1685.7.6
by Patrick Crews
Updated test results with changes due to optimizer bug fix. EXPLAIN output now includes 'Using where' for several queries that didn't previously have this output |
27 |
1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using where; Using index; Using filesort |
1
by brian
clean slate |
28 |
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2; |
29 |
id select_type table type possible_keys key key_len ref rows Extra |
|
30 |
1 SIMPLE t1 ref a,b a 5 const 3 Using where; Using index |
|
31 |
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3; |
|
32 |
id select_type table type possible_keys key key_len ref rows Extra |
|
33 |
1 SIMPLE t1 range a,b a 9 NULL 3 Using where; Using index |
|
34 |
explain select * from t1 where a > 1 and a < 3 limit 1; |
|
35 |
id select_type table type possible_keys key key_len ref rows Extra |
|
36 |
1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index |
|
37 |
explain select * from t1 where a > 8 and a < 9; |
|
38 |
id select_type table type possible_keys key key_len ref rows Extra |
|
39 |
1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index |
|
40 |
select * from t1 where a is null; |
|
41 |
a b |
|
42 |
NULL 7 |
|
43 |
NULL 9 |
|
44 |
NULL 9 |
|
45 |
select * from t1 where a is null and b = 7; |
|
46 |
a b |
|
47 |
NULL 7 |
|
48 |
select * from t1 where a<=>b limit 2; |
|
49 |
a b |
|
50 |
1 1 |
|
51 |
2 2 |
|
52 |
select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3; |
|
53 |
a b |
|
54 |
1 1 |
|
55 |
2 2 |
|
56 |
select * from t1 where (a is null or a > 0 and a < 3) and b > 7 limit 3; |
|
57 |
a b |
|
58 |
NULL 9 |
|
59 |
NULL 9 |
|
60 |
select * from t1 where (a is null or a = 7) and b=7; |
|
61 |
a b |
|
62 |
7 7 |
|
63 |
NULL 7 |
|
64 |
select * from t1 where a is null and b=9 or a is null and b=7 limit 3; |
|
65 |
a b |
|
66 |
NULL 7 |
|
67 |
NULL 9 |
|
68 |
NULL 9 |
|
69 |
select * from t1 where a > 1 and a < 3 limit 1; |
|
70 |
a b |
|
71 |
2 2 |
|
72 |
select * from t1 where a > 8 and a < 9; |
|
73 |
a b |
|
74 |
create table t2 like t1; |
|
1222.1.1
by Brian Aker
Second pass through bugs related to CREATE TABLE LIKE |
75 |
ERROR HY000: Can't create table 'test.t2' (errno: 138) |
76 |
create temporary table t2 like t1; |
|
77 |
show create table t2; |
|
78 |
Table Create Table |
|
79 |
t2 CREATE TEMPORARY TABLE `t2` ( |
|
1743.5.2
by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output |
80 |
`a` INT DEFAULT NULL, |
81 |
`b` INT NOT NULL, |
|
1222.1.1
by Brian Aker
Second pass through bugs related to CREATE TABLE LIKE |
82 |
UNIQUE KEY `a` (`a`,`b`), |
83 |
KEY `b` (`b`) |
|
1638.10.83
by Stewart Smith
fix some more tests for explicit COLLATE in CREATE TABLE |
84 |
) ENGINE=MyISAM COLLATE = utf8_general_ci |
1
by brian
clean slate |
85 |
insert into t2 select * from t1; |
1976.6.1
by Brian Aker
This is a fix for bug lp:686197 |
86 |
alter table t1 modify b blob not null, add c int DEFAULT 42 not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10)); |
1
by brian
clean slate |
87 |
explain select * from t1 where a is null and b = 2; |
88 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
89 |
1 SIMPLE t1 ref a,b a 5 const X Using where |
1
by brian
clean slate |
90 |
explain select * from t1 where a is null and b = 2 and c=0; |
91 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
92 |
1 SIMPLE t1 ref a,b a 5 const X Using where |
1
by brian
clean slate |
93 |
explain select * from t1 where a is null and b = 7 and c=0; |
94 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
95 |
1 SIMPLE t1 ref a,b a 5 const X Using where |
1
by brian
clean slate |
96 |
explain select * from t1 where a=2 and b = 2; |
97 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
98 |
1 SIMPLE t1 ref a,b a 5 const X Using where |
1
by brian
clean slate |
99 |
explain select * from t1 where a<=>b limit 2; |
100 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
101 |
1 SIMPLE t1 ALL NULL NULL NULL NULL X Using where |
1
by brian
clean slate |
102 |
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 and c=0 limit 3; |
103 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
104 |
1 SIMPLE t1 range a,b a 5 NULL X Using where |
1
by brian
clean slate |
105 |
explain select * from t1 where (a is null or a = 7) and b=7 and c=0; |
106 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
107 |
1 SIMPLE t1 ref_or_null a,b a 5 const X Using where |
1
by brian
clean slate |
108 |
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2; |
109 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
110 |
1 SIMPLE t1 ref a,b a 5 const X Using where |
1
by brian
clean slate |
111 |
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3; |
112 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
113 |
1 SIMPLE t1 ref a,b a 5 const X Using where |
1
by brian
clean slate |
114 |
explain select * from t1 where a > 1 and a < 3 limit 1; |
115 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
116 |
1 SIMPLE t1 range a a 5 NULL X Using where |
1
by brian
clean slate |
117 |
explain select * from t1 where a is null and b=7 or a > 1 and a < 3 limit 1; |
118 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
119 |
1 SIMPLE t1 range a,b a 5 NULL X Using where |
1
by brian
clean slate |
120 |
explain select * from t1 where a > 8 and a < 9; |
121 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
122 |
1 SIMPLE t1 range a a 5 NULL X Using where |
1
by brian
clean slate |
123 |
explain select * from t1 where b like "6%"; |
124 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
125 |
1 SIMPLE t1 range b b 12 NULL X Using where |
1
by brian
clean slate |
126 |
select * from t1 where a is null; |
127 |
a b c |
|
1976.6.1
by Brian Aker
This is a fix for bug lp:686197 |
128 |
NULL 7 42 |
129 |
NULL 9 42 |
|
130 |
NULL 9 42 |
|
1
by brian
clean slate |
131 |
select * from t1 where a is null and b = 7 and c=0; |
132 |
a b c |
|
133 |
select * from t1 where a<=>b limit 2; |
|
134 |
a b c |
|
1976.6.1
by Brian Aker
This is a fix for bug lp:686197 |
135 |
1 1 42 |
136 |
2 2 42 |
|
1
by brian
clean slate |
137 |
select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3; |
138 |
a b c |
|
1976.6.1
by Brian Aker
This is a fix for bug lp:686197 |
139 |
1 1 42 |
140 |
2 2 42 |
|
1
by brian
clean slate |
141 |
select * from t1 where (a is null or a > 0 and a < 3) and b > 7 limit 3; |
142 |
a b c |
|
1976.6.1
by Brian Aker
This is a fix for bug lp:686197 |
143 |
NULL 9 42 |
144 |
NULL 9 42 |
|
1
by brian
clean slate |
145 |
select * from t1 where (a is null or a = 7) and b=7 and c=0; |
146 |
a b c |
|
147 |
select * from t1 where a is null and b=9 or a is null and b=7 limit 3; |
|
148 |
a b c |
|
1976.6.1
by Brian Aker
This is a fix for bug lp:686197 |
149 |
NULL 7 42 |
150 |
NULL 9 42 |
|
151 |
NULL 9 42 |
|
1
by brian
clean slate |
152 |
select * from t1 where b like "6%"; |
153 |
a b c |
|
1976.6.1
by Brian Aker
This is a fix for bug lp:686197 |
154 |
6 6 42 |
1
by brian
clean slate |
155 |
drop table t1; |
685.4.17
by Jay Pipes
Fixes null_key.test. Mostly differences in EXPLAIN output which may be looked at later. Also, adds exception check for NULL values in multi-row INSERT |
156 |
drop table t2; |
1063.9.18
by Stewart Smith
null_key for MyISAM temp only: use temp myisam tables |
157 |
create temporary table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam; |
1
by brian
clean slate |
158 |
alter table t1 modify b int null; |
159 |
insert into t1 values (7,null), (8,null), (8,7); |
|
160 |
explain select * from t1 where a = 7 and (b=7 or b is null); |
|
161 |
id select_type table type possible_keys key key_len ref rows Extra |
|
1685.7.6
by Patrick Crews
Updated test results with changes due to optimizer bug fix. EXPLAIN output now includes 'Using where' for several queries that didn't previously have this output |
162 |
1 SIMPLE t1 ref_or_null a,b a 10 const,const 2 Using where; Using index |
1
by brian
clean slate |
163 |
select * from t1 where a = 7 and (b=7 or b is null); |
164 |
a b |
|
165 |
7 NULL |
|
166 |
explain select * from t1 where (a = 7 or a is null) and (b=7 or b is null); |
|
167 |
id select_type table type possible_keys key key_len ref rows Extra |
|
685.4.17
by Jay Pipes
Fixes null_key.test. Mostly differences in EXPLAIN output which may be looked at later. Also, adds exception check for NULL values in multi-row INSERT |
168 |
1 SIMPLE t1 ref_or_null a,b a 5 const 2 Using where; Using index |
1
by brian
clean slate |
169 |
select * from t1 where (a = 7 or a is null) and (b=7 or b is null); |
170 |
a b |
|
171 |
7 NULL |
|
172 |
explain select * from t1 where (a = 7 or a is null) and (a = 7 or a is null); |
|
173 |
id select_type table type possible_keys key key_len ref rows Extra |
|
1685.7.6
by Patrick Crews
Updated test results with changes due to optimizer bug fix. EXPLAIN output now includes 'Using where' for several queries that didn't previously have this output |
174 |
1 SIMPLE t1 ref_or_null a a 5 const 2 Using where; Using index |
1
by brian
clean slate |
175 |
select * from t1 where (a = 7 or a is null) and (a = 7 or a is null); |
176 |
a b |
|
177 |
7 NULL |
|
178 |
create table t2 (a int); |
|
179 |
insert into t2 values (7),(8); |
|
180 |
explain select * from t2 straight_join t1 where t1.a=t2.a and b is null; |
|
181 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
182 |
1 SIMPLE t2 ALL NULL NULL NULL NULL X |
183 |
1 SIMPLE t1 ref a,b b 5 const X Using where |
|
1
by brian
clean slate |
184 |
drop index b on t1; |
185 |
explain select * from t2,t1 where t1.a=t2.a and b is null; |
|
186 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
187 |
1 SIMPLE t2 ALL NULL NULL NULL NULL X |
188 |
1 SIMPLE t1 ref a a 10 test.t2.a,const X Using where; Using index |
|
1
by brian
clean slate |
189 |
select * from t2,t1 where t1.a=t2.a and b is null; |
190 |
a a b |
|
191 |
7 7 NULL |
|
192 |
8 8 NULL |
|
193 |
explain select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null); |
|
194 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
195 |
1 SIMPLE t2 ALL NULL NULL NULL NULL X |
1685.7.6
by Patrick Crews
Updated test results with changes due to optimizer bug fix. EXPLAIN output now includes 'Using where' for several queries that didn't previously have this output |
196 |
1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const X Using where; Using index |
1
by brian
clean slate |
197 |
select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null); |
198 |
a a b |
|
199 |
7 7 NULL |
|
200 |
8 8 7 |
|
201 |
8 8 NULL |
|
202 |
explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7; |
|
203 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
204 |
1 SIMPLE t2 ALL NULL NULL NULL NULL X |
1685.7.6
by Patrick Crews
Updated test results with changes due to optimizer bug fix. EXPLAIN output now includes 'Using where' for several queries that didn't previously have this output |
205 |
1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const X Using where; Using index |
1
by brian
clean slate |
206 |
select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7; |
207 |
a a b |
|
208 |
8 8 7 |
|
209 |
explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and (b= 7 or b is null); |
|
210 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
211 |
1 SIMPLE t2 ALL NULL NULL NULL NULL X |
212 |
1 SIMPLE t1 ref_or_null a a 5 test.t2.a X Using where; Using index |
|
1
by brian
clean slate |
213 |
select * from t2,t1 where (t1.a=t2.a or t1.a is null) and (b= 7 or b is null); |
214 |
a a b |
|
215 |
7 7 NULL |
|
216 |
8 8 NULL |
|
217 |
8 8 7 |
|
218 |
insert into t2 values (null),(6); |
|
219 |
delete from t1 where a=8; |
|
220 |
explain select * from t2,t1 where t1.a=t2.a or t1.a is null; |
|
221 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
222 |
1 SIMPLE t1 system a NULL NULL NULL X |
223 |
1 SIMPLE t2 ALL NULL NULL NULL NULL X Using where |
|
1
by brian
clean slate |
224 |
explain select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9); |
225 |
id select_type table type possible_keys key key_len ref rows Extra |
|
730
by jay
Forgot to --record the damn null_key test after adding regex-replaces for the InnoDB rows output in EXPLAIN |
226 |
1 SIMPLE t1 system a NULL NULL NULL X |
227 |
1 SIMPLE t2 ALL NULL NULL NULL NULL X Using where |
|
1
by brian
clean slate |
228 |
select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9); |
229 |
a a b |
|
230 |
7 7 NULL |
|
231 |
drop table t1,t2; |
|
1063.9.18
by Stewart Smith
null_key for MyISAM temp only: use temp myisam tables |
232 |
CREATE TEMPORARY TABLE t1 ( |
685.4.17
by Jay Pipes
Fixes null_key.test. Mostly differences in EXPLAIN output which may be looked at later. Also, adds exception check for NULL values in multi-row INSERT |
233 |
id int NOT NULL auto_increment, |
234 |
uniq_id int default NULL, |
|
1
by brian
clean slate |
235 |
PRIMARY KEY (id), |
236 |
UNIQUE KEY idx1 (uniq_id) |
|
237 |
) ENGINE=MyISAM; |
|
1063.9.18
by Stewart Smith
null_key for MyISAM temp only: use temp myisam tables |
238 |
CREATE TEMPORARY TABLE t2 ( |
685.4.17
by Jay Pipes
Fixes null_key.test. Mostly differences in EXPLAIN output which may be looked at later. Also, adds exception check for NULL values in multi-row INSERT |
239 |
id int NOT NULL auto_increment, |
240 |
uniq_id int default NULL, |
|
1
by brian
clean slate |
241 |
PRIMARY KEY (id) |
242 |
) ENGINE=MyISAM; |
|
243 |
INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL); |
|
244 |
INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL); |
|
245 |
explain select id from t1 where uniq_id is null; |
|
246 |
id select_type table type possible_keys key key_len ref rows Extra |
|
685.4.17
by Jay Pipes
Fixes null_key.test. Mostly differences in EXPLAIN output which may be looked at later. Also, adds exception check for NULL values in multi-row INSERT |
247 |
1 SIMPLE t1 ref idx1 idx1 5 const 5 Using where |
1
by brian
clean slate |
248 |
explain select id from t1 where uniq_id =1; |
249 |
id select_type table type possible_keys key key_len ref rows Extra |
|
250 |
1 SIMPLE t1 const idx1 idx1 5 const 1 |
|
251 |
UPDATE t1 SET id=id+100 where uniq_id is null; |
|
252 |
UPDATE t2 SET id=id+100 where uniq_id is null; |
|
253 |
select id from t1 where uniq_id is null; |
|
254 |
id
|
|
255 |
101
|
|
256 |
102
|
|
257 |
105
|
|
258 |
106
|
|
259 |
109
|
|
260 |
110
|
|
261 |
select id from t2 where uniq_id is null; |
|
262 |
id
|
|
263 |
101
|
|
264 |
102
|
|
265 |
105
|
|
266 |
106
|
|
267 |
109
|
|
268 |
110
|
|
269 |
DELETE FROM t1 WHERE uniq_id IS NULL; |
|
270 |
DELETE FROM t2 WHERE uniq_id IS NULL; |
|
271 |
SELECT * FROM t1 ORDER BY uniq_id, id; |
|
272 |
id uniq_id |
|
273 |
3 1 |
|
274 |
4 2 |
|
275 |
7 3 |
|
276 |
8 4 |
|
277 |
SELECT * FROM t2 ORDER BY uniq_id, id; |
|
278 |
id uniq_id |
|
279 |
3 1 |
|
280 |
4 2 |
|
281 |
7 3 |
|
282 |
8 4 |
|
283 |
DROP table t1,t2; |
|
1063.9.18
by Stewart Smith
null_key for MyISAM temp only: use temp myisam tables |
284 |
CREATE TEMPORARY TABLE `t1` ( |
1
by brian
clean slate |
285 |
`order_id` char(32) NOT NULL default '', |
286 |
`product_id` char(32) NOT NULL default '', |
|
685.4.17
by Jay Pipes
Fixes null_key.test. Mostly differences in EXPLAIN output which may be looked at later. Also, adds exception check for NULL values in multi-row INSERT |
287 |
`product_type` int NOT NULL default '0', |
1
by brian
clean slate |
288 |
PRIMARY KEY (`order_id`,`product_id`,`product_type`) |
289 |
) ENGINE=MyISAM; |
|
1063.9.18
by Stewart Smith
null_key for MyISAM temp only: use temp myisam tables |
290 |
CREATE TEMPORARY TABLE `t2` ( |
1
by brian
clean slate |
291 |
`order_id` char(32) NOT NULL default '', |
292 |
`product_id` char(32) NOT NULL default '', |
|
685.4.17
by Jay Pipes
Fixes null_key.test. Mostly differences in EXPLAIN output which may be looked at later. Also, adds exception check for NULL values in multi-row INSERT |
293 |
`product_type` int NOT NULL default '0', |
1
by brian
clean slate |
294 |
PRIMARY KEY (`order_id`,`product_id`,`product_type`) |
295 |
) ENGINE=MyISAM; |
|
296 |
INSERT INTO t1 (order_id, product_id, product_type) VALUES |
|
297 |
('3d7ce39b5d4b3e3d22aaafe9b633de51',1206029, 3), |
|
298 |
('3d7ce39b5d4b3e3d22aaafe9b633de51',5880836, 3), |
|
299 |
('9d9aad7764b5b2c53004348ef8d34500',2315652, 3); |
|
300 |
INSERT INTO t2 (order_id, product_id, product_type) VALUES |
|
301 |
('9d9aad7764b5b2c53004348ef8d34500',2315652, 3); |
|
302 |
select t1.* from t1 |
|
303 |
left join t2 using(order_id, product_id, product_type) |
|
304 |
where t2.order_id=NULL; |
|
305 |
order_id product_id product_type |
|
306 |
select t1.* from t1 |
|
307 |
left join t2 using(order_id, product_id, product_type) |
|
308 |
where t2.order_id is NULL; |
|
309 |
order_id product_id product_type |
|
310 |
3d7ce39b5d4b3e3d22aaafe9b633de51 1206029 3 |
|
311 |
3d7ce39b5d4b3e3d22aaafe9b633de51 5880836 3 |
|
312 |
drop table t1,t2; |
|
313 |
create table t1 (id int); |
|
314 |
insert into t1 values (null), (0); |
|
315 |
create table t2 (id int); |
|
316 |
insert into t2 values (null); |
|
317 |
select * from t1, t2 where t1.id = t2.id; |
|
318 |
id id |
|
319 |
alter table t1 add key id (id); |
|
320 |
select * from t1, t2 where t1.id = t2.id; |
|
321 |
id id |
|
322 |
drop table t1,t2; |
|
323 |
create table t1 ( |
|
324 |
id integer, |
|
325 |
id2 integer not null, |
|
326 |
index (id), |
|
327 |
index (id2) |
|
328 |
);
|
|
329 |
insert into t1 values(null,null),(1,1); |
|
685.4.17
by Jay Pipes
Fixes null_key.test. Mostly differences in EXPLAIN output which may be looked at later. Also, adds exception check for NULL values in multi-row INSERT |
330 |
ERROR 23000: Column 'id2' cannot be null |
1
by brian
clean slate |
331 |
select * from t1; |
332 |
id id2 |
|
333 |
select * from t1 where id <=> null; |
|
334 |
id id2 |
|
335 |
select * from t1 where id <=> null or id > 0; |
|
336 |
id id2 |
|
337 |
select * from t1 where id is null or id > 0; |
|
338 |
id id2 |
|
339 |
select * from t1 where id2 <=> null or id2 > 0; |
|
340 |
id id2 |
|
341 |
select * from t1 where id2 is null or id2 > 0; |
|
342 |
id id2 |
|
343 |
delete from t1 where id <=> NULL; |
|
344 |
select * from t1; |
|
345 |
id id2 |
|
346 |
drop table t1; |
|
347 |
CREATE TABLE t1 (a int); |
|
348 |
CREATE TABLE t2 (a int, b int, INDEX idx(a)); |
|
349 |
CREATE TABLE t3 (b int, INDEX idx(b)); |
|
350 |
CREATE TABLE t4 (b int, INDEX idx(b)); |
|
351 |
INSERT INTO t1 VALUES (1), (2), (3), (4); |
|
352 |
INSERT INTO t2 VALUES (1, 1), (3, 1); |
|
353 |
INSERT INTO t3 VALUES |
|
354 |
(NULL), (NULL), (NULL), (NULL), (NULL), |
|
355 |
(NULL), (NULL), (NULL), (NULL), (NULL); |
|
356 |
INSERT INTO t4 SELECT * FROM t3; |
|
357 |
INSERT INTO t3 SELECT * FROM t4; |
|
358 |
INSERT INTO t4 SELECT * FROM t3; |
|
359 |
INSERT INTO t3 SELECT * FROM t4; |
|
360 |
INSERT INTO t4 SELECT * FROM t3; |
|
361 |
INSERT INTO t3 SELECT * FROM t4; |
|
362 |
INSERT INTO t4 SELECT * FROM t3; |
|
363 |
INSERT INTO t3 SELECT * FROM t4; |
|
364 |
INSERT INTO t4 SELECT * FROM t3; |
|
365 |
INSERT INTO t3 SELECT * FROM t4; |
|
366 |
INSERT INTO t4 SELECT * FROM t3; |
|
367 |
INSERT INTO t3 SELECT * FROM t4; |
|
368 |
INSERT INTO t4 SELECT * FROM t3; |
|
369 |
INSERT INTO t3 SELECT * FROM t4; |
|
370 |
INSERT INTO t4 SELECT * FROM t3; |
|
371 |
INSERT INTO t3 SELECT * FROM t4; |
|
372 |
INSERT INTO t3 VALUES (2), (3); |
|
373 |
ANALYZE table t1, t2, t3; |
|
374 |
Table Op Msg_type Msg_text |
|
375 |
test.t1 analyze status OK |
|
376 |
test.t2 analyze status OK |
|
377 |
test.t3 analyze status OK |
|
378 |
SELECT COUNT(*) FROM t3; |
|
379 |
COUNT(*) |
|
380 |
15972
|
|
381 |
EXPLAIN SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a |
|
382 |
LEFT JOIN t3 ON t2.b=t3.b; |
|
383 |
id select_type table type possible_keys key key_len ref rows Extra |
|
731
by jay
Had a --regex-replace by accident. Should have been --replace_column call. Only showed up in make test, not running single test, because InnoDB key numbers were different with multiple test running. |
384 |
1 SIMPLE t1 ALL NULL NULL NULL NULL X |
385 |
1 SIMPLE t2 ref idx idx 5 test.t1.a X |
|
386 |
1 SIMPLE t3 ref idx idx 5 test.t2.b X Using index |
|
1
by brian
clean slate |
387 |
FLUSH STATUS ; |
388 |
SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a |
|
389 |
LEFT JOIN t3 ON t2.b=t3.b; |
|
390 |
a a b b |
|
391 |
1 1 1 NULL |
|
392 |
2 NULL NULL NULL |
|
393 |
3 3 1 NULL |
|
394 |
4 NULL NULL NULL |
|
395 |
SELECT FOUND_ROWS(); |
|
396 |
FOUND_ROWS() |
|
397 |
4
|
|
398 |
SHOW STATUS LIKE "handler_read%"; |
|
399 |
Variable_name Value |
|
685.4.17
by Jay Pipes
Fixes null_key.test. Mostly differences in EXPLAIN output which may be looked at later. Also, adds exception check for NULL values in multi-row INSERT |
400 |
Handler_read_first 1 |
401 |
Handler_read_key 10 |
|
1
by brian
clean slate |
402 |
Handler_read_next 2 |
403 |
Handler_read_prev 0 |
|
404 |
Handler_read_rnd 0 |
|
1561.3.11
by Joe Daly
get tests working |
405 |
Handler_read_rnd_next 5 |
1
by brian
clean slate |
406 |
DROP TABLE t1,t2,t3,t4; |
407 |
CREATE TABLE t1 ( |
|
685.4.17
by Jay Pipes
Fixes null_key.test. Mostly differences in EXPLAIN output which may be looked at later. Also, adds exception check for NULL values in multi-row INSERT |
408 |
a int default NULL, |
409 |
b int default NULL, |
|
1
by brian
clean slate |
410 |
KEY a (a,b) |
411 |
);
|
|
412 |
INSERT INTO t1 VALUES (0,10),(0,11),(0,12); |
|
413 |
CREATE TABLE t2 ( |
|
685.4.17
by Jay Pipes
Fixes null_key.test. Mostly differences in EXPLAIN output which may be looked at later. Also, adds exception check for NULL values in multi-row INSERT |
414 |
a int default NULL, |
415 |
b int default NULL, |
|
1
by brian
clean slate |
416 |
KEY a (a) |
417 |
);
|
|
418 |
INSERT INTO t2 VALUES (3,NULL),(3,11),(3,12); |
|
419 |
SELECT * FROM t2 inner join t1 WHERE ( t1.a = 0 OR t1.a IS NULL) AND t2.a = 3 AND t2.b = t1.b; |
|
420 |
a b a b |
|
421 |
3 11 0 11 |
|
422 |
3 12 0 12 |
|
423 |
drop table t1, t2; |
|
424 |
End of 5.0 tests |