1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Bug#16712: group_concat returns odd srting insead of intended result

when calculating GROUP_CONCAT all blob fields are transformed
  to varchar when making the temp table.
  However a varchar has at max 2 bytes for length. 
  This fix makes the conversion only for blobs whose max length 
  is below that limit. 
  Otherwise blob field is created by make_string_field() call.
This commit is contained in:
gkodinov/kgeorge@macbook.gmz
2006-07-25 11:45:10 +03:00
parent ece5fff44e
commit 9380bb837f
4 changed files with 46 additions and 3 deletions

View File

@ -8011,7 +8011,12 @@ Field* create_tmp_field_from_field(THD *thd, Field* org_field,
{
Field *new_field;
if (convert_blob_length && (org_field->flags & BLOB_FLAG))
/*
Make sure that the blob fits into a Field_varstring which has
2-byte lenght.
*/
if (convert_blob_length && convert_blob_length < UINT_MAX16 &&
(org_field->flags & BLOB_FLAG))
new_field= new Field_varstring(convert_blob_length,
org_field->maybe_null(),
org_field->field_name, table,
@ -8087,8 +8092,13 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
if ((type= item->field_type()) == MYSQL_TYPE_DATETIME ||
type == MYSQL_TYPE_TIME || type == MYSQL_TYPE_DATE)
new_field= item->tmp_table_field_from_field_type(table);
/*
Make sure that the blob fits into a Field_varstring which has
2-byte lenght.
*/
else if (item->max_length/item->collation.collation->mbmaxlen > 255 &&
convert_blob_length)
item->max_length/item->collation.collation->mbmaxlen < UINT_MAX16
&& convert_blob_length)
new_field= new Field_varstring(convert_blob_length, maybe_null,
item->name, table,
item->collation.collation);