MDEV-7215 EXPLAIN REPLACE produces an error: Column count doesn't match value count

removed outdated code which was causing error (no need reassign result for subqueries & Co)
This commit is contained in:
Oleksandr Byelkin 2015-12-10 13:36:58 +01:00
parent b07043fd51
commit 6eb8676361
3 changed files with 30 additions and 5 deletions

View File

@ -393,3 +393,17 @@ Warnings:
Note 1003 select NULL AS `a` from (select NULL AS `a` from `test`.`t1` where 0) `t` Note 1003 select NULL AS `a` from (select NULL AS `a` from `test`.`t1` where 0) `t`
set optimizer_switch=@tmp_optimizer_switch; set optimizer_switch=@tmp_optimizer_switch;
DROP TABLE t1,t2; 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

View File

@ -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; set optimizer_switch=@tmp_optimizer_switch;
DROP TABLE t1,t2; 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

View File

@ -3249,11 +3249,6 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
{ {
if (select_lex->linkage != GLOBAL_OPTIONS_TYPE) 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 Original join tabs might be overwritten at first
subselect execution. So we need to restore them. subselect execution. So we need to restore them.