Commit e7fd6ed3 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

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

Move table pointer for single table view (even if it is view over other view) to make the access universal.
parent 7e44eabd
......@@ -5618,6 +5618,20 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t3`.`f` = `test`.`t1`.`a`) and (`test`.`t2`.`d` = `test`.`t3`.`e`) and (`test`.`t1`.`a` is not null) and (`test`.`t1`.`a` is not null) and (`test`.`t1`.`b` is not null))) where (`test`.`t1`.`a` < 5)
drop view v1;
drop table t1,t2,t3;
#
# MDEV-11240: Server crashes in check_view_single_update or
# Assertion `derived->table' failed in mysql_derived_merge_for_insert
#
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;
# -----------------------------------------------------------------
# -- End of 5.5 tests.
# -----------------------------------------------------------------
......
......@@ -5565,6 +5565,22 @@ select *
drop view v1;
drop table t1,t2,t3;
--echo #
--echo # MDEV-11240: Server crashes in check_view_single_update or
--echo # Assertion `derived->table' failed in mysql_derived_merge_for_insert
--echo #
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;
drop view v1,v2;
drop table t3;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.5 tests.
--echo # -----------------------------------------------------------------
......
......@@ -526,6 +526,8 @@ 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);
}
......
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