summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2016-01-16 18:45:26 +0400
committerAlexander Barkov <bar@mariadb.org>2016-01-16 18:45:26 +0400
commit7b50447aa6d051b8d14bb01ef14802cb8ffee223 (patch)
tree551c3240ca2ebb227ebc5735157e6d97b0ce6501 /sql/item_func.cc
parent98b6026036913bed65b6e121c86580ebd92bd715 (diff)
downloadmariadb-git-7b50447aa6d051b8d14bb01ef14802cb8ffee223.tar.gz
MDEV-9407 Illegal mix of collation when using GROUP_CONCAT in a VIEW
MDEV-9408 CREATE TABLE SELECT MAX(int_column) creates different columns for table vs view There were three almost identical pieces of the code: - Field *Item_func::tmp_table_field(); - Field *Item_sum::create_tmp_field(); - Field *create_tmp_field_from_item(); with a difference in very small details (hence the bugs): Only Item_func::tmp_table_field() was correct, the other two were not. Removing the two incorrect pieces of the redundant code. Joining these three functions/methods into a single virtual method Item::create_tmp_field(). Additionally, moving Item::make_string_field() and Item::tmp_table_field_from_field_type() from the public into the protected section of the class declaration, as they are now not needed outside of Item.
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc51
1 files changed, 2 insertions, 49 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 379c0ecc15a..4b376706500 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -509,43 +509,6 @@ bool Item_func::eq(const Item *item, bool binary_cmp) const
}
-Field *Item_func::tmp_table_field(TABLE *table)
-{
- Field *field= NULL;
- MEM_ROOT *mem_root= table->in_use->mem_root;
-
- switch (result_type()) {
- case INT_RESULT:
- if (max_char_length() > MY_INT32_NUM_DECIMAL_DIGITS)
- field= new (mem_root)
- Field_longlong(max_char_length(), maybe_null, name,
- unsigned_flag);
- else
- field= new (mem_root)
- Field_long(max_char_length(), maybe_null, name,
- unsigned_flag);
- break;
- case REAL_RESULT:
- field= new (mem_root)
- Field_double(max_char_length(), maybe_null, name, decimals);
- break;
- case STRING_RESULT:
- return make_string_field(table);
- case DECIMAL_RESULT:
- field= Field_new_decimal::create_from_item(mem_root, this);
- break;
- case ROW_RESULT:
- case TIME_RESULT:
- // This case should never be chosen
- DBUG_ASSERT(0);
- field= 0;
- break;
- }
- if (field)
- field->init(table);
- return field;
-}
-
/*
bool Item_func::is_expensive_processor(uchar *arg)
{
@@ -2908,10 +2871,10 @@ void Item_func_min_max::fix_length_and_dec()
collation.set_numeric();
fix_char_length(float_length(decimals));
/*
- Set type to DOUBLE, as Item_func::tmp_table_field() does not
+ Set type to DOUBLE, as Item_func::create_tmp_field() does not
distinguish between DOUBLE and FLOAT and always creates Field_double.
Perhaps we should eventually change this to use agg_field_type() here,
- and fix Item_func::tmp_table_field() to create Field_float when possible.
+ and fix Item_func::create_tmp_field() to create Field_float when possible.
*/
set_handler_by_field_type(MYSQL_TYPE_DOUBLE);
break;
@@ -6801,16 +6764,6 @@ longlong Item_func_found_rows::val_int()
}
-Field *
-Item_func_sp::tmp_table_field(TABLE *t_arg)
-{
- DBUG_ENTER("Item_func_sp::tmp_table_field");
-
- DBUG_ASSERT(sp_result_field);
- DBUG_RETURN(sp_result_field);
-}
-
-
/**
@brief Checks if requested access to function can be granted to user.
If function isn't found yet, it searches function first.