1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Fixed bug mdev-10923.

The code for st_select_lex::find_table_def_in_with_clauses()
did not take into account the fact that the specs for mergeable
CTEs were cloned and were not processed by the function
With_element::check_dependencies_in_spec().
This commit is contained in:
Igor Babaev
2016-09-30 13:10:58 -07:00
parent 903f34c7a9
commit 061d28207d
3 changed files with 74 additions and 4 deletions

View File

@ -928,13 +928,18 @@ With_element *st_select_lex::find_table_def_in_with_clauses(TABLE_LIST *table)
/*
If sl->master_unit() is the spec of a with element then the search for
a definition was already done by With_element::check_dependencies_in_spec
and it was unsuccesful.
and it was unsuccesful. Yet for units cloned from the spec it has not
been done yet.
*/
if (with_elem)
if (with_elem && sl->master_unit() == with_elem->spec)
break;
With_clause *with_clause=sl->get_with_clause();
if (with_clause && (found= with_clause->find_table_def(table,NULL)))
break;
if (with_clause)
{
With_element *barrier= with_clause->with_recursive ? NULL : with_elem;
if ((found= with_clause->find_table_def(table, barrier)))
break;
}
master_unit= sl->master_unit();
/* Do not look for the table's definition beyond the scope of the view */
if (master_unit->is_view)