summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2012-03-24 18:21:22 +0100
committerunknown <knielsen@knielsen-hq.org>2012-03-24 18:21:22 +0100
commit335de5db1834d3aeac507f18fcd5143c22150500 (patch)
tree95ac83922a28c81982c9ad89fcaba6c040b5111b /mysql-test
parentb34cfe9327f2dcedb6bebfacdc2e757b6285426d (diff)
parentf72e0e686b2f3688fe98685107a293de5012be03 (diff)
downloadmariadb-git-335de5db1834d3aeac507f18fcd5143c22150500.tar.gz
Merge mariadb 5.3->mariadb 5.5
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/filesort_debug.result2
-rw-r--r--mysql-test/r/join.result70
-rw-r--r--mysql-test/r/range_vs_index_merge.result176
-rw-r--r--mysql-test/r/range_vs_index_merge_innodb,innodb_plugin.rdiff22
-rw-r--r--mysql-test/r/range_vs_index_merge_innodb.result176
-rw-r--r--mysql-test/r/subselect_sj.result33
-rw-r--r--mysql-test/r/subselect_sj_jcl6.result33
-rw-r--r--mysql-test/t/filesort_debug.test2
-rw-r--r--mysql-test/t/join.test68
-rwxr-xr-xmysql-test/t/range_vs_index_merge.test56
-rw-r--r--mysql-test/t/subselect_sj.test35
11 files changed, 669 insertions, 4 deletions
diff --git a/mysql-test/r/filesort_debug.result b/mysql-test/r/filesort_debug.result
index 6759cf13502..218af99f5d0 100644
--- a/mysql-test/r/filesort_debug.result
+++ b/mysql-test/r/filesort_debug.result
@@ -4,7 +4,7 @@ SET @old_debug= @@session.debug;
#
CREATE TABLE t1(f0 int auto_increment primary key, f1 int);
INSERT INTO t1(f1) VALUES (0),(1),(2),(3),(4),(5);
-SET session debug_dbug= '+d,make_char_array_fail';
+SET session debug_dbug= '+d,make_sort_keys_alloc_fail';
CALL mtr.add_suppression("Out of sort memory");
SELECT * FROM t1 ORDER BY f1 ASC, f0;
ERROR HY001: Out of sort memory, consider increasing server sort buffer size
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
index bd661859929..ba16d7dd9de 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -1402,4 +1402,74 @@ select t2.i from t1 left join t2 on t2.i = t1.i where t1.i = '1:1:1';
i
01:01:01
drop table t1,t2;
+#
+# BUG#954900: unexpected empty set due to an invalid build of key ref
+#
+CREATE TABLE t1 (dog_id int(10), birthday date, PRIMARY KEY (dog_id,birthday));
+INSERT INTO t1 VALUES (5918,'2004-07-22');
+CREATE TABLE t2 (dog_id int(10) unsigned, t_id char(1), birthday date, a_id int(10),
+PRIMARY KEY (dog_id,t_id,birthday,a_id));
+INSERT INTO t2 VALUES
+(5918,'N','2004-07-22',5216551), (5918,'N','2004-07-22',5223640),
+(5918,'N','2004-07-22',5389491), (5918,'N','2004-07-22',5749434),
+(5918,'N','2004-07-22',5992424), (5922,'N','2005-06-30',5076957),
+(5924,'N','2000-08-11',20264), (5924,'N','2000-08-11',64251),
+(5924,'N','2000-08-11',74748), (5924,'N','2000-08-11',87590),
+(5924,'N','2000-08-11',104695), (5924,'N','2000-08-11',133136),
+(5924,'N','2000-08-11',5027806), (5924,'N','2000-08-11',5076957),
+(5924,'N','2000-08-11',5166821), (5924,'N','2000-08-11',5181896),
+(5924,'N','2000-08-11',5217908), (5924,'N','2000-08-11',5220812),
+(5924,'N','2000-08-11',5226473), (5924,'N','2000-08-11',5339111),
+(5925,'N','2005-02-10',19227), (5925,'N','2005-02-10',74529),
+(5925,'N','2005-02-10',74748), (5927,'N','2005-08-18',20264),
+(5927,'N','2005-08-18',58364), (5929,'N','2005-01-19',58364),
+(5935,'N','2006-03-10',19227), (5935,'N','2006-03-10',64251),
+(5935,'N','2006-03-10',5222400), (5935,'N','2006-03-10',5226473),
+(5936,'N','2004-10-29',5015032), (5937,'N','2002-04-05',11237),
+(5937,'N','2002-04-05',23911), (5937,'N','2002-04-05',112133),
+(5937,'N','2002-04-05',169721), (5937,'N','2002-04-05',170650),
+(5937,'N','2002-04-05',5014494), (5937,'N','2002-04-05',5166009),
+(5937,'N','2002-04-05',5181871), (5937,'N','2002-04-05',5213380),
+(5937,'N','2002-04-05',5214875), (5937,'N','2002-04-05',5895062),
+(5938,'N','2006-03-24',11237), (5938,'N','2006-03-24',19227),
+(5938,'N','2006-03-24',23911), (5938,'N','2006-03-24',58364),
+(5938,'N','2006-03-24',64251), (5938,'N','2006-03-24',111716),
+(5938,'N','2006-03-24',112702), (5938,'N','2006-03-24',133136),
+(5938,'N','2006-03-24',168718), (5938,'N','2006-03-24',5137136),
+(5938,'N','2006-03-24',5161519), (5938,'N','2006-03-24',5168120),
+(5938,'N','2006-03-24',5219034), (6234,'N','2006-06-02',103058),
+(6234,'N','2006-06-02',5146844), (6235,'N','2006-06-01',12900),
+(6235,'N','2006-06-01',20264), (6235,'N','2006-06-01',64251),
+(6235,'N','2006-06-01',75160), (6235,'N','2006-06-01',5014494),
+(6235,'N','2006-06-01',5181638), (6236,'N','2006-06-06',112595),
+(6236,'N','2006-06-06',5219601), (6236,'N','2006-06-06',5808374);
+CREATE TABLE t3 (dog_id int(10) unsigned);
+INSERT INTO t3 VALUES (5918);
+CREATE TABLE t4 (dog_id int(10), t_id char(1), birthday date, KEY (t_id));
+INSERT INTO t4 VALUES (5918,'N','2004-07-22'), (5919,'N','2004-07-20');
+CREATE TABLE t5 (dog_id int(10) unsigned, UNIQUE KEY (dog_id));
+INSERT INTO t5 VALUES (5918);
+SET @tmp_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch='index_condition_pushdown=off';
+EXPLAIN
+SELECT * FROM t5 DU, t1 D, t4 DT, t2 DSA, t3 DSAR
+WHERE DU.dog_id=D.dog_id AND D.dog_id=DT.dog_id AND D.birthday=DT.birthday AND
+DT.t_id=DSA.t_id AND DT.birthday=DSA.birthday AND DSA.dog_id=DSAR.dog_id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE DU system dog_id NULL NULL NULL 1
+1 SIMPLE D system PRIMARY NULL NULL NULL 1
+1 SIMPLE DSAR system NULL NULL NULL NULL 1
+1 SIMPLE DT range t_id t_id 2 NULL 2 Using where
+1 SIMPLE DSA ref PRIMARY PRIMARY 8 const,test.DT.t_id,test.D.birthday 1 Using index
+SELECT * FROM t5 DU, t1 D, t4 DT, t2 DSA, t3 DSAR
+WHERE DU.dog_id=D.dog_id AND D.dog_id=DT.dog_id AND D.birthday=DT.birthday AND
+DT.t_id=DSA.t_id AND DT.birthday=DSA.birthday AND DSA.dog_id=DSAR.dog_id;
+dog_id dog_id birthday dog_id t_id birthday dog_id t_id birthday a_id dog_id
+5918 5918 2004-07-22 5918 N 2004-07-22 5918 N 2004-07-22 5216551 5918
+5918 5918 2004-07-22 5918 N 2004-07-22 5918 N 2004-07-22 5223640 5918
+5918 5918 2004-07-22 5918 N 2004-07-22 5918 N 2004-07-22 5389491 5918
+5918 5918 2004-07-22 5918 N 2004-07-22 5918 N 2004-07-22 5749434 5918
+5918 5918 2004-07-22 5918 N 2004-07-22 5918 N 2004-07-22 5992424 5918
+SET optimizer_switch=@tmp_optimizer_switch;
+DROP TABLE t1,t2,t3,t4,t5;
SET optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/r/range_vs_index_merge.result b/mysql-test/r/range_vs_index_merge.result
index f8738457dd9..faaa6d2429e 100644
--- a/mysql-test/r/range_vs_index_merge.result
+++ b/mysql-test/r/range_vs_index_merge.result
@@ -1045,6 +1045,182 @@ ID Name Country Population
4030 Sandy USA 101853
4031 Athens-Clarke County USA 101489
4032 Cambridge USA 101355
+set @save_optimizer_switch=@@optimizer_switch;
+CREATE INDEX CityName on City(Name);
+EXPLAIN SELECT Name, Country, Population FROM City WHERE
+(Name='Manila' AND Country='PHL') OR
+(Name='Addis Abeba' AND Country='ETH') OR
+(Name='Jakarta' AND Country='IDN') OR
+(Name='Bangalore' AND Country='IND') OR
+(Name='Teheran' AND Country='IRN') OR
+(Name='Roma' AND Country='ITA') OR
+(Name='Delhi' AND Country='IND') OR
+(Name='Venezia' AND Country='ITA') OR
+(Name='Tokyo' AND Country='JPN') OR
+(Name='Toronto' AND Country='CAN') OR
+(Name='Peking' AND Country='CHN') OR
+(Name='Lagos' AND Country='NGA') OR
+(Name='Tijuana' AND Country='MEX') OR
+(Name='Rabat' AND Country='MAR') OR
+(Name='Seoul' AND Country='KOR') OR
+(Name='Vancouver' AND Country='CAN') OR
+(Name='Kaunas' AND Country='LTU') OR
+(Name='Paris' AND Country='FRA') OR
+(Name='Dakar' AND Country='SEN') OR
+(Name='Basel' AND Country='CHE') OR
+(Name='Praha' AND Country='CZE') OR
+(Name='Ankara' AND Country='TUR') OR
+(Name='Dresden' AND Country='DEU') OR
+(Name='Lugansk' AND Country='UKR') OR
+(Name='Caracas' AND Country='VEN') OR
+(Name='Samara' AND Country='RUS') OR
+(Name='Seattle' AND Country='USA');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE City index_merge Country,CountryPopulation,CountryName,CityName CountryName,CityName 38,35 NULL 28 Using sort_union(CountryName,CityName); Using where
+SELECT Name, Country, Population FROM City WHERE
+(Name='Manila' AND Country='PHL') OR
+(Name='Addis Abeba' AND Country='ETH') OR
+(Name='Jakarta' AND Country='IDN') OR
+(Name='Bangalore' AND Country='IND') OR
+(Name='Teheran' AND Country='IRN') OR
+(Name='Roma' AND Country='ITA') OR
+(Name='Delhi' AND Country='IND') OR
+(Name='Venezia' AND Country='ITA') OR
+(Name='Tokyo' AND Country='JPN') OR
+(Name='Toronto' AND Country='CAN') OR
+(Name='Peking' AND Country='CHN') OR
+(Name='Lagos' AND Country='NGA') OR
+(Name='Tijuana' AND Country='MEX') OR
+(Name='Rabat' AND Country='MAR') OR
+(Name='Seoul' AND Country='KOR') OR
+(Name='Vancouver' AND Country='CAN') OR
+(Name='Kaunas' AND Country='LTU') OR
+(Name='Paris' AND Country='FRA') OR
+(Name='Dakar' AND Country='SEN') OR
+(Name='Basel' AND Country='CHE') OR
+(Name='Praha' AND Country='CZE') OR
+(Name='Ankara' AND Country='TUR') OR
+(Name='Dresden' AND Country='DEU') OR
+(Name='Lugansk' AND Country='UKR') OR
+(Name='Caracas' AND Country='VEN') OR
+(Name='Samara' AND Country='RUS') OR
+(Name='Seattle' AND Country='USA');
+Name Country Population
+Addis Abeba ETH 2495000
+Manila PHL 1581082
+Jakarta IDN 9604900
+Delhi IND 7206704
+Bangalore IND 2660088
+Teheran IRN 6758845
+Roma ITA 2643581
+Venezia ITA 277305
+Tokyo JPN 7980230
+Toronto CAN 688275
+Vancouver CAN 514008
+Peking CHN 7472000
+Seoul KOR 9981619
+Kaunas LTU 412639
+Rabat MAR 623457
+Tijuana MEX 1212232
+Lagos NGA 1518000
+Paris FRA 2125246
+Dresden DEU 476668
+Dakar SEN 785071
+Basel CHE 166700
+Praha CZE 1181126
+Ankara TUR 3038159
+Lugansk UKR 469000
+Caracas VEN 1975294
+Samara RUS 1156100
+Seattle USA 563374
+set optimizer_switch='index_merge=off';
+EXPLAIN SELECT Name, Country, Population FROM City WHERE
+(Name='Manila' AND Country='PHL') OR
+(Name='Addis Abeba' AND Country='ETH') OR
+(Name='Jakarta' AND Country='IDN') OR
+(Name='Bangalore' AND Country='IND') OR
+(Name='Teheran' AND Country='IRN') OR
+(Name='Roma' AND Country='ITA') OR
+(Name='Delhi' AND Country='IND') OR
+(Name='Venezia' AND Country='ITA') OR
+(Name='Tokyo' AND Country='JPN') OR
+(Name='Toronto' AND Country='CAN') OR
+(Name='Peking' AND Country='CHN') OR
+(Name='Lagos' AND Country='NGA') OR
+(Name='Tijuana' AND Country='MEX') OR
+(Name='Rabat' AND Country='MAR') OR
+(Name='Seoul' AND Country='KOR') OR
+(Name='Vancouver' AND Country='CAN') OR
+(Name='Kaunas' AND Country='LTU') OR
+(Name='Paris' AND Country='FRA') OR
+(Name='Dakar' AND Country='SEN') OR
+(Name='Basel' AND Country='CHE') OR
+(Name='Praha' AND Country='CZE') OR
+(Name='Ankara' AND Country='TUR') OR
+(Name='Dresden' AND Country='DEU') OR
+(Name='Lugansk' AND Country='UKR') OR
+(Name='Caracas' AND Country='VEN') OR
+(Name='Samara' AND Country='RUS') OR
+(Name='Seattle' AND Country='USA');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 29 Using index condition; Using where
+SELECT Name, Country, Population FROM City WHERE
+(Name='Manila' AND Country='PHL') OR
+(Name='Addis Abeba' AND Country='ETH') OR
+(Name='Jakarta' AND Country='IDN') OR
+(Name='Bangalore' AND Country='IND') OR
+(Name='Teheran' AND Country='IRN') OR
+(Name='Roma' AND Country='ITA') OR
+(Name='Delhi' AND Country='IND') OR
+(Name='Venezia' AND Country='ITA') OR
+(Name='Tokyo' AND Country='JPN') OR
+(Name='Toronto' AND Country='CAN') OR
+(Name='Peking' AND Country='CHN') OR
+(Name='Lagos' AND Country='NGA') OR
+(Name='Tijuana' AND Country='MEX') OR
+(Name='Rabat' AND Country='MAR') OR
+(Name='Seoul' AND Country='KOR') OR
+(Name='Vancouver' AND Country='CAN') OR
+(Name='Kaunas' AND Country='LTU') OR
+(Name='Paris' AND Country='FRA') OR
+(Name='Dakar' AND Country='SEN') OR
+(Name='Basel' AND Country='CHE') OR
+(Name='Praha' AND Country='CZE') OR
+(Name='Ankara' AND Country='TUR') OR
+(Name='Dresden' AND Country='DEU') OR
+(Name='Lugansk' AND Country='UKR') OR
+(Name='Caracas' AND Country='VEN') OR
+(Name='Samara' AND Country='RUS') OR
+(Name='Seattle' AND Country='USA');
+Name Country Population
+Toronto CAN 688275
+Vancouver CAN 514008
+Basel CHE 166700
+Peking CHN 7472000
+Praha CZE 1181126
+Dresden DEU 476668
+Addis Abeba ETH 2495000
+Paris FRA 2125246
+Jakarta IDN 9604900
+Bangalore IND 2660088
+Delhi IND 7206704
+Teheran IRN 6758845
+Roma ITA 2643581
+Venezia ITA 277305
+Tokyo JPN 7980230
+Seoul KOR 9981619
+Kaunas LTU 412639
+Rabat MAR 623457
+Tijuana MEX 1212232
+Lagos NGA 1518000
+Manila PHL 1581082
+Samara RUS 1156100
+Dakar SEN 785071
+Ankara TUR 3038159
+Lugansk UKR 469000
+Seattle USA 563374
+Caracas VEN 1975294
+set optimizer_switch=@save_optimizer_switch;
DROP DATABASE world;
use test;
CREATE TABLE t1 (
diff --git a/mysql-test/r/range_vs_index_merge_innodb,innodb_plugin.rdiff b/mysql-test/r/range_vs_index_merge_innodb,innodb_plugin.rdiff
index c71cc7c6b45..5913434caae 100644
--- a/mysql-test/r/range_vs_index_merge_innodb,innodb_plugin.rdiff
+++ b/mysql-test/r/range_vs_index_merge_innodb,innodb_plugin.rdiff
@@ -1,5 +1,5 @@
---- r/range_vs_index_merge_innodb.result 2012-02-23 15:57:49.000000000 +0100
-+++ r/range_vs_index_merge_innodb,innodb_plugin.reject 2012-02-23 19:46:02.000000000 +0100
+--- r/range_vs_index_merge_innodb.result 2012-03-24 17:12:02.124422000 +0100
++++ r/range_vs_index_merge_innodb,innodb_plugin.reject 2012-03-24 18:00:13.647902620 +0100
@@ -50,14 +50,14 @@
WHERE (Population >= 100000 OR Name LIKE 'P%') AND Country='CAN' OR
(Population < 100000 OR Name Like 'T%') AND Country='ARG';
@@ -251,3 +251,21 @@
SELECT * FROM City USE INDEX ()
WHERE ((Population > 101000 AND Population < 11000) OR
ID BETWEEN 3500 AND 3800) AND Country='USA'
+@@ -1077,7 +1077,7 @@
+ (Name='Samara' AND Country='RUS') OR
+ (Name='Seattle' AND Country='USA');
+ id select_type table type possible_keys key key_len ref rows Extra
+-1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 27 Using index condition; Using where
++1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 27 Using where
+ SELECT Name, Country, Population FROM City WHERE
+ (Name='Manila' AND Country='PHL') OR
+ (Name='Addis Abeba' AND Country='ETH') OR
+@@ -1164,7 +1164,7 @@
+ (Name='Samara' AND Country='RUS') OR
+ (Name='Seattle' AND Country='USA');
+ id select_type table type possible_keys key key_len ref rows Extra
+-1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 27 Using index condition; Using where
++1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 27 Using where
+ SELECT Name, Country, Population FROM City WHERE
+ (Name='Manila' AND Country='PHL') OR
+ (Name='Addis Abeba' AND Country='ETH') OR
diff --git a/mysql-test/r/range_vs_index_merge_innodb.result b/mysql-test/r/range_vs_index_merge_innodb.result
index c42f80f0e85..df3a2af0753 100644
--- a/mysql-test/r/range_vs_index_merge_innodb.result
+++ b/mysql-test/r/range_vs_index_merge_innodb.result
@@ -1046,6 +1046,182 @@ ID Name Country Population
4030 Sandy USA 101853
4031 Athens-Clarke County USA 101489
4032 Cambridge USA 101355
+set @save_optimizer_switch=@@optimizer_switch;
+CREATE INDEX CityName on City(Name);
+EXPLAIN SELECT Name, Country, Population FROM City WHERE
+(Name='Manila' AND Country='PHL') OR
+(Name='Addis Abeba' AND Country='ETH') OR
+(Name='Jakarta' AND Country='IDN') OR
+(Name='Bangalore' AND Country='IND') OR
+(Name='Teheran' AND Country='IRN') OR
+(Name='Roma' AND Country='ITA') OR
+(Name='Delhi' AND Country='IND') OR
+(Name='Venezia' AND Country='ITA') OR
+(Name='Tokyo' AND Country='JPN') OR
+(Name='Toronto' AND Country='CAN') OR
+(Name='Peking' AND Country='CHN') OR
+(Name='Lagos' AND Country='NGA') OR
+(Name='Tijuana' AND Country='MEX') OR
+(Name='Rabat' AND Country='MAR') OR
+(Name='Seoul' AND Country='KOR') OR
+(Name='Vancouver' AND Country='CAN') OR
+(Name='Kaunas' AND Country='LTU') OR
+(Name='Paris' AND Country='FRA') OR
+(Name='Dakar' AND Country='SEN') OR
+(Name='Basel' AND Country='CHE') OR
+(Name='Praha' AND Country='CZE') OR
+(Name='Ankara' AND Country='TUR') OR
+(Name='Dresden' AND Country='DEU') OR
+(Name='Lugansk' AND Country='UKR') OR
+(Name='Caracas' AND Country='VEN') OR
+(Name='Samara' AND Country='RUS') OR
+(Name='Seattle' AND Country='USA');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 27 Using index condition; Using where
+SELECT Name, Country, Population FROM City WHERE
+(Name='Manila' AND Country='PHL') OR
+(Name='Addis Abeba' AND Country='ETH') OR
+(Name='Jakarta' AND Country='IDN') OR
+(Name='Bangalore' AND Country='IND') OR
+(Name='Teheran' AND Country='IRN') OR
+(Name='Roma' AND Country='ITA') OR
+(Name='Delhi' AND Country='IND') OR
+(Name='Venezia' AND Country='ITA') OR
+(Name='Tokyo' AND Country='JPN') OR
+(Name='Toronto' AND Country='CAN') OR
+(Name='Peking' AND Country='CHN') OR
+(Name='Lagos' AND Country='NGA') OR
+(Name='Tijuana' AND Country='MEX') OR
+(Name='Rabat' AND Country='MAR') OR
+(Name='Seoul' AND Country='KOR') OR
+(Name='Vancouver' AND Country='CAN') OR
+(Name='Kaunas' AND Country='LTU') OR
+(Name='Paris' AND Country='FRA') OR
+(Name='Dakar' AND Country='SEN') OR
+(Name='Basel' AND Country='CHE') OR
+(Name='Praha' AND Country='CZE') OR
+(Name='Ankara' AND Country='TUR') OR
+(Name='Dresden' AND Country='DEU') OR
+(Name='Lugansk' AND Country='UKR') OR
+(Name='Caracas' AND Country='VEN') OR
+(Name='Samara' AND Country='RUS') OR
+(Name='Seattle' AND Country='USA');
+Name Country Population
+Toronto CAN 688275
+Vancouver CAN 514008
+Basel CHE 166700
+Peking CHN 7472000
+Praha CZE 1181126
+Dresden DEU 476668
+Addis Abeba ETH 2495000
+Paris FRA 2125246
+Jakarta IDN 9604900
+Bangalore IND 2660088
+Delhi IND 7206704
+Teheran IRN 6758845
+Roma ITA 2643581
+Venezia ITA 277305
+Tokyo JPN 7980230
+Seoul KOR 9981619
+Kaunas LTU 412639
+Rabat MAR 623457
+Tijuana MEX 1212232
+Lagos NGA 1518000
+Manila PHL 1581082
+Samara RUS 1156100
+Dakar SEN 785071
+Ankara TUR 3038159
+Lugansk UKR 469000
+Seattle USA 563374
+Caracas VEN 1975294
+set optimizer_switch='index_merge=off';
+EXPLAIN SELECT Name, Country, Population FROM City WHERE
+(Name='Manila' AND Country='PHL') OR
+(Name='Addis Abeba' AND Country='ETH') OR
+(Name='Jakarta' AND Country='IDN') OR
+(Name='Bangalore' AND Country='IND') OR
+(Name='Teheran' AND Country='IRN') OR
+(Name='Roma' AND Country='ITA') OR
+(Name='Delhi' AND Country='IND') OR
+(Name='Venezia' AND Country='ITA') OR
+(Name='Tokyo' AND Country='JPN') OR
+(Name='Toronto' AND Country='CAN') OR
+(Name='Peking' AND Country='CHN') OR
+(Name='Lagos' AND Country='NGA') OR
+(Name='Tijuana' AND Country='MEX') OR
+(Name='Rabat' AND Country='MAR') OR
+(Name='Seoul' AND Country='KOR') OR
+(Name='Vancouver' AND Country='CAN') OR
+(Name='Kaunas' AND Country='LTU') OR
+(Name='Paris' AND Country='FRA') OR
+(Name='Dakar' AND Country='SEN') OR
+(Name='Basel' AND Country='CHE') OR
+(Name='Praha' AND Country='CZE') OR
+(Name='Ankara' AND Country='TUR') OR
+(Name='Dresden' AND Country='DEU') OR
+(Name='Lugansk' AND Country='UKR') OR
+(Name='Caracas' AND Country='VEN') OR
+(Name='Samara' AND Country='RUS') OR
+(Name='Seattle' AND Country='USA');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 27 Using index condition; Using where
+SELECT Name, Country, Population FROM City WHERE
+(Name='Manila' AND Country='PHL') OR
+(Name='Addis Abeba' AND Country='ETH') OR
+(Name='Jakarta' AND Country='IDN') OR
+(Name='Bangalore' AND Country='IND') OR
+(Name='Teheran' AND Country='IRN') OR
+(Name='Roma' AND Country='ITA') OR
+(Name='Delhi' AND Country='IND') OR
+(Name='Venezia' AND Country='ITA') OR
+(Name='Tokyo' AND Country='JPN') OR
+(Name='Toronto' AND Country='CAN') OR
+(Name='Peking' AND Country='CHN') OR
+(Name='Lagos' AND Country='NGA') OR
+(Name='Tijuana' AND Country='MEX') OR
+(Name='Rabat' AND Country='MAR') OR
+(Name='Seoul' AND Country='KOR') OR
+(Name='Vancouver' AND Country='CAN') OR
+(Name='Kaunas' AND Country='LTU') OR
+(Name='Paris' AND Country='FRA') OR
+(Name='Dakar' AND Country='SEN') OR
+(Name='Basel' AND Country='CHE') OR
+(Name='Praha' AND Country='CZE') OR
+(Name='Ankara' AND Country='TUR') OR
+(Name='Dresden' AND Country='DEU') OR
+(Name='Lugansk' AND Country='UKR') OR
+(Name='Caracas' AND Country='VEN') OR
+(Name='Samara' AND Country='RUS') OR
+(Name='Seattle' AND Country='USA');
+Name Country Population
+Toronto CAN 688275
+Vancouver CAN 514008
+Basel CHE 166700
+Peking CHN 7472000
+Praha CZE 1181126
+Dresden DEU 476668
+Addis Abeba ETH 2495000
+Paris FRA 2125246
+Jakarta IDN 9604900
+Bangalore IND 2660088
+Delhi IND 7206704
+Teheran IRN 6758845
+Roma ITA 2643581
+Venezia ITA 277305
+Tokyo JPN 7980230
+Seoul KOR 9981619
+Kaunas LTU 412639
+Rabat MAR 623457
+Tijuana MEX 1212232
+Lagos NGA 1518000
+Manila PHL 1581082
+Samara RUS 1156100
+Dakar SEN 785071
+Ankara TUR 3038159
+Lugansk UKR 469000
+Seattle USA 563374
+Caracas VEN 1975294
+set optimizer_switch=@save_optimizer_switch;
DROP DATABASE world;
use test;
CREATE TABLE t1 (
diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result
index 924d809eb6e..c767ee1663e 100644
--- a/mysql-test/r/subselect_sj.result
+++ b/mysql-test/r/subselect_sj.result
@@ -2638,4 +2638,37 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 100 Using where; Using join buffer (flat, BNL join)
drop table t0,t1,t3;
set optimizer_switch= @tmp_923246;
+#
+# BUG#952583: Server crashes in Item_field::fix_after_pullout on INSERT .. SELECT
+#
+CREATE TABLE t1 ( a INT );
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 ( b INT );
+INSERT INTO t2 VALUES (3),(4);
+INSERT INTO t1
+SELECT * FROM ( SELECT * FROM t1 ) AS alias
+WHERE a IN ( SELECT b FROM t2 );
+DROP TABLE t1, t2;
+#
+# BUG#952372: Server crashes on 2nd execution of PS in find_field_in_tables with semijoin+materialization
+#
+CREATE TABLE t1 ( a INT );
+INSERT INTO t1 VALUES (2),(3);
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE TABLE t2 ( b VARCHAR(1) );
+INSERT INTO t2 VALUES ('v'),('v');
+PREPARE pstmt FROM
+'SELECT DISTINCT a FROM v1, t2
+ WHERE b IN ( SELECT MIN(b) FROM t2 )';
+EXECUTE pstmt;
+a
+2
+3
+EXECUTE pstmt;
+a
+2
+3
+DEALLOCATE PREPARE pstmt;
+DROP VIEW v1;
+DROP TABLE t1, t2;
set optimizer_switch=@subselect_sj_tmp;
diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result
index 6a45a5866f6..38c7f2ff554 100644
--- a/mysql-test/r/subselect_sj_jcl6.result
+++ b/mysql-test/r/subselect_sj_jcl6.result
@@ -2652,6 +2652,39 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 100 Using where; Using join buffer (flat, BNL join)
drop table t0,t1,t3;
set optimizer_switch= @tmp_923246;
+#
+# BUG#952583: Server crashes in Item_field::fix_after_pullout on INSERT .. SELECT
+#
+CREATE TABLE t1 ( a INT );
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 ( b INT );
+INSERT INTO t2 VALUES (3),(4);
+INSERT INTO t1
+SELECT * FROM ( SELECT * FROM t1 ) AS alias
+WHERE a IN ( SELECT b FROM t2 );
+DROP TABLE t1, t2;
+#
+# BUG#952372: Server crashes on 2nd execution of PS in find_field_in_tables with semijoin+materialization
+#
+CREATE TABLE t1 ( a INT );
+INSERT INTO t1 VALUES (2),(3);
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE TABLE t2 ( b VARCHAR(1) );
+INSERT INTO t2 VALUES ('v'),('v');
+PREPARE pstmt FROM
+'SELECT DISTINCT a FROM v1, t2
+ WHERE b IN ( SELECT MIN(b) FROM t2 )';
+EXECUTE pstmt;
+a
+2
+3
+EXECUTE pstmt;
+a
+2
+3
+DEALLOCATE PREPARE pstmt;
+DROP VIEW v1;
+DROP TABLE t1, t2;
set optimizer_switch=@subselect_sj_tmp;
#
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
diff --git a/mysql-test/t/filesort_debug.test b/mysql-test/t/filesort_debug.test
index 88d957e47c3..817b41ab16d 100644
--- a/mysql-test/t/filesort_debug.test
+++ b/mysql-test/t/filesort_debug.test
@@ -11,7 +11,7 @@ SET @old_debug= @@session.debug;
CREATE TABLE t1(f0 int auto_increment primary key, f1 int);
INSERT INTO t1(f1) VALUES (0),(1),(2),(3),(4),(5);
-SET session debug_dbug= '+d,make_char_array_fail';
+SET session debug_dbug= '+d,make_sort_keys_alloc_fail';
CALL mtr.add_suppression("Out of sort memory");
--error ER_OUT_OF_SORTMEMORY
SELECT * FROM t1 ORDER BY f1 ASC, f0;
diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test
index 51bb72e1239..907d39e95fe 100644
--- a/mysql-test/t/join.test
+++ b/mysql-test/t/join.test
@@ -1067,4 +1067,72 @@ insert into t2 values ('1:1:1');
select t2.i from t1 left join t2 on t2.i = t1.i where t1.i = '1:1:1';
drop table t1,t2;
+--echo #
+--echo # BUG#954900: unexpected empty set due to an invalid build of key ref
+--echo #
+
+CREATE TABLE t1 (dog_id int(10), birthday date, PRIMARY KEY (dog_id,birthday));
+INSERT INTO t1 VALUES (5918,'2004-07-22');
+
+CREATE TABLE t2 (dog_id int(10) unsigned, t_id char(1), birthday date, a_id int(10),
+PRIMARY KEY (dog_id,t_id,birthday,a_id));
+INSERT INTO t2 VALUES
+(5918,'N','2004-07-22',5216551), (5918,'N','2004-07-22',5223640),
+(5918,'N','2004-07-22',5389491), (5918,'N','2004-07-22',5749434),
+(5918,'N','2004-07-22',5992424), (5922,'N','2005-06-30',5076957),
+(5924,'N','2000-08-11',20264), (5924,'N','2000-08-11',64251),
+(5924,'N','2000-08-11',74748), (5924,'N','2000-08-11',87590),
+(5924,'N','2000-08-11',104695), (5924,'N','2000-08-11',133136),
+(5924,'N','2000-08-11',5027806), (5924,'N','2000-08-11',5076957),
+(5924,'N','2000-08-11',5166821), (5924,'N','2000-08-11',5181896),
+(5924,'N','2000-08-11',5217908), (5924,'N','2000-08-11',5220812),
+(5924,'N','2000-08-11',5226473), (5924,'N','2000-08-11',5339111),
+(5925,'N','2005-02-10',19227), (5925,'N','2005-02-10',74529),
+(5925,'N','2005-02-10',74748), (5927,'N','2005-08-18',20264),
+(5927,'N','2005-08-18',58364), (5929,'N','2005-01-19',58364),
+(5935,'N','2006-03-10',19227), (5935,'N','2006-03-10',64251),
+(5935,'N','2006-03-10',5222400), (5935,'N','2006-03-10',5226473),
+(5936,'N','2004-10-29',5015032), (5937,'N','2002-04-05',11237),
+(5937,'N','2002-04-05',23911), (5937,'N','2002-04-05',112133),
+(5937,'N','2002-04-05',169721), (5937,'N','2002-04-05',170650),
+(5937,'N','2002-04-05',5014494), (5937,'N','2002-04-05',5166009),
+(5937,'N','2002-04-05',5181871), (5937,'N','2002-04-05',5213380),
+(5937,'N','2002-04-05',5214875), (5937,'N','2002-04-05',5895062),
+(5938,'N','2006-03-24',11237), (5938,'N','2006-03-24',19227),
+(5938,'N','2006-03-24',23911), (5938,'N','2006-03-24',58364),
+(5938,'N','2006-03-24',64251), (5938,'N','2006-03-24',111716),
+(5938,'N','2006-03-24',112702), (5938,'N','2006-03-24',133136),
+(5938,'N','2006-03-24',168718), (5938,'N','2006-03-24',5137136),
+(5938,'N','2006-03-24',5161519), (5938,'N','2006-03-24',5168120),
+(5938,'N','2006-03-24',5219034), (6234,'N','2006-06-02',103058),
+(6234,'N','2006-06-02',5146844), (6235,'N','2006-06-01',12900),
+(6235,'N','2006-06-01',20264), (6235,'N','2006-06-01',64251),
+(6235,'N','2006-06-01',75160), (6235,'N','2006-06-01',5014494),
+(6235,'N','2006-06-01',5181638), (6236,'N','2006-06-06',112595),
+(6236,'N','2006-06-06',5219601), (6236,'N','2006-06-06',5808374);
+
+CREATE TABLE t3 (dog_id int(10) unsigned);
+INSERT INTO t3 VALUES (5918);
+
+CREATE TABLE t4 (dog_id int(10), t_id char(1), birthday date, KEY (t_id));
+INSERT INTO t4 VALUES (5918,'N','2004-07-22'), (5919,'N','2004-07-20');
+
+CREATE TABLE t5 (dog_id int(10) unsigned, UNIQUE KEY (dog_id));
+INSERT INTO t5 VALUES (5918);
+
+SET @tmp_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch='index_condition_pushdown=off';
+
+EXPLAIN
+SELECT * FROM t5 DU, t1 D, t4 DT, t2 DSA, t3 DSAR
+WHERE DU.dog_id=D.dog_id AND D.dog_id=DT.dog_id AND D.birthday=DT.birthday AND
+ DT.t_id=DSA.t_id AND DT.birthday=DSA.birthday AND DSA.dog_id=DSAR.dog_id;
+SELECT * FROM t5 DU, t1 D, t4 DT, t2 DSA, t3 DSAR
+WHERE DU.dog_id=D.dog_id AND D.dog_id=DT.dog_id AND D.birthday=DT.birthday AND
+ DT.t_id=DSA.t_id AND DT.birthday=DSA.birthday AND DSA.dog_id=DSAR.dog_id;
+
+SET optimizer_switch=@tmp_optimizer_switch;
+
+DROP TABLE t1,t2,t3,t4,t5;
+
SET optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/t/range_vs_index_merge.test b/mysql-test/t/range_vs_index_merge.test
index de7e6a0838c..613a7cf5760 100755
--- a/mysql-test/t/range_vs_index_merge.test
+++ b/mysql-test/t/range_vs_index_merge.test
@@ -621,6 +621,62 @@ SELECT * FROM City
(Population BETWEEN 101000 AND 102000 OR Name LIKE 'Pa%');
+#
+# LP bug #954262: index merge oover long disjunction in WHERE
+#
+
+set @save_optimizer_switch=@@optimizer_switch;
+
+CREATE INDEX CityName on City(Name);
+
+let $cond =
+(Name='Manila' AND Country='PHL') OR
+(Name='Addis Abeba' AND Country='ETH') OR
+(Name='Jakarta' AND Country='IDN') OR
+(Name='Bangalore' AND Country='IND') OR
+(Name='Teheran' AND Country='IRN') OR
+(Name='Roma' AND Country='ITA') OR
+(Name='Delhi' AND Country='IND') OR
+(Name='Venezia' AND Country='ITA') OR
+(Name='Tokyo' AND Country='JPN') OR
+(Name='Toronto' AND Country='CAN') OR
+(Name='Peking' AND Country='CHN') OR
+(Name='Lagos' AND Country='NGA') OR
+(Name='Tijuana' AND Country='MEX') OR
+(Name='Rabat' AND Country='MAR') OR
+(Name='Seoul' AND Country='KOR') OR
+(Name='Vancouver' AND Country='CAN') OR
+(Name='Kaunas' AND Country='LTU') OR
+(Name='Paris' AND Country='FRA') OR
+(Name='Dakar' AND Country='SEN') OR
+(Name='Basel' AND Country='CHE') OR
+(Name='Praha' AND Country='CZE') OR
+(Name='Ankara' AND Country='TUR') OR
+(Name='Dresden' AND Country='DEU') OR
+(Name='Lugansk' AND Country='UKR') OR
+(Name='Caracas' AND Country='VEN') OR
+(Name='Samara' AND Country='RUS') OR
+(Name='Seattle' AND Country='USA');
+
+eval
+EXPLAIN SELECT Name, Country, Population FROM City WHERE
+$cond;
+eval
+SELECT Name, Country, Population FROM City WHERE
+$cond;
+
+set optimizer_switch='index_merge=off';
+
+eval
+EXPLAIN SELECT Name, Country, Population FROM City WHERE
+$cond;
+eval
+SELECT Name, Country, Population FROM City WHERE
+$cond;
+
+set optimizer_switch=@save_optimizer_switch;
+
+
DROP DATABASE world;
use test;
diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test
index 6b8a757b9e8..2fb6f6b53b8 100644
--- a/mysql-test/t/subselect_sj.test
+++ b/mysql-test/t/subselect_sj.test
@@ -2331,5 +2331,40 @@ explain select * from t3 where a in (select kp1 from t1 where kp1<20);
drop table t0,t1,t3;
set optimizer_switch= @tmp_923246;
+--echo #
+--echo # BUG#952583: Server crashes in Item_field::fix_after_pullout on INSERT .. SELECT
+--echo #
+CREATE TABLE t1 ( a INT );
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 ( b INT );
+INSERT INTO t2 VALUES (3),(4);
+
+INSERT INTO t1
+SELECT * FROM ( SELECT * FROM t1 ) AS alias
+WHERE a IN ( SELECT b FROM t2 );
+
+DROP TABLE t1, t2;
+
+--echo #
+--echo # BUG#952372: Server crashes on 2nd execution of PS in find_field_in_tables with semijoin+materialization
+--echo #
+CREATE TABLE t1 ( a INT );
+INSERT INTO t1 VALUES (2),(3);
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+CREATE TABLE t2 ( b VARCHAR(1) );
+INSERT INTO t2 VALUES ('v'),('v');
+
+PREPARE pstmt FROM
+ 'SELECT DISTINCT a FROM v1, t2
+ WHERE b IN ( SELECT MIN(b) FROM t2 )';
+
+EXECUTE pstmt;
+EXECUTE pstmt;
+
+DEALLOCATE PREPARE pstmt;
+DROP VIEW v1;
+DROP TABLE t1, t2;
+
# The following command must be the last one the file
set optimizer_switch=@subselect_sj_tmp;