diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index e34cd05ead2..b0cad581048 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -876,7 +876,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 Using index 2 DEPENDENT SUBQUERY t2 index_subquery a a 5 func 2 Using index Warnings: -Note 1003 select high_priority test.t1.a AS `a`,(test.t1.a,(((test.t1.a) in t2 chicking NULL))) AS `t1.a in (select t2.a from t2)` from test.t1 +Note 1003 select high_priority test.t1.a AS `a`,(test.t1.a,(((test.t1.a) in t2 on a chicking NULL))) AS `t1.a in (select t2.a from t2)` from test.t1 CREATE TABLE t3 (a int(11) default '0'); INSERT INTO t3 VALUES (1),(2),(3); SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1; @@ -1308,7 +1308,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 Using where; Using index 2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index Warnings: -Note 1003 select high_priority test.t2.a AS `a` from test.t2 where (test.t2.a,(((test.t2.a) in t1))) +Note 1003 select high_priority test.t2.a AS `a` from test.t2 where (test.t2.a,(((test.t2.a) in t1 on PRIMARY))) select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a 2 @@ -1318,7 +1318,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 Using where; Using index 2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index; Using where Warnings: -Note 1003 select high_priority test.t2.a AS `a` from test.t2 where (test.t2.a,(((test.t2.a) in t1 where (test.t1.b <> 30)))) +Note 1003 select high_priority test.t2.a AS `a` from test.t2 where (test.t2.a,(((test.t2.a) in t1 on PRIMARY where (test.t1.b <> 30)))) select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); a 2 @@ -1347,7 +1347,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index 2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 Using index Warnings: -Note 1003 select high_priority test.t2.a AS `a` from test.t2 where (test.t2.a,(((test.t2.a) in t1))) +Note 1003 select high_priority test.t2.a AS `a` from test.t2 where (test.t2.a,(((test.t2.a) in t1 on a))) select * from t2 where t2.a in (select a from t1 where t1.b <> 30); a 2 @@ -1357,7 +1357,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index 2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 Using index; Using where Warnings: -Note 1003 select high_priority test.t2.a AS `a` from test.t2 where (test.t2.a,(((test.t2.a) in t1 where (test.t1.b <> 30)))) +Note 1003 select high_priority test.t2.a AS `a` from test.t2 where (test.t2.a,(((test.t2.a) in t1 on a where (test.t1.b <> 30)))) select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); a 2 @@ -1384,7 +1384,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index 2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 Using index; Using where Warnings: -Note 1003 select high_priority test.t2.a AS `a` from test.t2 where (test.t2.a,(((test.t2.a) in t1 where (test.t1.b <> 30)))) +Note 1003 select high_priority test.t2.a AS `a` from test.t2 where (test.t2.a,(((test.t2.a) in t1 on a where (test.t1.b <> 30)))) drop table t1, t2, t3; create table t1 (a int, b int); create table t2 (a int, b int); @@ -1477,13 +1477,13 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 Using index 2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index Warnings: -Note 1003 select high_priority test.t1.s1 AS `s1`,not((test.t1.s1,(((test.t1.s1) in t2 chicking NULL)))) AS `s1 NOT IN (SELECT s1 FROM t2)` from test.t1 +Note 1003 select high_priority test.t1.s1 AS `s1`,not((test.t1.s1,(((test.t1.s1) in t2 on s1 chicking NULL)))) AS `s1 NOT IN (SELECT s1 FROM t2)` from test.t1 explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 Using index 2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 1 Using index; Using where Warnings: -Note 1003 select high_priority test.t1.s1 AS `s1`,not((test.t1.s1,(((test.t1.s1) in t2 chicking NULL where (test.t2.s1 < _latin1'a2'))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from test.t1 +Note 1003 select high_priority test.t1.s1 AS `s1`,not((test.t1.s1,(((test.t1.s1) in t2 on s1 chicking NULL where (test.t2.s1 < _latin1'a2'))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from test.t1 drop table t1,t2; create table t2 (a int, b int); create table t3 (a int); diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 0703179d92a..3653823254e 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -1263,6 +1263,9 @@ void subselect_uniquesubquery_engine::print(String *str) tab->ref.items[0]->print(str); str->append(" in "); str->append(tab->table->real_name); + KEY *key_info= tab->table->key_info+ tab->ref.key; + str->append(" on "); + str->append(key_info->name); if (cond) { str->append(" where "); @@ -1278,6 +1281,9 @@ void subselect_indexsubquery_engine::print(String *str) tab->ref.items[0]->print(str); str->append(" in "); str->append(tab->table->real_name); + KEY *key_info= tab->table->key_info+ tab->ref.key; + str->append(" on "); + str->append(key_info->name); if (check_null) str->append(" chicking NULL"); if (cond)