~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
drop table if exists t1,t2;
2
create table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam;
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
24
1	SIMPLE	t1	ref_or_null	a,b	a	9	const,const	2	Using index
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
27
1	SIMPLE	t1	ref_or_null	a,b	a	9	const,const	2	Using index; Using filesort
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;
75
insert into t2 select * from t1;
76
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
77
explain select * from t1 where a is null and b = 2;
78
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
79
1	SIMPLE	t1	ref	a,b	a	5	const	X	Using where
1 by brian
clean slate
80
explain select * from t1 where a is null and b = 2 and c=0;
81
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
82
1	SIMPLE	t1	ref	a,b	a	5	const	X	Using where
1 by brian
clean slate
83
explain select * from t1 where a is null and b = 7 and c=0;
84
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
85
1	SIMPLE	t1	ref	a,b	a	5	const	X	Using where
1 by brian
clean slate
86
explain select * from t1 where a=2 and b = 2;
87
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
88
1	SIMPLE	t1	ref	a,b	a	5	const	X	Using where
1 by brian
clean slate
89
explain select * from t1 where a<=>b limit 2;
90
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
91
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	X	Using where
1 by brian
clean slate
92
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 and c=0 limit 3;
93
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
94
1	SIMPLE	t1	range	a,b	a	5	NULL	X	Using where
1 by brian
clean slate
95
explain select * from t1 where (a is null or a = 7) and b=7 and c=0;
96
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
97
1	SIMPLE	t1	ref_or_null	a,b	a	5	const	X	Using where
1 by brian
clean slate
98
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
99
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
100
1	SIMPLE	t1	ref	a,b	a	5	const	X	Using where
1 by brian
clean slate
101
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
102
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
103
1	SIMPLE	t1	ref	a,b	a	5	const	X	Using where
1 by brian
clean slate
104
explain select * from t1 where a > 1 and a < 3 limit 1;
105
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
106
1	SIMPLE	t1	range	a	a	5	NULL	X	Using where
1 by brian
clean slate
107
explain select * from t1 where a is null and b=7 or a > 1 and a < 3 limit 1;
108
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
109
1	SIMPLE	t1	range	a,b	a	5	NULL	X	Using where
1 by brian
clean slate
110
explain select * from t1 where a > 8 and a < 9;
111
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
112
1	SIMPLE	t1	range	a	a	5	NULL	X	Using where
1 by brian
clean slate
113
explain select * from t1 where b like "6%";
114
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
115
1	SIMPLE	t1	range	b	b	12	NULL	X	Using where
1 by brian
clean slate
116
select * from t1 where a is null;
117
a	b	c
118
NULL	7	0
119
NULL	9	0
120
NULL	9	0
121
select * from t1 where a is null and b = 7 and c=0;
122
a	b	c
123
NULL	7	0
124
select * from t1 where a<=>b limit 2;
125
a	b	c
126
1	1	0
127
2	2	0
128
select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3;
129
a	b	c
130
1	1	0
131
2	2	0
132
select * from t1 where (a is null or a > 0 and a < 3) and b > 7 limit 3;
133
a	b	c
134
NULL	9	0
135
NULL	9	0
136
select * from t1 where (a is null or a = 7) and b=7 and c=0;
137
a	b	c
138
7	7	0
139
NULL	7	0
140
select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
141
a	b	c
142
NULL	7	0
143
NULL	9	0
144
NULL	9	0
145
select * from t1 where b like "6%";
146
a	b	c
147
6	6	0
148
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
149
drop table t2;
150
create table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam;
1 by brian
clean slate
151
alter table t1 modify b int null;
152
insert into t1 values (7,null), (8,null), (8,7);
153
explain select * from t1 where a = 7 and (b=7 or b is null);
154
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
155
1	SIMPLE	t1	ref_or_null	a,b	a	10	const,const	2	Using index
156
select * from t1 where a = 7 and (b=7 or b is null);
157
a	b
158
7	NULL
159
explain select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
160
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
161
1	SIMPLE	t1	ref_or_null	a,b	a	5	const	2	Using where; Using index
1 by brian
clean slate
162
select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
163
a	b
164
7	NULL
165
explain select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
166
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
167
1	SIMPLE	t1	ref_or_null	a	a	5	const	2	Using index
1 by brian
clean slate
168
select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
169
a	b
170
7	NULL
171
create table t2 (a int);
172
insert into t2 values (7),(8);
173
explain select * from t2 straight_join t1 where t1.a=t2.a and b is null;
174
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
175
1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	X	
176
1	SIMPLE	t1	ref	a,b	b	5	const	X	Using where
1 by brian
clean slate
177
drop index b on t1;
178
explain select * from t2,t1 where t1.a=t2.a and b is null;
179
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
180
1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	X	
181
1	SIMPLE	t1	ref	a	a	10	test.t2.a,const	X	Using where; Using index
1 by brian
clean slate
182
select * from t2,t1 where t1.a=t2.a and b is null;
183
a	a	b
184
7	7	NULL
185
8	8	NULL
186
explain select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null);
187
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
188
1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	X	
189
1	SIMPLE	t1	ref_or_null	a	a	10	test.t2.a,const	X	Using index
1 by brian
clean slate
190
select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null);
191
a	a	b
192
7	7	NULL
193
8	8	7
194
8	8	NULL
195
explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7;
196
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
197
1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	X	
198
1	SIMPLE	t1	ref_or_null	a	a	10	test.t2.a,const	X	Using index
1 by brian
clean slate
199
select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7;
200
a	a	b
201
8	8	7
202
explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and (b= 7 or b is null);
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	
205
1	SIMPLE	t1	ref_or_null	a	a	5	test.t2.a	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 or b is null);
207
a	a	b
208
7	7	NULL
209
8	8	NULL
210
8	8	7
211
insert into t2 values (null),(6);
212
delete from t1 where a=8;
213
explain select * from t2,t1 where t1.a=t2.a or t1.a is null;
214
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
215
1	SIMPLE	t1	system	a	NULL	NULL	NULL	X	
216
1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	X	Using where
1 by brian
clean slate
217
explain select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9);
218
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
219
1	SIMPLE	t1	system	a	NULL	NULL	NULL	X	
220
1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	X	Using where
1 by brian
clean slate
221
select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9);
222
a	a	b
223
7	7	NULL
224
drop table t1,t2;
225
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
226
id int NOT NULL auto_increment,
227
uniq_id int default NULL,
1 by brian
clean slate
228
PRIMARY KEY  (id),
229
UNIQUE KEY idx1 (uniq_id)
230
) ENGINE=MyISAM;
231
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
232
id int NOT NULL auto_increment,
233
uniq_id int default NULL,
1 by brian
clean slate
234
PRIMARY KEY  (id)
235
) ENGINE=MyISAM;
236
INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
237
INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
238
explain select id from t1 where uniq_id is null;
239
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
240
1	SIMPLE	t1	ref	idx1	idx1	5	const	5	Using where
1 by brian
clean slate
241
explain select id from t1 where uniq_id =1;
242
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
243
1	SIMPLE	t1	const	idx1	idx1	5	const	1	
244
UPDATE t1 SET id=id+100 where uniq_id is null;
245
UPDATE t2 SET id=id+100 where uniq_id is null;
246
select id from t1 where uniq_id is null;
247
id
248
101
249
102
250
105
251
106
252
109
253
110
254
select id from t2 where uniq_id is null;
255
id
256
101
257
102
258
105
259
106
260
109
261
110
262
DELETE FROM t1 WHERE uniq_id IS NULL;
263
DELETE FROM t2 WHERE uniq_id IS NULL;
264
SELECT * FROM t1 ORDER BY uniq_id, id;
265
id	uniq_id
266
3	1
267
4	2
268
7	3
269
8	4
270
SELECT * FROM t2 ORDER BY uniq_id, id;
271
id	uniq_id
272
3	1
273
4	2
274
7	3
275
8	4
276
DROP table t1,t2;
277
CREATE TABLE `t1` (
278
`order_id` char(32) NOT NULL default '',
279
`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
280
`product_type` int NOT NULL default '0',
1 by brian
clean slate
281
PRIMARY KEY  (`order_id`,`product_id`,`product_type`)
282
) ENGINE=MyISAM;
283
CREATE TABLE `t2` (
284
`order_id` char(32) NOT NULL default '',
285
`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
286
`product_type` int NOT NULL default '0',
1 by brian
clean slate
287
PRIMARY KEY  (`order_id`,`product_id`,`product_type`)
288
) ENGINE=MyISAM;
289
INSERT INTO t1 (order_id, product_id, product_type) VALUES
290
('3d7ce39b5d4b3e3d22aaafe9b633de51',1206029, 3),
291
('3d7ce39b5d4b3e3d22aaafe9b633de51',5880836, 3),
292
('9d9aad7764b5b2c53004348ef8d34500',2315652, 3);
293
INSERT INTO t2 (order_id, product_id, product_type) VALUES
294
('9d9aad7764b5b2c53004348ef8d34500',2315652, 3);
295
select t1.* from t1
296
left join t2 using(order_id, product_id, product_type)
297
where t2.order_id=NULL;
298
order_id	product_id	product_type
299
select t1.* from t1
300
left join t2 using(order_id, product_id, product_type)
301
where t2.order_id is NULL;
302
order_id	product_id	product_type
303
3d7ce39b5d4b3e3d22aaafe9b633de51	1206029	3
304
3d7ce39b5d4b3e3d22aaafe9b633de51	5880836	3
305
drop table t1,t2;
306
create table t1 (id int);
307
insert into t1 values (null), (0);
308
create table t2 (id int);
309
insert into t2 values (null);
310
select * from t1, t2 where t1.id = t2.id;
311
id	id
312
alter table t1 add key id (id);
313
select * from t1, t2 where t1.id = t2.id;
314
id	id
315
drop table t1,t2;
316
create table t1 (
317
id  integer,
318
id2 integer not null,
319
index (id),
320
index (id2)
321
);
322
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
323
ERROR 23000: Column 'id2' cannot be null
1 by brian
clean slate
324
select * from t1;
325
id	id2
326
select * from t1 where id <=> null;
327
id	id2
328
select * from t1 where id <=> null or id > 0;
329
id	id2
330
select * from t1 where id is null or id > 0;
331
id	id2
332
select * from t1 where id2 <=> null or id2 > 0;
333
id	id2
334
select * from t1 where id2 is null or id2 > 0;
335
id	id2
336
delete from t1 where id <=> NULL;
337
select * from t1;
338
id	id2
339
drop table t1;
340
CREATE TABLE t1 (a int);
341
CREATE TABLE t2 (a int, b int, INDEX idx(a));
342
CREATE TABLE t3 (b int, INDEX idx(b));
343
CREATE TABLE t4 (b int, INDEX idx(b));
344
INSERT INTO t1 VALUES (1), (2), (3), (4);
345
INSERT INTO t2 VALUES (1, 1), (3, 1);
346
INSERT INTO t3 VALUES 
347
(NULL), (NULL), (NULL), (NULL), (NULL),
348
(NULL), (NULL), (NULL), (NULL), (NULL);
349
INSERT INTO t4 SELECT * FROM t3;
350
INSERT INTO t3 SELECT * FROM t4;
351
INSERT INTO t4 SELECT * FROM t3;
352
INSERT INTO t3 SELECT * FROM t4;
353
INSERT INTO t4 SELECT * FROM t3;
354
INSERT INTO t3 SELECT * FROM t4;
355
INSERT INTO t4 SELECT * FROM t3;
356
INSERT INTO t3 SELECT * FROM t4;
357
INSERT INTO t4 SELECT * FROM t3;
358
INSERT INTO t3 SELECT * FROM t4;
359
INSERT INTO t4 SELECT * FROM t3;
360
INSERT INTO t3 SELECT * FROM t4;
361
INSERT INTO t4 SELECT * FROM t3;
362
INSERT INTO t3 SELECT * FROM t4;
363
INSERT INTO t4 SELECT * FROM t3;
364
INSERT INTO t3 SELECT * FROM t4;
365
INSERT INTO t3 VALUES (2), (3);
366
ANALYZE table t1, t2, t3;
367
Table	Op	Msg_type	Msg_text
368
test.t1	analyze	status	OK
369
test.t2	analyze	status	OK
370
test.t3	analyze	status	OK
371
SELECT COUNT(*) FROM t3;
372
COUNT(*)
373
15972
374
EXPLAIN SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a
375
LEFT JOIN t3 ON t2.b=t3.b;
376
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.
377
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	X	
378
1	SIMPLE	t2	ref	idx	idx	5	test.t1.a	X	
379
1	SIMPLE	t3	ref	idx	idx	5	test.t2.b	X	Using index
1 by brian
clean slate
380
FLUSH STATUS ;
381
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
a	a	b	b
384
1	1	1	NULL
385
2	NULL	NULL	NULL
386
3	3	1	NULL
387
4	NULL	NULL	NULL
388
SELECT FOUND_ROWS();
389
FOUND_ROWS()
390
4
391
SHOW STATUS LIKE "handler_read%";
392
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
393
Handler_read_first	1
394
Handler_read_key	10
1 by brian
clean slate
395
Handler_read_next	2
396
Handler_read_prev	0
397
Handler_read_rnd	0
398
Handler_read_rnd_next	5
399
DROP TABLE t1,t2,t3,t4;
400
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
401
a int default NULL,
402
b int default NULL,
1 by brian
clean slate
403
KEY a (a,b)
404
);
405
INSERT INTO t1 VALUES (0,10),(0,11),(0,12);
406
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
407
a int default NULL,
408
b int default NULL,
1 by brian
clean slate
409
KEY a (a)
410
);
411
INSERT INTO t2 VALUES (3,NULL),(3,11),(3,12);
412
SELECT * FROM t2 inner join t1 WHERE ( t1.a = 0 OR t1.a IS NULL) AND t2.a = 3 AND t2.b = t1.b;
413
a	b	a	b
414
3	11	0	11
415
3	12	0	12
416
drop table t1, t2;
417
End of 5.0 tests