[Commits] 67c3c62: MDEV-11363: Assertion `!derived->first_sel ect()->first_inner_unit() || derived->first_select()->first_inner_unit()->first_select()-> exclude_from_table_unique_test' failed in TABLE_LIST::set_check_materialized()

Oleksandr Byelkin sanja at mariadb.com
Wed Mar 8 17:12:17 EET 2017


revision-id: 67c3c629d71dec9475097bada754e6bf5e000560 (mariadb-10.2.4-28-g67c3c62)
parent(s): 0b1abc2f0f391d4e55029fa53f1e5da926f7be61
committer: Oleksandr Byelkin
timestamp: 2017-03-08 16:12:17 +0100
message:

MDEV-11363: Assertion `!derived->first_sel ect()->first_inner_unit() || derived->first_select()->first_inner_unit()->first_select()-> exclude_from_table_unique_test' failed in TABLE_LIST::set_check_materialized()

Do not try to materialize derived table which already merged (irreversebly).

---
 mysql-test/r/derived.result | 16 ++++++++++++++++
 mysql-test/t/derived.test   | 19 +++++++++++++++++++
 sql/sql_base.cc             |  2 +-
 3 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index a4c994f..d0ac614 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -1080,5 +1080,21 @@ f
 drop view v1;
 drop table t1;
 #
+# MDEV-11363: Assertion `!derived->first_sel ect()->first_inner_unit() ||
+# derived->first_select()->first_inner_unit()->first_select()->
+# exclude_from_table_unique_test' failed in
+# TABLE_LIST::set_check_materialized()
+#
+CREATE TABLE t1 (f1 INT);
+CREATE TABLE t2 (f2 INT);
+CREATE TABLE t3 (f3 INT);
+CREATE VIEW v1 AS ( SELECT f1 AS f FROM t1 ) UNION ( SELECT f2 AS f FROM t2 );
+CREATE VIEW v2 AS SELECT f3 AS f FROM t3;
+CREATE VIEW v3 AS SELECT f FROM ( SELECT f3 AS f FROM v1, t3 ) AS sq;
+CREATE VIEW v4 AS SELECT COUNT(*) as f FROM v3;
+REPLACE INTO v2 ( SELECT * FROM v4 ) UNION ( SELECT f FROM v2 );
+drop view v1,v2,v3,v4;
+drop table t1,t2,t3;
+#
 # End of 10.2 tests
 #
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
index 318cf58..121e274 100644
--- a/mysql-test/t/derived.test
+++ b/mysql-test/t/derived.test
@@ -929,5 +929,24 @@ drop view v1;
 drop table t1;
 
 --echo #
+--echo # MDEV-11363: Assertion `!derived->first_sel ect()->first_inner_unit() ||
+--echo # derived->first_select()->first_inner_unit()->first_select()->
+--echo # exclude_from_table_unique_test' failed in
+--echo # TABLE_LIST::set_check_materialized()
+--echo #
+
+CREATE TABLE t1 (f1 INT);
+CREATE TABLE t2 (f2 INT);
+CREATE TABLE t3 (f3 INT);
+CREATE VIEW v1 AS ( SELECT f1 AS f FROM t1 ) UNION ( SELECT f2 AS f FROM t2 );
+CREATE VIEW v2 AS SELECT f3 AS f FROM t3;
+CREATE VIEW v3 AS SELECT f FROM ( SELECT f3 AS f FROM v1, t3 ) AS sq;
+CREATE VIEW v4 AS SELECT COUNT(*) as f FROM v3;
+REPLACE INTO v2 ( SELECT * FROM v4 ) UNION ( SELECT f FROM v2 );
+
+drop view v1,v2,v3,v4;
+drop table t1,t2,t3;
+
+--echo #
 --echo # End of 10.2 tests
 --echo #
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 4f87d49..65cfe99 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1060,7 +1060,7 @@ TABLE_LIST* find_dup_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
   {
     /* Try to fix */
     TABLE_LIST *derived=  res->belong_to_derived;
-    if (derived->is_merged_derived())
+    if (derived->is_merged_derived() && !derived->derived->is_excluded())
     {
       DBUG_PRINT("info",
                  ("convert merged to materialization to resolve the conflict"));


More information about the commits mailing list