Commit c1ebb566 authored by Igor Babaev's avatar Igor Babaev

Merge.

parents a70f7aa5 64986873
...@@ -1828,4 +1828,37 @@ USA Miami Miami ...@@ -1828,4 +1828,37 @@ USA Miami Miami
USA Miami Miami USA Miami Miami
SET @@tmp_table_size=default; SET @@tmp_table_size=default;
drop table t1,t2,t3; drop table t1,t2,t3;
#
# BUG#882994: Crash in QUICK_RANGE_SELECT::reset with derived_with_keys
#
CREATE TABLE t2 (
pk varchar(33),
col_varchar_key varchar(3) NOT NULL,
col_varchar_nokey varchar(52) NOT NULL);
INSERT INTO t2 VALUES ('NICSpanish','NIC','Spanish'),
('NERHausa','NER','Hausa'),('NGAJoruba','NGA','Joruba'),
('NIUNiue','NIU','Niue'),('NFKEnglish','NFK','English'),
('NORNorwegian','NOR','Norwegian'),('CIVAkan','CIV','Akan'),
('OMNArabic','OMN','Arabic'),('PAKPunjabi','PAK','Punjabi'),
('PLWPalau','PLW','Palau'),('PANSpanish','PAN','Spanish'),
('PNGPapuan Langua','PNG','Papuan Languages'), ('PRYSpanish','PRY','Spanish'),
('PERSpanish','PER','Spanish'), ('PCNPitcairnese','PCN','Pitcairnese'),
('MNPPhilippene La','MNP','Philippene Langu'),('PRTPortuguese','PRT','Portuguese'),
('PRISpanish','PRI','Spanish'),('POLPolish','POL','Polish'),('GNQFang','GNQ','Fang');
CREATE TABLE t1 ( col_varchar_nokey varchar(52) NOT NULL ) ;
INSERT INTO t1 VALUES ('Chinese'),('English'),('French'),('German'),
('Italian'),('Japanese'),('Korean'),('Polish'),('Portuguese'),('Spanish'),
('Tagalog'),('Vietnamese');
CREATE TABLE t3 ( col_varchar_key varchar(52)) ;
INSERT INTO t3 VALUES ('United States');
set @tmp_882994= @@max_heap_table_size;
set max_heap_table_size=1;
SELECT *
FROM t3 JOIN
( SELECT t2.* FROM t1, t2 ) AS alias2
ON ( alias2.col_varchar_nokey = t3.col_varchar_key )
ORDER BY CONCAT(alias2.col_varchar_nokey);
col_varchar_key pk col_varchar_key col_varchar_nokey
set max_heap_table_size= @tmp_882994;
drop table t1,t2,t3;
set optimizer_switch=@exit_optimizer_switch; set optimizer_switch=@exit_optimizer_switch;
...@@ -275,7 +275,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -275,7 +275,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= all (select b from t2); select * from t3 where a >= all (select b from t2);
a a
7 7
...@@ -1639,7 +1639,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1639,7 +1639,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= some (select b from t2); select * from t3 where a >= some (select b from t2);
a a
explain extended select * from t3 where a >= some (select b from t2); explain extended select * from t3 where a >= some (select b from t2);
...@@ -1647,7 +1647,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1647,7 +1647,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= all (select b from t2 group by 1); select * from t3 where a >= all (select b from t2 group by 1);
a a
6 6
...@@ -1658,7 +1658,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1658,7 +1658,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select NULL from `test`.`t2` group by 1) > `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select NULL from `test`.`t2` group by 1) > <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= some (select b from t2 group by 1); select * from t3 where a >= some (select b from t2 group by 1);
a a
explain extended select * from t3 where a >= some (select b from t2 group by 1); explain extended select * from t3 where a >= some (select b from t2 group by 1);
...@@ -1666,7 +1666,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1666,7 +1666,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(<min>(select NULL from `test`.`t2` group by 1) <= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(<min>(select NULL from `test`.`t2` group by 1) <= <cache>(`test`.`t3`.`a`))))
select * from t3 where NULL >= any (select b from t2); select * from t3 where NULL >= any (select b from t2);
a a
explain extended select * from t3 where NULL >= any (select b from t2); explain extended select * from t3 where NULL >= any (select b from t2);
...@@ -1709,7 +1709,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1709,7 +1709,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary 2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`))))
drop table t2, t3; drop table t2, t3;
CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ; CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ;
INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now()); INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now());
......
...@@ -2104,5 +2104,32 @@ NULL ...@@ -2104,5 +2104,32 @@ NULL
deallocate prepare st1; deallocate prepare st1;
drop table t1, t2, t3; drop table t1, t2, t3;
set optimizer_switch=@subselect4_tmp; set optimizer_switch=@subselect4_tmp;
#
# LP BUG#833702 Wrong result with nested IN and singlerow subqueries and equality propagation
#
CREATE TABLE t2 (c int , a int, b int);
INSERT INTO t2 VALUES (10,7,0);
CREATE TABLE t3 (a int, b int) ;
INSERT INTO t3 VALUES (5,0),(7,0);
CREATE TABLE t4 (a int);
INSERT INTO t4 VALUES (2),(8);
set @@optimizer_switch='in_to_exists=on,materialization=off,subquery_cache=off';
SELECT * FROM t2
WHERE t2.b IN (SELECT b FROM t3 WHERE t3.a = t2.a AND a < SOME (SELECT * FROM t4))
OR ( t2.c > 242 );
c a b
10 7 0
EXPLAIN SELECT * FROM t2
WHERE t2.b IN (SELECT t3.b FROM t3 WHERE t3.a < ANY (SELECT t4.a FROM t4) and t3.a = 7);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 system NULL NULL NULL NULL 1
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where
3 SUBQUERY t4 ALL NULL NULL NULL NULL 2
SELECT * FROM t2
WHERE t2.b IN (SELECT t3.b FROM t3 WHERE t3.a < ANY (SELECT t4.a FROM t4) and t3.a = 7);
c a b
10 7 0
drop table t2, t3, t4;
set optimizer_switch=@subselect4_tmp;
SET optimizer_switch= @@global.optimizer_switch; SET optimizer_switch= @@global.optimizer_switch;
set @@tmp_table_size= @@global.tmp_table_size; set @@tmp_table_size= @@global.tmp_table_size;
...@@ -280,7 +280,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -280,7 +280,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= all (select b from t2); select * from t3 where a >= all (select b from t2);
a a
7 7
...@@ -1644,7 +1644,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1644,7 +1644,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= some (select b from t2); select * from t3 where a >= some (select b from t2);
a a
explain extended select * from t3 where a >= some (select b from t2); explain extended select * from t3 where a >= some (select b from t2);
...@@ -1652,7 +1652,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1652,7 +1652,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= all (select b from t2 group by 1); select * from t3 where a >= all (select b from t2 group by 1);
a a
6 6
...@@ -1663,7 +1663,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1663,7 +1663,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select NULL from `test`.`t2` group by 1) > `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select NULL from `test`.`t2` group by 1) > <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= some (select b from t2 group by 1); select * from t3 where a >= some (select b from t2 group by 1);
a a
explain extended select * from t3 where a >= some (select b from t2 group by 1); explain extended select * from t3 where a >= some (select b from t2 group by 1);
...@@ -1671,7 +1671,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1671,7 +1671,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(<min>(select NULL from `test`.`t2` group by 1) <= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(<min>(select NULL from `test`.`t2` group by 1) <= <cache>(`test`.`t3`.`a`))))
select * from t3 where NULL >= any (select b from t2); select * from t3 where NULL >= any (select b from t2);
a a
explain extended select * from t3 where NULL >= any (select b from t2); explain extended select * from t3 where NULL >= any (select b from t2);
...@@ -1714,7 +1714,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1714,7 +1714,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary 2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`))))
drop table t2, t3; drop table t2, t3;
CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ; CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ;
INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now()); INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now());
......
...@@ -276,7 +276,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -276,7 +276,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= all (select b from t2); select * from t3 where a >= all (select b from t2);
a a
7 7
...@@ -1640,7 +1640,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1640,7 +1640,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= some (select b from t2); select * from t3 where a >= some (select b from t2);
a a
explain extended select * from t3 where a >= some (select b from t2); explain extended select * from t3 where a >= some (select b from t2);
...@@ -1648,7 +1648,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1648,7 +1648,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= all (select b from t2 group by 1); select * from t3 where a >= all (select b from t2 group by 1);
a a
6 6
...@@ -1659,7 +1659,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1659,7 +1659,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select NULL from `test`.`t2` group by 1) > `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select NULL from `test`.`t2` group by 1) > <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= some (select b from t2 group by 1); select * from t3 where a >= some (select b from t2 group by 1);
a a
explain extended select * from t3 where a >= some (select b from t2 group by 1); explain extended select * from t3 where a >= some (select b from t2 group by 1);
...@@ -1667,7 +1667,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1667,7 +1667,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(<min>(select NULL from `test`.`t2` group by 1) <= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(<min>(select NULL from `test`.`t2` group by 1) <= <cache>(`test`.`t3`.`a`))))
select * from t3 where NULL >= any (select b from t2); select * from t3 where NULL >= any (select b from t2);
a a
explain extended select * from t3 where NULL >= any (select b from t2); explain extended select * from t3 where NULL >= any (select b from t2);
...@@ -1710,7 +1710,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1710,7 +1710,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary 2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`))))
drop table t2, t3; drop table t2, t3;
CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ; CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ;
INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now()); INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now());
......
...@@ -279,7 +279,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -279,7 +279,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= all (select b from t2); select * from t3 where a >= all (select b from t2);
a a
7 7
...@@ -1643,7 +1643,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1643,7 +1643,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= some (select b from t2); select * from t3 where a >= some (select b from t2);
a a
explain extended select * from t3 where a >= some (select b from t2); explain extended select * from t3 where a >= some (select b from t2);
...@@ -1651,7 +1651,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1651,7 +1651,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= all (select b from t2 group by 1); select * from t3 where a >= all (select b from t2 group by 1);
a a
6 6
...@@ -1662,7 +1662,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1662,7 +1662,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select NULL from `test`.`t2` group by 1) > `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select NULL from `test`.`t2` group by 1) > <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= some (select b from t2 group by 1); select * from t3 where a >= some (select b from t2 group by 1);
a a
explain extended select * from t3 where a >= some (select b from t2 group by 1); explain extended select * from t3 where a >= some (select b from t2 group by 1);
...@@ -1670,7 +1670,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1670,7 +1670,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(<min>(select NULL from `test`.`t2` group by 1) <= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(<min>(select NULL from `test`.`t2` group by 1) <= <cache>(`test`.`t3`.`a`))))
select * from t3 where NULL >= any (select b from t2); select * from t3 where NULL >= any (select b from t2);
a a
explain extended select * from t3 where NULL >= any (select b from t2); explain extended select * from t3 where NULL >= any (select b from t2);
...@@ -1713,7 +1713,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1713,7 +1713,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary 2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`))))
drop table t2, t3; drop table t2, t3;
CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ; CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ;
INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now()); INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now());
......
...@@ -276,7 +276,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -276,7 +276,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= all (select b from t2); select * from t3 where a >= all (select b from t2);
a a
7 7
...@@ -1640,7 +1640,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1640,7 +1640,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= some (select b from t2); select * from t3 where a >= some (select b from t2);
a a
explain extended select * from t3 where a >= some (select b from t2); explain extended select * from t3 where a >= some (select b from t2);
...@@ -1648,7 +1648,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1648,7 +1648,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= all (select b from t2 group by 1); select * from t3 where a >= all (select b from t2 group by 1);
a a
6 6
...@@ -1659,7 +1659,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1659,7 +1659,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select NULL from `test`.`t2` group by 1) > `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select NULL from `test`.`t2` group by 1) > <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= some (select b from t2 group by 1); select * from t3 where a >= some (select b from t2 group by 1);
a a
explain extended select * from t3 where a >= some (select b from t2 group by 1); explain extended select * from t3 where a >= some (select b from t2 group by 1);
...@@ -1667,7 +1667,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1667,7 +1667,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found 2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(<min>(select NULL from `test`.`t2` group by 1) <= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(<min>(select NULL from `test`.`t2` group by 1) <= <cache>(`test`.`t3`.`a`))))
select * from t3 where NULL >= any (select b from t2); select * from t3 where NULL >= any (select b from t2);
a a
explain extended select * from t3 where NULL >= any (select b from t2); explain extended select * from t3 where NULL >= any (select b from t2);
...@@ -1710,7 +1710,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1710,7 +1710,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary 2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`))))
drop table t2, t3; drop table t2, t3;
CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ; CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ;
INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now()); INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now());
......
...@@ -270,7 +270,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -270,7 +270,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= all (select b from t2); select * from t3 where a >= all (select b from t2);
a a
7 7
...@@ -1504,7 +1504,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1504,7 +1504,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 0 0.00 2 SUBQUERY t2 ALL NULL NULL NULL NULL 0 0.00
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(`test`.`t2`.`b`) from `test`.`t2`) > `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(`test`.`t2`.`b`) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= some (select b from t2); select * from t3 where a >= some (select b from t2);
a a
explain extended select * from t3 where a >= some (select b from t2); explain extended select * from t3 where a >= some (select b from t2);
...@@ -1512,7 +1512,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1512,7 +1512,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 0 0.00 2 SUBQUERY t2 ALL NULL NULL NULL NULL 0 0.00
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= all (select b from t2 group by 1); select * from t3 where a >= all (select b from t2 group by 1);
a a
6 6
...@@ -1523,7 +1523,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1523,7 +1523,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 0 0.00 Using temporary 2 SUBQUERY t2 ALL NULL NULL NULL NULL 0 0.00 Using temporary
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select `test`.`t2`.`b` from `test`.`t2` group by 1) > `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select `test`.`t2`.`b` from `test`.`t2` group by 1) > <cache>(`test`.`t3`.`a`))))
select * from t3 where a >= some (select b from t2 group by 1); select * from t3 where a >= some (select b from t2 group by 1);
a a
explain extended select * from t3 where a >= some (select b from t2 group by 1); explain extended select * from t3 where a >= some (select b from t2 group by 1);
...@@ -1531,7 +1531,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1531,7 +1531,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 0 0.00 Using temporary 2 SUBQUERY t2 ALL NULL NULL NULL NULL 0 0.00 Using temporary
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(<min>(select `test`.`t2`.`b` from `test`.`t2` group by 1) <= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(<min>(select `test`.`t2`.`b` from `test`.`t2` group by 1) <= <cache>(`test`.`t3`.`a`))))
select * from t3 where NULL >= any (select b from t2); select * from t3 where NULL >= any (select b from t2);
a a
explain extended select * from t3 where NULL >= any (select b from t2); explain extended select * from t3 where NULL >= any (select b from t2);
...@@ -1574,7 +1574,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -1574,7 +1574,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary 2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= `test`.`t3`.`a`))) Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`))))
drop table t2, t3; drop table t2, t3;
CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ; CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ;
INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now()); INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now());
......
...@@ -1221,5 +1221,45 @@ SET @@tmp_table_size=default; ...@@ -1221,5 +1221,45 @@ SET @@tmp_table_size=default;
drop table t1,t2,t3; drop table t1,t2,t3;
--echo #
--echo # BUG#882994: Crash in QUICK_RANGE_SELECT::reset with derived_with_keys
--echo #
CREATE TABLE t2 (
pk varchar(33),
col_varchar_key varchar(3) NOT NULL,
col_varchar_nokey varchar(52) NOT NULL);
INSERT INTO t2 VALUES ('NICSpanish','NIC','Spanish'),
('NERHausa','NER','Hausa'),('NGAJoruba','NGA','Joruba'),
('NIUNiue','NIU','Niue'),('NFKEnglish','NFK','English'),
('NORNorwegian','NOR','Norwegian'),('CIVAkan','CIV','Akan'),
('OMNArabic','OMN','Arabic'),('PAKPunjabi','PAK','Punjabi'),
('PLWPalau','PLW','Palau'),('PANSpanish','PAN','Spanish'),
('PNGPapuan Langua','PNG','Papuan Languages'), ('PRYSpanish','PRY','Spanish'),
('PERSpanish','PER','Spanish'), ('PCNPitcairnese','PCN','Pitcairnese'),
('MNPPhilippene La','MNP','Philippene Langu'),('PRTPortuguese','PRT','Portuguese'),
('PRISpanish','PRI','Spanish'),('POLPolish','POL','Polish'),('GNQFang','GNQ','Fang');
CREATE TABLE t1 ( col_varchar_nokey varchar(52) NOT NULL ) ;
INSERT INTO t1 VALUES ('Chinese'),('English'),('French'),('German'),
('Italian'),('Japanese'),('Korean'),('Polish'),('Portuguese'),('Spanish'),
('Tagalog'),('Vietnamese');
CREATE TABLE t3 ( col_varchar_key varchar(52)) ;
INSERT INTO t3 VALUES ('United States');
set @tmp_882994= @@max_heap_table_size;
--disable_warnings
set max_heap_table_size=1;
--enable_warnings
SELECT *
FROM t3 JOIN
( SELECT t2.* FROM t1, t2 ) AS alias2
ON ( alias2.col_varchar_nokey = t3.col_varchar_key )
ORDER BY CONCAT(alias2.col_varchar_nokey);
set max_heap_table_size= @tmp_882994;
drop table t1,t2,t3;
# The following command must be the last one the file # The following command must be the last one the file
set optimizer_switch=@exit_optimizer_switch; set optimizer_switch=@exit_optimizer_switch;
...@@ -1736,5 +1736,33 @@ drop table t1, t2, t3; ...@@ -1736,5 +1736,33 @@ drop table t1, t2, t3;
set optimizer_switch=@subselect4_tmp; set optimizer_switch=@subselect4_tmp;
--echo #
--echo # LP BUG#833702 Wrong result with nested IN and singlerow subqueries and equality propagation
--echo #
CREATE TABLE t2 (c int , a int, b int);
INSERT INTO t2 VALUES (10,7,0);
CREATE TABLE t3 (a int, b int) ;
INSERT INTO t3 VALUES (5,0),(7,0);
CREATE TABLE t4 (a int);
INSERT INTO t4 VALUES (2),(8);
set @@optimizer_switch='in_to_exists=on,materialization=off,subquery_cache=off';
SELECT * FROM t2
WHERE t2.b IN (SELECT b FROM t3 WHERE t3.a = t2.a AND a < SOME (SELECT * FROM t4))
OR ( t2.c > 242 );
EXPLAIN SELECT * FROM t2
WHERE t2.b IN (SELECT t3.b FROM t3 WHERE t3.a < ANY (SELECT t4.a FROM t4) and t3.a = 7);
SELECT * FROM t2
WHERE t2.b IN (SELECT t3.b FROM t3 WHERE t3.a < ANY (SELECT t4.a FROM t4) and t3.a = 7);
drop table t2, t3, t4;
set optimizer_switch=@subselect4_tmp;
SET optimizer_switch= @@global.optimizer_switch; SET optimizer_switch= @@global.optimizer_switch;
set @@tmp_table_size= @@global.tmp_table_size; set @@tmp_table_size= @@global.tmp_table_size;
# #
# Table elimination (MWL#17) tests that need debug build # Table elimination (MWL#17) tests that need debug build
# #
--source include/have_debug.inc # In MariaDB 5.3, one can switch table_elimination on/off without debug, too:
## --source include/have_debug.inc
--disable_warnings --disable_warnings
drop table if exists t1, t2; drop table if exists t1, t2;
......
...@@ -1792,7 +1792,7 @@ Item *Item_in_optimizer::transform(Item_transformer transformer, uchar *argument ...@@ -1792,7 +1792,7 @@ Item *Item_in_optimizer::transform(Item_transformer transformer, uchar *argument
if (!new_item) if (!new_item)
return 0; return 0;
if (args[1] != new_item) if (args[1] != new_item)
current_thd->change_item_tree(args, new_item); current_thd->change_item_tree(args + 1, new_item);
} }
else else
{ {
......
...@@ -1698,7 +1698,7 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join) ...@@ -1698,7 +1698,7 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join)
The swap is needed for expressions of type 'f1 < ALL ( SELECT ....)' The swap is needed for expressions of type 'f1 < ALL ( SELECT ....)'
where we want to evaluate the sub query even if f1 would be null. where we want to evaluate the sub query even if f1 would be null.
*/ */
subs= func->create_swap(left_expr, subs); subs= func->create_swap(*(optimizer->get_cache()), subs);
thd->change_item_tree(place, subs); thd->change_item_tree(place, subs);
if (subs->fix_fields(thd, &subs)) if (subs->fix_fields(thd, &subs))
DBUG_RETURN(true); DBUG_RETURN(true);
......
...@@ -354,6 +354,12 @@ public: ...@@ -354,6 +354,12 @@ public:
Table record buffer used by this quick select. Table record buffer used by this quick select.
*/ */
uchar *record; uchar *record;
virtual void replace_handler(handler *new_file)
{
DBUG_ASSERT(0); /* Only supported in QUICK_RANGE_SELECT */
}
#ifndef DBUG_OFF #ifndef DBUG_OFF
/* /*
Print quick select information to DBUG_FILE. Caller is responsible Print quick select information to DBUG_FILE. Caller is responsible
...@@ -449,6 +455,7 @@ public: ...@@ -449,6 +455,7 @@ public:
#ifndef DBUG_OFF #ifndef DBUG_OFF
void dbug_dump(int indent, bool verbose); void dbug_dump(int indent, bool verbose);
#endif #endif
virtual void replace_handler(handler *new_file) { file= new_file; }
private: private:
/* Default copy ctor used by QUICK_SELECT_DESC */ /* Default copy ctor used by QUICK_SELECT_DESC */
friend class TRP_ROR_INTERSECT; friend class TRP_ROR_INTERSECT;
......
...@@ -588,10 +588,8 @@ void eliminate_tables(JOIN *join) ...@@ -588,10 +588,8 @@ void eliminate_tables(JOIN *join)
if (!join->outer_join) if (!join->outer_join)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
#ifndef DBUG_OFF
if (!optimizer_flag(thd, OPTIMIZER_SWITCH_TABLE_ELIMINATION)) if (!optimizer_flag(thd, OPTIMIZER_SWITCH_TABLE_ELIMINATION))
DBUG_VOID_RETURN; /* purecov: inspected */ DBUG_VOID_RETURN; /* purecov: inspected */
#endif
/* Find the tables that are referred to from WHERE/HAVING */ /* Find the tables that are referred to from WHERE/HAVING */
used_tables= (join->conds? join->conds->used_tables() : 0) | used_tables= (join->conds? join->conds->used_tables() : 0) |
......
...@@ -9701,6 +9701,8 @@ bool JOIN_TAB::preread_init() ...@@ -9701,6 +9701,8 @@ bool JOIN_TAB::preread_init()
derived, DT_CREATE | DT_FILL)) derived, DT_CREATE | DT_FILL))
return TRUE; return TRUE;
preread_init_done= TRUE; preread_init_done= TRUE;
if (select && select->quick)
select->quick->replace_handler(table->file);
return FALSE; return FALSE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment