• Sergey Glukhov's avatar
    Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT · bd4785a6
    Sergey Glukhov authored
    When temporary tables is used for result sorting
    result field for gconcat function is created using
    group_concat_max_len size. It leads to result truncation
    when character_set_results is multi-byte character set due
    to insufficient tmp table field size.
    The fix is to increase temporary table field size for
    gconcat. Method make_string_field() is overloaded
    for Item_func_group_concat class and uses
    max_characters * collation.collation->mbmaxlen size for
    result field. max_characters is maximum number of characters
    what can fit into max_length size.
    
    
    mysql-test/r/ctype_utf16.result:
      test result
    mysql-test/r/ctype_utf32.result:
      test result
    mysql-test/r/ctype_utf8.result:
      test result
    mysql-test/t/ctype_utf16.test:
      test case
    mysql-test/t/ctype_utf32.test:
      test case
    mysql-test/t/ctype_utf8.test:
      test case
    sql/item.h:
      make Item::make_string_field() virtual
    sql/item_sum.cc:
      added Item_func_group_concat::make_string_field(TABLE *table) method
      which uses max_characters * collation.collation->mbmaxlen size for
      result item. max_characters is maximum number of characters what can
      fit into max_length size.
    sql/item_sum.h:
      added Item_func_group_concat::make_string_field(TABLE *table) method
    bd4785a6
item_sum.cc 88.1 KB