diff options
author | Igor Babaev <igor@askmonty.org> | 2018-02-08 09:48:03 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2018-02-08 09:48:36 -0800 |
commit | 8411a8ff6080f346582878131ba4bd92cce7510c (patch) | |
tree | eed875d9447faa39c5130580c4102cff2c6cc6e1 /sql/sql_cte.cc | |
parent | f01ce62c8f1ad2187d08c80e94051e933dcf0235 (diff) | |
download | mariadb-git-8411a8ff6080f346582878131ba4bd92cce7510c.tar.gz |
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.
Diffstat (limited to 'sql/sql_cte.cc')
-rw-r--r-- | sql/sql_cte.cc | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc index 7e28a680e66..ac27f1713f9 100644 --- a/sql/sql_cte.cc +++ b/sql/sql_cte.cc @@ -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(); |