49
49
# force the use of materialization
50
50
set @@optimizer_switch=no_semijoin;
52
/******************************************************************************
54
******************************************************************************/
55
# non-indexed nullable fields
57
select * from t1 where a1 in (select b1 from t2 where b1 > '0');
58
select * from t1 where a1 in (select b1 from t2 where b1 > '0');
61
select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1);
62
select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1);
65
select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2);
66
select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2);
52
--echo /********************************************************************
53
--echo * Simple tests.
54
--echo ********************************************************************/
55
--echo # non-indexed nullable fields
58
select * from t1 where a1 in (select b1 from t2 where b1 > '0');
59
select * from t1 where a1 in (select b1 from t2 where b1 > '0');
63
select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1);
64
select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1);
68
select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2);
69
select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2);
69
73
select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1);
70
74
select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1);
74
select * from t1i where a1 in (select b1 from t2i where b1 > '0');
75
select * from t1i where a1 in (select b1 from t2i where b1 > '0');
78
select * from t1i where a1 in (select b1 from t2i where b1 > '0' group by b1);
79
select * from t1i where a1 in (select b1 from t2i where b1 > '0' group by b1);
82
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0');
83
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0');
86
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0' group by b1, b2);
87
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0' group by b1, b2);
79
select * from t1i where a1 in (select b1 from t2i where b1 > '0');
80
select * from t1i where a1 in (select b1 from t2i where b1 > '0');
84
select * from t1i where a1 in (select b1 from t2i where b1 > '0' group by b1);
85
select * from t1i where a1 in (select b1 from t2i where b1 > '0' group by b1);
89
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0');
90
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0');
94
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0' group by b1, b2);
95
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0' group by b1, b2);
90
99
select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
91
100
select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
93
102
# materialize the result of ORDER BY
94
103
# non-indexed fields
96
106
select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2);
97
107
select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2);
100
111
select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2);
101
112
select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2);
103
114
# nested subqueries, views
106
where (a1, a2) in (select b1, b2 from t2 where b1 > '0') and
107
(a1, a2) in (select c1, c2 from t3
108
where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
110
where (a1, a2) in (select b1, b2 from t2 where b1 > '0') and
111
(a1, a2) in (select c1, c2 from t3
112
where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
116
where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and
117
(a1, a2) in (select c1, c2 from t3i
118
where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
120
where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and
121
(a1, a2) in (select c1, c2 from t3i
122
where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
118
where (a1, a2) in (select b1, b2 from t2 where b1 > '0') and
119
(a1, a2) in (select c1, c2 from t3
120
where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
122
where (a1, a2) in (select b1, b2 from t2 where b1 > '0') and
123
(a1, a2) in (select c1, c2 from t3
124
where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
129
where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and
130
(a1, a2) in (select c1, c2 from t3i
131
where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
133
where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and
134
(a1, a2) in (select c1, c2 from t3i
135
where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
126
140
where (a1, a2) in (select b1, b2 from t2
609
633
set @@optimizer_switch=no_semijoin;
611
635
# Test that default values of Cached_item are not used for comparison
612
create table t1 (s1 int) ENGINE=MyISAM;
613
create table t2 (s2 int) ENGINE=MyISAM;
636
create temporary table t1 (s1 int) ENGINE=MyISAM;
637
create temporary table t2 (s2 int) ENGINE=MyISAM;
614
638
insert into t1 values (5),(1),(0);
615
639
insert into t2 values (0), (1);
616
640
select s2 from t2 where s2 in (select s1 from t1);
617
641
drop table t1, t2;
619
create table t1 (a int not null, b int not null) ENGINE=MyISAM;
620
create table t2 (c int not null, d int not null) ENGINE=MyISAM;
621
create table t3 (e int not null) ENGINE=MyISAM;
643
create temporary table t1 (a int not null, b int not null) ENGINE=MyISAM;
644
create temporary table t2 (c int not null, d int not null) ENGINE=MyISAM;
645
create temporary table t3 (e int not null) ENGINE=MyISAM;
623
647
# the first outer row has no matching inner row
624
648
insert into t1 values (1,10);