Commit 6eb86763 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

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)
parent b07043fd
...@@ -393,3 +393,17 @@ Warnings: ...@@ -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
...@@ -317,3 +317,19 @@ SELECT * FROM ( SELECT t1.a FROM t1,t2 WHERE t2.a = t1.a ) AS t; ...@@ -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
...@@ -3249,11 +3249,6 @@ mysql_select(THD *thd, Item ***rref_pointer_array, ...@@ -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.
......
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