Commit 27f6b11a authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-12379: Server crashes in TABLE_LIST::is_with_table on SHOW CREATE VIEW

In case of error on opening VIEW (absent table for example) it is still possible to print its definition but some variable is not set (table_list->derived->derived) so it is better do not try to test it when there is safer alternative (table_list itself).
parent a33653ee
......@@ -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
#
......@@ -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 #
......@@ -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('(');
......
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