diff options
-rw-r--r-- | mysql-test/r/view.result | 13 | ||||
-rw-r--r-- | mysql-test/t/view.test | 12 | ||||
-rw-r--r-- | sql/sql_select.cc | 2 |
3 files changed, 26 insertions, 1 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 4119c11c67b..bd0ebb54ee7 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -6466,5 +6466,18 @@ ERROR HY000: Can not modify more than one base table through a join view 'test.v drop view v; drop table t1,t2,t3; # +# MDEV-12379: Server crashes in TABLE_LIST::is_with_table on +# SHOW CREATE VIEW +# +CREATE TABLE t (i INT); +CREATE VIEW v AS SELECT * FROM ( SELECT * FROM t ) sq; +DROP TABLE IF EXISTS t; +SHOW CREATE VIEW v; +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `sq`.`i` AS `i` from (select `test`.`t`.`i` AS `i` from `test`.`t`) `sq` latin1 latin1_swedish_ci +Warnings: +Warning 1356 View 'test.v' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +DROP VIEW v; +# # End of 10.2 tests # diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index cb658b5146f..bab640e1371 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -6186,6 +6186,18 @@ REPLACE INTO v (f1,f2) VALUES (1,1); drop view v; drop table t1,t2,t3; + +--echo # +--echo # MDEV-12379: Server crashes in TABLE_LIST::is_with_table on +--echo # SHOW CREATE VIEW +--echo # + +CREATE TABLE t (i INT); +CREATE VIEW v AS SELECT * FROM ( SELECT * FROM t ) sq; +DROP TABLE IF EXISTS t; +SHOW CREATE VIEW v; +DROP VIEW v; + --echo # --echo # End of 10.2 tests --echo # diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 6e355ef58f5..ecbac041dc4 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -25077,7 +25077,7 @@ void TABLE_LIST::print(THD *thd, table_map eliminated_tables, String *str, } else if (derived) { - if (!derived->derived->is_with_table()) + if (!is_with_table()) { // A derived table str->append('('); |