• unknown's avatar
    Fixed bug#14169: type of group_concat() result changed to blob if tmp_table was · a2066982
    unknown authored
    used
    
    In a simple queries a result of the GROUP_CONCAT() function was always of 
    varchar type.
    But if length of GROUP_CONCAT() result is greater than 512 chars and temporary
    table is used during select then the result is converted to blob, due to
    policy to not to store fields longer than 512 chars in tmp table as varchar
    fields.
    
    In order to provide consistent behaviour, result of GROUP_CONCAT() now
    will always be converted to blob if it is longer than 512 chars.
    Item_func_group_concat::field_type() is modified accordingly.
    
    
    mysql-test/t/func_gconcat.test:
      Added test case for bug#14169: type of group_concat() result changed to blob if tmp_table was used
    mysql-test/r/func_gconcat.result:
      Added test case for bug#14169: type of group_concat() result changed to blob if tmp_table was used
    sql/unireg.h:
      Added the CONVERT_IF_BIGGER_TO_BLOB constant
    sql/sql_select.cc:
      Fixed bug#14169: type of group_concat() result changed to blob if tmp_table was used
      The unnamed constant 255 in the create_tmp_field() and create_tmp_field_from_item() functions now defined as the CONVERT_IF_BIGGER_TO_BLOB constant.
      The create_tmp_field() function now converts the Item_sum string result to a blob field based on its char length.
    sql/item_sum.h:
      Fixed bug#14169: type of group_concat() result changed to blob if tmp_table was used
      To the Item_func_group_concat calls added the member function field_type() which returns the BLOB or VAR_STRING type based on the items length.
    sql/item_func.cc:
      Fixed bug#14169: type of group_concat() result changed to blob if tmp_table was used
      In the Item_func::tmp_table_field() function the unnamed constant 255 is changed to the CONVERT_IF_BIGGER_TO_BLOB constant.
      The Item_func::tmp_table_field() function now measures the result length in chars rather than bytes when converting string result to a blob.
    a2066982
item_sum.h 22.6 KB