summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorunknown <ibabaev@bk-internal.mysql.com>2007-06-01 06:33:37 +0200
committerunknown <ibabaev@bk-internal.mysql.com>2007-06-01 06:33:37 +0200
commitb4f65f04a295791d3771c4e38b339494f3705d57 (patch)
treeb88163902b6698fd82cc842101cfa02e2bf660dd /sql/item_sum.cc
parent4605d8f26cc496a4fa1e4a37ceffbcb772c177f6 (diff)
parent93ba6ddcf3a3333eea80f25e2234a5f5e803d321 (diff)
downloadmariadb-git-b4f65f04a295791d3771c4e38b339494f3705d57.tar.gz
Merge bk-internal.mysql.com:/data0/bk/mysql-5.1
into bk-internal.mysql.com:/data0/bk/mysql-5.1-opt client/mysqldump.c: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/field_conv.cc: Auto merged sql/handler.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/item_subselect.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/my_decimal.h: Auto merged sql/sp_head.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_select.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_view.cc: Auto merged sql/table.cc: Auto merged sql/table.h: Auto merged strings/decimal.c: Auto merged sql/sql_update.cc: Manual merge
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 69148d81b9a..08ce47573e7 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -431,7 +431,7 @@ Field *Item_sum::create_tmp_field(bool group, TABLE *table,
break;
case STRING_RESULT:
if (max_length/collation.collation->mbmaxlen <= 255 ||
- convert_blob_length >=UINT_MAX16 ||
+ convert_blob_length > Field_varstring::MAX_SIZE ||
!convert_blob_length)
return make_string_field(table);
field= new Field_varstring(convert_blob_length, maybe_null,
@@ -3290,14 +3290,20 @@ bool Item_func_group_concat::setup(THD *thd)
tmp_table_param->force_copy_fields= force_copy_fields;
DBUG_ASSERT(table == 0);
/*
+ Currently we have to force conversion of BLOB values to VARCHAR's
+ if we are to store them in TREE objects used for ORDER BY and
+ DISTINCT. This leads to truncation if the BLOB's size exceeds
+ Field_varstring::MAX_SIZE.
+ */
+ if (arg_count_order > 0 || distinct)
+ set_if_smaller(tmp_table_param->convert_blob_length,
+ Field_varstring::MAX_SIZE);
+ /*
We have to create a temporary table to get descriptions of fields
(types, sizes and so on).
Note that in the table, we first have the ORDER BY fields, then the
field list.
-
- We need to set set_sum_field in true for storing value of blob in buffer
- of a record instead of a pointer of one.
*/
if (!(table= create_tmp_table(thd, tmp_table_param, all_fields,
(ORDER*) 0, 0, TRUE,