1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge commit '10.4' into 10.5

This commit is contained in:
Oleksandr Byelkin
2021-01-06 10:53:00 +01:00
160 changed files with 2757 additions and 1356 deletions

View File

@ -710,7 +710,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);
@ -808,17 +808,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->process_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;
@ -827,7 +827,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;
/*