summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorunknown <mhansson@dl145s.mysql.com>2007-05-21 10:27:33 +0200
committerunknown <mhansson@dl145s.mysql.com>2007-05-21 10:27:33 +0200
commit68f0d56d7c049d3dc99cfc844fa9d5c485af5a16 (patch)
treea62ec66f999f1c490922cac311cd09db6534054b /sql/item_sum.cc
parent83f03a5ffaedf91a77e044eb436a29931fda520b (diff)
downloadmariadb-git-68f0d56d7c049d3dc99cfc844fa9d5c485af5a16.tar.gz
bug#23856
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 4579ecd48ae..443b3782d6b 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,