1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

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().
This commit is contained in:
evgen@moonbone.local
2006-06-07 01:10:23 +04:00
parent fdc2b921cc
commit d027dd7c0d
3 changed files with 23 additions and 1 deletions

View File

@@ -68,3 +68,10 @@ select 'a' union select concat('a', -0.0000);
a
a
a0.0000
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;
a
1234562
x
drop table t1;