diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2020-12-23 19:28:02 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2020-12-23 19:28:02 +0100 |
commit | 25561435e0b1fe42ec29d5ab06dc15875cdd1cfa (patch) | |
tree | d2e67d4509577d84da7ade2820154c904180e151 /sql/sql_derived.cc | |
parent | fa1aef39ebc7d84d24d4e3d2124f982526632ee9 (diff) | |
parent | 8d8370e31d48e0bc6139c18770746f9959c21598 (diff) | |
download | mariadb-git-25561435e0b1fe42ec29d5ab06dc15875cdd1cfa.tar.gz |
Merge branch '10.2' into 10.3
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r-- | sql/sql_derived.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index eb840e02a27..8a76a5372cc 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -676,7 +676,7 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived) if (derived->is_with_table_recursive_reference()) { /* Here 'derived" is a secondary recursive table reference */ - unit->with_element->rec_result->rec_tables.push_back(derived->table); + unit->with_element->rec_result->rec_table_refs.push_back(derived); } } DBUG_ASSERT(derived->table || res); @@ -762,17 +762,17 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived) derived->fill_me= FALSE; - if (!(derived->derived_result= new (thd->mem_root) select_unit(thd))) + if ((!derived->is_with_table_recursive_reference() || + !derived->derived_result) && + !(derived->derived_result= new (thd->mem_root) select_unit(thd))) DBUG_RETURN(TRUE); // out of memory - lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_DERIVED; // st_select_lex_unit::prepare correctly work for single select if ((res= unit->prepare(derived, derived->derived_result, 0))) goto exit; if (derived->with && (res= derived->with->rename_columns_of_derived_unit(thd, unit))) goto exit; - lex->context_analysis_only&= ~CONTEXT_ANALYSIS_ONLY_DERIVED; if ((res= check_duplicate_names(thd, unit->types, 0))) goto exit; @@ -781,7 +781,8 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived) Depending on the result field translation will or will not be created. */ - if (derived->init_derived(thd, FALSE)) + if (!derived->is_with_table_recursive_reference() && + derived->init_derived(thd, FALSE)) goto exit; /* |