summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorunknown <ibabaev@bk-internal.mysql.com>2007-05-28 00:05:38 +0200
committerunknown <ibabaev@bk-internal.mysql.com>2007-05-28 00:05:38 +0200
commit11dd353e12de970d93a0304ea3e6e43df1126907 (patch)
tree88e9d6e9af319de1b0c833c9bb011ed5025ac543 /sql/item_sum.cc
parent06297270880ca0f0023c66ca90291665ec3aacc2 (diff)
parent5f99cf963ea4138fd7adb70ec4a9add55388c281 (diff)
downloadmariadb-git-11dd353e12de970d93a0304ea3e6e43df1126907.tar.gz
Merge bk-internal.mysql.com:/data0/bk/mysql-5.0
into bk-internal.mysql.com:/data0/bk/mysql-5.0-opt client/mysqldump.c: Auto merged mysql-test/r/mysqldump.result: Auto merged mysql-test/r/ps_2myisam.result: Auto merged mysql-test/r/ps_3innodb.result: Auto merged mysql-test/r/ps_4heap.result: Auto merged mysql-test/r/ps_5merge.result: Auto merged mysql-test/r/ps_6bdb.result: Auto merged mysql-test/r/ps_7ndb.result: Auto merged sql/field.h: Auto merged sql/item_func.cc: Auto merged sql/my_decimal.h: Auto merged sql/sql_base.cc: Auto merged
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 d6b31d43389..ea2a14ffb63 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -432,7 +432,7 @@ Field *Item_sum::create_tmp_field(bool group, TABLE *table,
2-byte lenght.
*/
if (max_length/collation.collation->mbmaxlen > 255 &&
- convert_blob_length < UINT_MAX16 && convert_blob_length)
+ convert_blob_length <= Field_varstring::MAX_SIZE && convert_blob_length)
return new Field_varstring(convert_blob_length, maybe_null,
name, table,
collation.collation);
@@ -3269,14 +3269,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,