• unknown's avatar
    Fixed bug#15962: CONCAT() in UNION may lead to a data trucation. · 6e80e9a4
    unknown authored
    To calculate its max_length the CONCAT() function is simply sums max_lengths
    of its arguments but when the collation of an argument differs from the 
    collation of the CONCAT() max_length will be wrong. This may lead to a data
    truncation when a tmp table is used, in UNIONS for example.
    
    The Item_func_concat::fix_length_and_dec() function now recalculates the 
    max_length of an argument when the mbmaxlen of the argument differs from the
    mbmaxlen of the CONCAT().
    
    
    mysql-test/t/func_concat.test:
      Added test case for bug#15962:CONCAT() in UNION may lead to a data trucation.
    mysql-test/r/func_concat.result:
      Added test case for bug#15962:CONCAT() in UNION may lead to a data trucation.
    sql/item_strfunc.cc:
      Fixed bug#15962: CONCAT() in UNION may lead to a data trucation.
      The Item_func_concat::fix_length_and_dec() function now recalculates the 
      max_length of an argument when the mbmaxlen of the argument differs from the
      mbmaxlen of the CONCAT().
    6e80e9a4
func_concat.test 1.71 KB