Commit c548fb06 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin Committed by Sergei Golubchik

MDEV-11240: Server crashes in check_view_single_update or Assertion...

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".
parent cb1e76e4
...@@ -5674,9 +5674,6 @@ CREATE TABLE t3 (a INT); ...@@ -5674,9 +5674,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 v1 AS SELECT t2.a FROM t3 AS t1, t3 AS t2;
CREATE ALGORITHM = MERGE VIEW v2 AS SELECT * FROM v1; CREATE ALGORITHM = MERGE VIEW v2 AS SELECT * FROM v1;
PREPARE stmt FROM 'REPLACE INTO v2 SELECT a FROM t3'; 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 ERROR HY000: Can not insert into join view 'test.v2' without fields list
drop view v1,v2; drop view v1,v2;
drop table t3; drop table t3;
......
...@@ -5577,11 +5577,8 @@ drop table t1,t2,t3; ...@@ -5577,11 +5577,8 @@ drop table t1,t2,t3;
CREATE TABLE t3 (a INT); 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 v1 AS SELECT t2.a FROM t3 AS t1, t3 AS t2;
CREATE ALGORITHM = MERGE VIEW v2 AS SELECT * FROM v1; 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 --error ER_VIEW_NO_INSERT_FIELD_LIST
EXECUTE stmt; PREPARE stmt FROM 'REPLACE INTO v2 SELECT a FROM t3';
drop view v1,v2; drop view v1,v2;
drop table t3; drop table t3;
......
...@@ -520,6 +520,8 @@ bool mysql_derived_merge_for_insert(THD *thd, LEX *lex, TABLE_LIST *derived) ...@@ -520,6 +520,8 @@ bool mysql_derived_merge_for_insert(THD *thd, LEX *lex, TABLE_LIST *derived)
derived->merge_underlying_list != 0)); derived->merge_underlying_list != 0));
if (derived->merged_for_insert) if (derived->merged_for_insert)
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
if (derived->init_derived(thd, FALSE))
DBUG_RETURN(TRUE);
if (derived->is_materialized_derived()) if (derived->is_materialized_derived())
DBUG_RETURN(mysql_derived_prepare(thd, lex, derived)); DBUG_RETURN(mysql_derived_prepare(thd, lex, derived));
if ((thd->lex->sql_command == SQLCOM_UPDATE_MULTI || if ((thd->lex->sql_command == SQLCOM_UPDATE_MULTI ||
...@@ -537,8 +539,6 @@ bool mysql_derived_merge_for_insert(THD *thd, LEX *lex, TABLE_LIST *derived) ...@@ -537,8 +539,6 @@ bool mysql_derived_merge_for_insert(THD *thd, LEX *lex, TABLE_LIST *derived)
DBUG_ASSERT(derived->table); DBUG_ASSERT(derived->table);
} }
} }
else
derived->table= derived->merge_underlying_list->table;
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
......
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