Commit 65a94e34 authored by unknown's avatar unknown
Browse files

added test for BUG#3759

parent 2466cbc4
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -2327,3 +2327,24 @@ select * from t2,t3 where t2.s = t3.s;
s	s
two		two	
drop table t1, t2, t3;
create table t1 (a integer,  b integer, index(a), index(b));
create table t2 (c integer,  d integer, index(c), index(d));
insert into t1 values (1,2), (2,2), (3,2), (4,2);
insert into t2 values (1,3), (2,3), (3,4), (4,4);
explain select * from t1 left join t2 on a=c where d in (4);
table	type	possible_keys	key	key_len	ref	rows	Extra
t2	ref	c,d	d	5	const	2	Using where
t1	ALL	a	NULL	NULL	NULL	3	Using where
select * from t1 left join t2 on a=c where d in (4);
a	b	c	d
3	2	3	4
4	2	4	4
explain select * from t1 left join t2 on a=c where d = 4;
table	type	possible_keys	key	key_len	ref	rows	Extra
t2	ref	c,d	d	5	const	2	Using where
t1	ALL	a	NULL	NULL	NULL	3	Using where
select * from t1 left join t2 on a=c where d = 4;
a	b	c	d
3	2	3	4
4	2	4	4
drop table t1, t2;
+14 −0
Original line number Diff line number Diff line
@@ -1874,3 +1874,17 @@ select * from t3 where s = 'one';
select * from t1,t2 where t1.s = t2.s;
select * from t2,t3 where t2.s = t3.s;
drop table t1, t2, t3;

#
# Bug #3759
# Both queries should produce identical plans and results.
#
create table t1 (a integer,  b integer, index(a), index(b));
create table t2 (c integer,  d integer, index(c), index(d));
insert into t1 values (1,2), (2,2), (3,2), (4,2);
insert into t2 values (1,3), (2,3), (3,4), (4,4);
explain select * from t1 left join t2 on a=c where d in (4);
select * from t1 left join t2 on a=c where d in (4);
explain select * from t1 left join t2 on a=c where d = 4;
select * from t1 left join t2 on a=c where d = 4;
drop table t1, t2;
 No newline at end of file