Commit ae3072c0 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-10554: Assertion...

MDEV-10554: Assertion `!derived->first_select()->exclude_from_table_unique_test || derived->outer_select()-> exclude_from_table_unique_test' failed in TABLE_LIST::set_check_merged()

Mark and check excluded because of merging derived tables and views.
parent ee51f582
...@@ -1064,3 +1064,21 @@ DROP TABLE t1; ...@@ -1064,3 +1064,21 @@ DROP TABLE t1;
# #
# End of 10.1 tests # End of 10.1 tests
# #
#
# MDEV-10554: Assertion `!derived->first_select()->
# exclude_from_table_unique_test || derived->outer_select()->
# exclude_from_table_unique_test'
# failed in TABLE_LIST::set_check_merged()
#
CREATE TABLE t1 (f INT);
CREATE ALGORITHM = TEMPTABLE VIEW v1 AS SELECT * FROM ( SELECT * FROM t1 ) AS sq;
PREPARE stmt FROM 'SELECT * FROM v1';
EXECUTE stmt;
f
EXECUTE stmt;
f
drop view v1;
drop table t1;
#
# End of 10.2 tests
#
...@@ -910,3 +910,24 @@ DROP TABLE t1; ...@@ -910,3 +910,24 @@ DROP TABLE t1;
--echo # --echo #
--echo # End of 10.1 tests --echo # End of 10.1 tests
--echo # --echo #
--echo #
--echo # MDEV-10554: Assertion `!derived->first_select()->
--echo # exclude_from_table_unique_test || derived->outer_select()->
--echo # exclude_from_table_unique_test'
--echo # failed in TABLE_LIST::set_check_merged()
--echo #
CREATE TABLE t1 (f INT);
CREATE ALGORITHM = TEMPTABLE VIEW v1 AS SELECT * FROM ( SELECT * FROM t1 ) AS sq;
PREPARE stmt FROM 'SELECT * FROM v1';
EXECUTE stmt;
EXECUTE stmt;
drop view v1;
drop table t1;
--echo #
--echo # End of 10.2 tests
--echo #
...@@ -2375,6 +2375,8 @@ void st_select_lex_unit::exclude_level() ...@@ -2375,6 +2375,8 @@ void st_select_lex_unit::exclude_level()
if (next) if (next)
next->prev= prev; next->prev= prev;
} }
// Mark it excluded
prev= NULL;
} }
......
...@@ -698,6 +698,7 @@ class st_select_lex_unit: public st_select_lex_node { ...@@ -698,6 +698,7 @@ class st_select_lex_unit: public st_select_lex_node {
st_select_lex* return_after_parsing() { return return_to; } st_select_lex* return_after_parsing() { return return_to; }
void exclude_level(); void exclude_level();
void exclude_tree(); void exclude_tree();
bool is_excluded() { return prev == NULL; }
/* UNION methods */ /* UNION methods */
bool prepare(THD *thd, select_result *result, ulong additional_options); bool prepare(THD *thd, select_result *result, ulong additional_options);
......
...@@ -5485,7 +5485,8 @@ void TABLE_LIST::set_check_merged() ...@@ -5485,7 +5485,8 @@ void TABLE_LIST::set_check_merged()
It is not simple to check all, but at least this should be checked: It is not simple to check all, but at least this should be checked:
this select is not excluded or the exclusion came from above. this select is not excluded or the exclusion came from above.
*/ */
DBUG_ASSERT(!derived->first_select()->exclude_from_table_unique_test || DBUG_ASSERT(derived->is_excluded() ||
!derived->first_select()->exclude_from_table_unique_test ||
derived->outer_select()-> derived->outer_select()->
exclude_from_table_unique_test); exclude_from_table_unique_test);
} }
...@@ -5498,6 +5499,7 @@ void TABLE_LIST::set_check_materialized() ...@@ -5498,6 +5499,7 @@ void TABLE_LIST::set_check_materialized()
if (view) if (view)
derived= &view->unit; derived= &view->unit;
DBUG_ASSERT(derived); DBUG_ASSERT(derived);
DBUG_ASSERT(!derived->is_excluded());
if (!derived->first_select()->exclude_from_table_unique_test) if (!derived->first_select()->exclude_from_table_unique_test)
derived->set_unique_exclude(); derived->set_unique_exclude();
else else
......
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