[Commits] Rev 4498: MDEV-7034:Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type != 2' failed in handler::ha_rnd_next on EXPLAIN INSERT .. SELECT in file:///home/bell/maria/bzr/work-maria-10.0-work-maria-5.5-MDEV-6972/

sanja at askmonty.org sanja at askmonty.org
Tue Nov 18 15:12:06 EET 2014


At file:///home/bell/maria/bzr/work-maria-10.0-work-maria-5.5-MDEV-6972/

------------------------------------------------------------
revno: 4498
revision-id: sanja at askmonty.org-20141118131143-m7492xc5r07s7sja
parent: sanja at askmonty.org-20141117161330-xw2g3fb5364er68g
committer: sanja at askmonty.org
branch nick: work-maria-10.0-work-maria-5.5-MDEV-6972
timestamp: Tue 2014-11-18 14:11:43 +0100
message:
  MDEV-7034:Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type != 2' failed in handler::ha_rnd_next on EXPLAIN INSERT .. SELECT
  
  Do not try to optimize merged derived.
-------------- next part --------------
=== modified file 'mysql-test/r/explain_non_select.result'
--- a/mysql-test/r/explain_non_select.result	2013-10-16 09:38:42 +0000
+++ b/mysql-test/r/explain_non_select.result	2014-11-18 13:11:43 +0000
@@ -1,4 +1,5 @@
-drop table if exists t0, t1;
+drop table if exists t0, t1, t2, v1, v2;
+drop view if exists t0, t1, t2, v1, v2;
 create table t0 (a int) engine=myisam;
 insert into t0 values (1),(2),(3),(4),(5),(6),(7),(8);
 #
@@ -219,3 +220,18 @@ OK
 OK
 drop function f1;
 drop table t1;
+#
+#MDEV-7034: Assertion `table_share->tmp_table != NO_TMP_TABLE || 
+# m_lock_type != 2' failed in handler::ha_rnd_next on
+# EXPLAIN INSERT .. SELECT
+#
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+INSERT INTO t2 VALUES (1),(2);
+CREATE VIEW v1 (a) AS SELECT a FROM t1;
+CREATE VIEW v2 AS SELECT * FROM v1;
+EXPLAIN INSERT INTO v2 SELECT * FROM t2;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	2	
+drop view v2,v1;
+drop table t1,t2;

=== modified file 'mysql-test/t/explain_non_select.test'
--- a/mysql-test/t/explain_non_select.test	2013-10-11 15:27:53 +0000
+++ b/mysql-test/t/explain_non_select.test	2014-11-18 13:11:43 +0000
@@ -4,7 +4,8 @@
 --source include/have_partition.inc
 
 --disable_warnings
-drop table if exists t0, t1;
+drop table if exists t0, t1, t2, v1, v2;
+drop view if exists t0, t1, t2, v1, v2;
 --enable_warnings
 
 create table t0 (a int) engine=myisam;
@@ -197,4 +198,18 @@ select 'OK';
 drop function f1;
 drop table t1;
 
+--echo #
+--echo #MDEV-7034: Assertion `table_share->tmp_table != NO_TMP_TABLE || 
+--echo # m_lock_type != 2' failed in handler::ha_rnd_next on
+--echo # EXPLAIN INSERT .. SELECT
+--echo #
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+INSERT INTO t2 VALUES (1),(2);
+CREATE VIEW v1 (a) AS SELECT a FROM t1;
+CREATE VIEW v2 AS SELECT * FROM v1;
+
+EXPLAIN INSERT INTO v2 SELECT * FROM t2;
 
+drop view v2,v1;
+drop table t1,t2;

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2014-11-03 16:47:37 +0000
+++ b/sql/sql_select.cc	2014-11-18 13:11:43 +0000
@@ -23421,6 +23421,8 @@ int JOIN::save_explain_data_intern(Expla
       else
       {
         TABLE_LIST *real_table= table->pos_in_table_list;
+        if (real_table->is_merged_derived())
+          real_table= real_table->find_underlying_table(table);
 	eta->table_name.copy(real_table->alias, strlen(real_table->alias), cs);
       }
 
@@ -23850,7 +23852,8 @@ static void select_describe(JOIN *join,
       Display subqueries only if they are not parts of eliminated WHERE/ON
       clauses.
     */
-    if (!(unit->item && unit->item->eliminated))
+    if (!(unit->item && unit->item->eliminated) &&
+        !(unit->derived && unit->derived->is_merged_derived()))
     {
       if (mysql_explain_union(thd, unit, result))
         DBUG_VOID_RETURN;



More information about the commits mailing list