[Commits] bcc1ba92182: MDEV-11240: Server crashes in check_view_single_update or Assertion `derived->table' failed in mysql_derived_merge_for_insert

Oleksandr Byelkin sanja at mariadb.com
Wed Aug 16 20:18:40 EEST 2017


revision-id: bcc1ba921829dc8b09bcbfbc5e5a916d6f1d2ca0 (mariadb-5.5.57-5-gbcc1ba92182)
parent(s): e866e4cdbe974a83d4a4ee474d28f61e7082700f
committer: Oleksandr Byelkin
timestamp: 2017-08-16 19:18:39 +0200
message:

MDEV-11240: Server crashes in check_view_single_update or Assertion `derived->table' failed in mysql_derived_merge_for_insert

Before "merge" view shoud be inited to maintaing transitive attributes like "multitable".

---
 mysql-test/r/view.result | 3 ---
 mysql-test/t/view.test   | 5 +----
 sql/sql_derived.cc       | 4 ++--
 3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 0f8e9999730..c1f76ba58a4 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -5626,9 +5626,6 @@ CREATE TABLE t3 (a INT);
 CREATE ALGORITHM = MERGE VIEW v1 AS SELECT t2.a FROM t3 AS t1, t3 AS t2;
 CREATE ALGORITHM = MERGE VIEW v2 AS SELECT * FROM v1;
 PREPARE stmt FROM 'REPLACE INTO v2 SELECT a FROM t3';
-EXECUTE stmt;
-ERROR HY000: Can not insert into join view 'test.v2' without fields list
-EXECUTE stmt;
 ERROR HY000: Can not insert into join view 'test.v2' without fields list
 drop view v1,v2;
 drop table t3;
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 659327eebb1..79991f89683 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -5573,11 +5573,8 @@ drop table t1,t2,t3;
 CREATE TABLE t3 (a INT);
 CREATE ALGORITHM = MERGE VIEW v1 AS SELECT t2.a FROM t3 AS t1, t3 AS t2;
 CREATE ALGORITHM = MERGE VIEW v2 AS SELECT * FROM v1;
-PREPARE stmt FROM 'REPLACE INTO v2 SELECT a FROM t3';
---error ER_VIEW_NO_INSERT_FIELD_LIST
-EXECUTE stmt;
 --error ER_VIEW_NO_INSERT_FIELD_LIST
-EXECUTE stmt;
+PREPARE stmt FROM 'REPLACE INTO v2 SELECT a FROM t3';
 drop view v1,v2;
 drop table t3;
 
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 493f0eccc8c..6cd4547aaf9 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -510,6 +510,8 @@ bool mysql_derived_merge_for_insert(THD *thd, LEX *lex, TABLE_LIST *derived)
   DBUG_ENTER("mysql_derived_merge_for_insert");
   if (derived->merged_for_insert)
     DBUG_RETURN(FALSE);
+  if (derived->init_derived(thd, FALSE))
+    DBUG_RETURN(TRUE);
   if (derived->is_materialized_derived())
     DBUG_RETURN(mysql_derived_prepare(thd, lex, derived));
   if ((thd->lex->sql_command == SQLCOM_UPDATE_MULTI ||
@@ -526,8 +528,6 @@ bool mysql_derived_merge_for_insert(THD *thd, LEX *lex, TABLE_LIST *derived)
       derived->merged_for_insert= TRUE;
     }
   }
-  else
-    derived->table= derived->merge_underlying_list->table;
   DBUG_RETURN(FALSE);
 }
 


More information about the commits mailing list