[Commits] 6eb8676: MDEV-7215 EXPLAIN REPLACE produces an error: Column count doesn't match value count

OleksandrByelkin sanja at mariadb.com
Thu Dec 10 14:36:59 EET 2015


revision-id: 6eb86763619be92f73ba91a126313351b6155d8e (mariadb-10.0.22-38-g6eb8676)
parent(s): b07043fd5154d507b173059c8fd889c4e484b140
committer: Oleksandr Byelkin
timestamp: 2015-12-10 13:36:58 +0100
message:

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)

---
 mysql-test/r/explain.result | 14 ++++++++++++++
 mysql-test/t/explain.test   | 16 ++++++++++++++++
 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 4c67ab5..5678f0f 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 9b9e65d..d5be354 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 d097f3e..8ce5c97 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.


More information about the commits mailing list