summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorunknown <jani@ua141d10.elisa.omakaista.fi>2005-03-01 22:19:19 +0200
committerunknown <jani@ua141d10.elisa.omakaista.fi>2005-03-01 22:19:19 +0200
commit53bfeb48442ed04c8498cb4118b3715fd1dbeb42 (patch)
tree701e55a57172693eb5cc80b3d8c70b8a5e5305f2 /sql/item_sum.cc
parent425573747f54cf54187a0985e21fddf580c8e924 (diff)
downloadmariadb-git-53bfeb48442ed04c8498cb4118b3715fd1dbeb42.tar.gz
Fix for Bug#5615 and merge from 4.1
mysql-test/r/func_group.result: Added some tests and fix for Bug#5615. mysql-test/r/show_check.result: Fix for Bug#5615. mysql-test/t/func_group.test: Added some tests. sql/item_sum.cc: Fix for Bug#5615. sql/item_sum.h: Fix for Bug#5615. sql/sql_select.cc: Fix for Bug#5615. sql/sql_select.h: Fix for Bug#5615.
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index b4a53ba0f80..dbba02c3cf7 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -22,6 +22,7 @@
#endif
#include "mysql_priv.h"
+#include "sql_select.h"
Item_sum::Item_sum(List<Item> &list)
:arg_count(list.elements)
@@ -303,6 +304,21 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
return FALSE;
}
+Field *Item_sum_hybrid::create_tmp_field(bool group, TABLE *table,
+ uint convert_blob_length)
+{
+ if (args[0]->type() == Item::FIELD_ITEM)
+ {
+ Field *field= ((Item_field*) args[0])->field;
+
+ if ((field= create_tmp_field_from_field(current_thd, field, this, table,
+ 0, convert_blob_length)))
+ field->flags&= ~NOT_NULL_FLAG;
+ return field;
+ }
+ return Item_sum::create_tmp_field(group, table, convert_blob_length);
+}
+
/***********************************************************************
** reset and add of sum_func
@@ -2075,8 +2091,6 @@ my_decimal *Item_variance_field::val_decimal(my_decimal *dec_buf)
** COUNT(DISTINCT ...)
****************************************************************************/
-#include "sql_select.h"
-
int simple_str_key_cmp(void* arg, byte* key1, byte* key2)
{
Item_sum_count_distinct* item = (Item_sum_count_distinct*)arg;