diff options
-rw-r--r-- | mysql-test/r/explain.result | 14 | ||||
-rw-r--r-- | mysql-test/t/explain.test | 16 | ||||
-rw-r--r-- | sql/sql_select.cc | 5 |
3 files changed, 30 insertions, 5 deletions
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result index 4c67ab5693a..5678f0f3968 100644 --- a/mysql-test/r/explain.result +++ b/mysql-test/r/explain.result @@ -393,3 +393,17 @@ Warnings: Note 1003 select NULL AS `a` from (select NULL AS `a` from `test`.`t1` where 0) `t` set optimizer_switch=@tmp_optimizer_switch; DROP TABLE t1,t2; +# +# MDEV-7215: EXPLAIN REPLACE produces an error: +# Column count doesn't match value count +# +create table t1 (a int); +insert into t1 values (1); +create table t2 (b int, c int); +replace into t2 select 100, (select a from t1); +explain replace into t2 select 100, (select a from t1); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t1 system NULL NULL NULL NULL 1 +drop table t1, t2; +# End of 10.1 tests diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test index 9b9e65d7b51..d5be354c852 100644 --- a/mysql-test/t/explain.test +++ b/mysql-test/t/explain.test @@ -317,3 +317,19 @@ SELECT * FROM ( SELECT t1.a FROM t1,t2 WHERE t2.a = t1.a ) AS t; set optimizer_switch=@tmp_optimizer_switch; DROP TABLE t1,t2; + +--echo # +--echo # MDEV-7215: EXPLAIN REPLACE produces an error: +--echo # Column count doesn't match value count +--echo # +create table t1 (a int); +insert into t1 values (1); +create table t2 (b int, c int); + +replace into t2 select 100, (select a from t1); +explain replace into t2 select 100, (select a from t1); +#analyze replace into t2 select 100, (select a from t1); + +drop table t1, t2; + +--echo # End of 10.1 tests diff --git a/sql/sql_select.cc b/sql/sql_select.cc index d097f3e28ad..8ce5c9703ef 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3249,11 +3249,6 @@ mysql_select(THD *thd, Item ***rref_pointer_array, { if (select_lex->linkage != GLOBAL_OPTIONS_TYPE) { - //here is EXPLAIN of subselect or derived table - if (join->change_result(result)) - { - DBUG_RETURN(TRUE); - } /* Original join tabs might be overwritten at first subselect execution. So we need to restore them. |