From d027dd7c0d9d2d105e712e6ff89a4483a7dfc177 Mon Sep 17 00:00:00 2001 From: "evgen@moonbone.local" <> Date: Wed, 7 Jun 2006 01:10:23 +0400 Subject: Fixed bug#15962: CONCAT() in UNION may lead to a data trucation. 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 | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mysql-test/t/func_concat.test') diff --git a/mysql-test/t/func_concat.test b/mysql-test/t/func_concat.test index 37fc0e105b8..42201961222 100644 --- a/mysql-test/t/func_concat.test +++ b/mysql-test/t/func_concat.test @@ -53,3 +53,11 @@ select 'a' union select concat('a', -0.0); select 'a' union select concat('a', -0.0000); # End of 4.1 tests + +# +# Bug#15962: CONCAT() in UNION may lead to a data trucation. +# +create table t1(f1 varchar(6)) charset=utf8; +insert into t1 values ("123456"); +select concat(f1, 2) a from t1 union select 'x' a from t1; +drop table t1; -- cgit v1.2.1