mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Corrected the patch for mdev-15119 that caused a failure for
cte_nonrecursive.test with --embedded. This also fixed some problems for embedded CTEs. Adjusted test results accordingly.
This commit is contained in:
@@ -1001,6 +1001,10 @@ With_element *st_select_lex::find_table_def_in_with_clauses(TABLE_LIST *table)
|
||||
and it was unsuccesful. Yet for units cloned from the spec it has not
|
||||
been done yet.
|
||||
*/
|
||||
With_clause *attached_with_clause= sl->get_with_clause();
|
||||
if (attached_with_clause &&
|
||||
(found= attached_with_clause->find_table_def(table, NULL)))
|
||||
break;
|
||||
master_unit= sl->master_unit();
|
||||
outer_sl= master_unit->outer_select();
|
||||
With_element *with_elem= sl->get_with_element();
|
||||
@@ -1014,13 +1018,6 @@ With_element *st_select_lex::find_table_def_in_with_clauses(TABLE_LIST *table)
|
||||
if (outer_sl && !outer_sl->get_with_element())
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
With_clause *attached_with_clause= sl->get_with_clause();
|
||||
if (attached_with_clause &&
|
||||
(found= attached_with_clause->find_table_def(table, NULL)))
|
||||
break;
|
||||
}
|
||||
/* Do not look for the table's definition beyond the scope of the view */
|
||||
if (master_unit->is_view)
|
||||
break;
|
||||
@@ -1062,7 +1059,7 @@ bool TABLE_LIST::set_as_with_table(THD *thd, With_element *with_elem)
|
||||
if (!with_elem->is_referenced() || with_elem->is_recursive)
|
||||
{
|
||||
derived= with_elem->spec;
|
||||
if (derived->get_master() != select_lex &&
|
||||
if (derived != select_lex->master_unit() &&
|
||||
!is_with_table_recursive_reference())
|
||||
{
|
||||
derived->move_as_slave(select_lex);
|
||||
@@ -1072,7 +1069,6 @@ bool TABLE_LIST::set_as_with_table(THD *thd, With_element *with_elem)
|
||||
{
|
||||
if(!(derived= with_elem->clone_parsed_spec(thd, this)))
|
||||
return true;
|
||||
derived->with_element= with_elem;
|
||||
}
|
||||
derived->first_select()->linkage= DERIVED_TABLE_TYPE;
|
||||
with_elem->inc_references();
|
||||
|
||||
Reference in New Issue
Block a user