Commit 4c3108fc authored by evgen@moonbone.local's avatar evgen@moonbone.local

Merge moonbone.local:/home/evgen/bk-trees/mysql-5.0-opt

into moonbone.local:/work/15962-bug-5.0-opt-mysql
parents bb94b35f d027dd7c
...@@ -68,3 +68,10 @@ select 'a' union select concat('a', -0.0000); ...@@ -68,3 +68,10 @@ select 'a' union select concat('a', -0.0000);
a a
a a
a0.0000 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;
...@@ -53,3 +53,11 @@ select 'a' union select concat('a', -0.0); ...@@ -53,3 +53,11 @@ select 'a' union select concat('a', -0.0);
select 'a' union select concat('a', -0.0000); select 'a' union select concat('a', -0.0000);
# End of 4.1 tests # 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;
...@@ -389,7 +389,14 @@ void Item_func_concat::fix_length_and_dec() ...@@ -389,7 +389,14 @@ void Item_func_concat::fix_length_and_dec()
return; return;
for (uint i=0 ; i < arg_count ; i++) for (uint i=0 ; i < arg_count ; i++)
max_result_length+= args[i]->max_length; {
if (args[i]->collation.collation->mbmaxlen != collation.collation->mbmaxlen)
max_result_length+= (args[i]->max_length /
args[i]->collation.collation->mbmaxlen) *
collation.collation->mbmaxlen;
else
max_result_length+= args[i]->max_length;
}
if (max_result_length >= MAX_BLOB_WIDTH) if (max_result_length >= MAX_BLOB_WIDTH)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment