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

Merge branch '10.4' into 10.5

This commit is contained in:
Oleksandr Byelkin
2021-07-31 23:19:51 +02:00
345 changed files with 7745 additions and 2127 deletions

View File

@ -30,6 +30,7 @@
#include "filesort.h" // filesort_free_buffers
#include "sql_view.h"
#include "sql_cte.h"
#include "item_windowfunc.h"
bool mysql_union(THD *thd, LEX *lex, select_result *result,
SELECT_LEX_UNIT *unit, ulong setup_tables_done_option)
@ -1687,7 +1688,8 @@ cont:
Test if the aggregated data type is OK for a UNION element.
E.g. in case of string data, DERIVATION_NONE is not allowed.
*/
if (type->type_handler()->union_element_finalize(type))
if (type->type() == Item::TYPE_HOLDER && type->type_handler()->
union_element_finalize(static_cast<Item_type_holder*>(type)))
goto err;
}
@ -2561,7 +2563,8 @@ bool st_select_lex_unit::cleanup()
{
DBUG_RETURN(FALSE);
}
if (with_element && with_element->is_recursive && union_result)
if (with_element && with_element->is_recursive && union_result &&
with_element->rec_outer_references)
{
select_union_recursive *result= with_element->rec_result;
if (++result->cleanup_count == with_element->rec_outer_references)
@ -2730,6 +2733,29 @@ static void cleanup_order(ORDER *order)
}
static void cleanup_window_funcs(List<Item_window_func> &win_funcs)
{
List_iterator_fast<Item_window_func> it(win_funcs);
Item_window_func *win_func;
while ((win_func= it++))
{
Window_spec *win_spec= win_func->window_spec;
if (!win_spec)
continue;
if (win_spec->save_partition_list)
{
win_spec->partition_list= win_spec->save_partition_list;
win_spec->save_partition_list= NULL;
}
if (win_spec->save_order_list)
{
win_spec->order_list= win_spec->save_order_list;
win_spec->save_order_list= NULL;
}
}
}
bool st_select_lex::cleanup()
{
bool error= FALSE;
@ -2741,6 +2767,8 @@ bool st_select_lex::cleanup()
cleanup_order(group_list.first);
cleanup_ftfuncs(this);
cleanup_window_funcs(window_funcs);
if (join)
{
List_iterator<TABLE_LIST> ti(leaf_tables);
@ -2767,7 +2795,8 @@ bool st_select_lex::cleanup()
for (SELECT_LEX_UNIT *lex_unit= first_inner_unit(); lex_unit ;
lex_unit= lex_unit->next_unit())
{
if (lex_unit->with_element && lex_unit->with_element->is_recursive)
if (lex_unit->with_element && lex_unit->with_element->is_recursive &&
lex_unit->with_element->rec_outer_references)
continue;
error= (bool) ((uint) error | (uint) lex_unit->cleanup());
}