diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 4948e60b309..1cd1741cea6 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -3024,14 +3024,14 @@ Item_func_group_concat(Name_resolution_context *context_arg, bool distinct_arg, List *select_list, SQL_LIST *order_list, String *separator_arg) :tmp_table_param(0), warning(0), - force_copy_fields(0), separator(separator_arg), tree(0), table(0), + separator(separator_arg), tree(0), table(0), order(0), context(context_arg), arg_count_order(order_list ? order_list->elements : 0), arg_count_field(select_list->elements), count_cut_values(0), distinct(distinct_arg), warning_for_row(FALSE), - original(0) + force_copy_fields(0), original(0) { Item *item_select; Item **arg_ptr; @@ -3077,7 +3077,6 @@ Item_func_group_concat::Item_func_group_concat(THD *thd, :Item_sum(thd, item), tmp_table_param(item->tmp_table_param), warning(item->warning), - force_copy_fields(item->force_copy_fields), separator(item->separator), tree(item->tree), table(item->table), @@ -3089,6 +3088,7 @@ Item_func_group_concat::Item_func_group_concat(THD *thd, distinct(item->distinct), warning_for_row(item->warning_for_row), always_null(item->always_null), + force_copy_fields(item->force_copy_fields), original(item) { quick_group= item->quick_group; diff --git a/sql/item_sum.h b/sql/item_sum.h index 4bd28d6b1df..328f8dd8400 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -525,13 +525,13 @@ class Item_sum_count_distinct :public Item_sum_int public: Item_sum_count_distinct(List &list) :Item_sum_int(list), table(0), field_lengths(0), tmp_table_param(0), - tree(0), force_copy_fields(0), original(0), always_null(FALSE) + force_copy_fields(0), tree(0), original(0), always_null(FALSE) { quick_group= 0; } Item_sum_count_distinct(THD *thd, Item_sum_count_distinct *item) :Item_sum_int(thd, item), table(item->table), field_lengths(item->field_lengths), tmp_table_param(item->tmp_table_param), - tree(item->tree), force_copy_fields(0), original(item), + force_copy_fields(0), tree(item->tree), original(item), tree_key_length(item->tree_key_length), always_null(item->always_null) {} diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 7998449a00b..1712819aad4 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8669,8 +8669,9 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, create_tmp_field_for_schema(thd, item, table) : create_tmp_field(thd, table, item, type, ©_func, tmp_from_field, group != 0, - not_all_columns || group != 0, - item->marker == 4, 0, + !force_copy_fields && + (not_all_columns || group !=0), + item->marker == 4, force_copy_fields, param->convert_blob_length); if (!new_field)