mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge branch '10.5' into 10.6
This commit is contained in:
@ -18408,14 +18408,17 @@ Field *Item_default_value::create_tmp_field_ex(MEM_ROOT *root, TABLE *table,
|
||||
Tmp_field_src *src,
|
||||
const Tmp_field_param *param)
|
||||
{
|
||||
if (field->default_value && (field->flags & BLOB_FLAG))
|
||||
if (field->default_value || (field->flags & BLOB_FLAG))
|
||||
{
|
||||
/*
|
||||
We have to use a copy function when using a blob with default value
|
||||
as the we have to calculate the default value before we can use it.
|
||||
*/
|
||||
get_tmp_field_src(src, param);
|
||||
return tmp_table_field_from_field_type(root, table);
|
||||
Field *result= tmp_table_field_from_field_type(root, table);
|
||||
if (result && param->modify_item())
|
||||
result_field= result;
|
||||
return result;
|
||||
}
|
||||
/*
|
||||
Same code as in Item_field::create_tmp_field_ex, except no default field
|
||||
@ -18853,6 +18856,7 @@ TABLE *Create_tmp_table::start(THD *thd,
|
||||
table->copy_blobs= 1;
|
||||
table->in_use= thd;
|
||||
table->no_rows_with_nulls= param->force_not_null_cols;
|
||||
table->expr_arena= thd;
|
||||
|
||||
table->s= share;
|
||||
init_tmp_table_share(thd, share, "", 0, "(temporary)", tmpname);
|
||||
@ -25065,8 +25069,8 @@ int setup_order(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables,
|
||||
if (find_order_in_list(thd, ref_pointer_array, tables, order, fields,
|
||||
all_fields, false, true, from_window_spec))
|
||||
return 1;
|
||||
if ((*order->item)->with_window_func() &&
|
||||
context_analysis_place != IN_ORDER_BY)
|
||||
Item * const item= *order->item;
|
||||
if (item->with_window_func() && context_analysis_place != IN_ORDER_BY)
|
||||
{
|
||||
my_error(ER_WINDOW_FUNCTION_IN_WINDOW_SPEC, MYF(0));
|
||||
return 1;
|
||||
@ -25077,20 +25081,18 @@ int setup_order(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables,
|
||||
an ORDER BY clause
|
||||
*/
|
||||
|
||||
if (for_union &&
|
||||
((*order->item)->with_sum_func() ||
|
||||
(*order->item)->with_window_func()))
|
||||
if (for_union && (item->with_sum_func() || item->with_window_func()))
|
||||
{
|
||||
my_error(ER_AGGREGATE_ORDER_FOR_UNION, MYF(0), number);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!(*order->item)->with_sum_func())
|
||||
continue;
|
||||
|
||||
if (from_window_spec && (*order->item)->type() != Item::SUM_FUNC_ITEM)
|
||||
(*order->item)->split_sum_func(thd, ref_pointer_array,
|
||||
all_fields, SPLIT_SUM_SELECT);
|
||||
if ((from_window_spec && item->with_sum_func() &&
|
||||
item->type() != Item::SUM_FUNC_ITEM) || item->with_window_func())
|
||||
{
|
||||
item->split_sum_func(thd, ref_pointer_array,
|
||||
all_fields, SPLIT_SUM_SELECT);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -26040,15 +26042,17 @@ change_to_use_tmp_fields(THD *thd, Ref_ptr_array ref_pointer_array,
|
||||
for (uint i= 0; (item= it++); i++)
|
||||
{
|
||||
Field *field;
|
||||
if ((item->with_sum_func() && item->type() != Item::SUM_FUNC_ITEM) ||
|
||||
item->with_window_func())
|
||||
enum Item::Type item_type= item->type();
|
||||
if ((item->with_sum_func() && item_type != Item::SUM_FUNC_ITEM) ||
|
||||
item->with_window_func())
|
||||
item_field= item;
|
||||
else if (item->type() == Item::FIELD_ITEM)
|
||||
else if (item_type == Item::FIELD_ITEM ||
|
||||
item_type == Item::DEFAULT_VALUE_ITEM)
|
||||
{
|
||||
if (!(item_field= item->get_tmp_table_item(thd)))
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
else if (item->type() == Item::FUNC_ITEM &&
|
||||
else if (item_type == Item::FUNC_ITEM &&
|
||||
((Item_func*)item)->functype() == Item_func::SUSERVAR_FUNC)
|
||||
{
|
||||
field= item->get_tmp_table_field();
|
||||
@ -27899,7 +27903,7 @@ static void print_table_array(THD *thd,
|
||||
too)
|
||||
*/
|
||||
|
||||
static bool is_eliminated_table(table_map eliminated_tables, TABLE_LIST *tbl)
|
||||
bool is_eliminated_table(table_map eliminated_tables, TABLE_LIST *tbl)
|
||||
{
|
||||
return eliminated_tables &&
|
||||
((tbl->table && (tbl->table->map & eliminated_tables)) ||
|
||||
|
Reference in New Issue
Block a user