Commit 54735ae3 authored by unknown's avatar unknown

Bug #3087 CONCAT_WS makes the server die in case of illegal mix of collations

parent 8bbb6d2b
......@@ -339,6 +339,8 @@ select concat(_latin1'a',_latin2'a',_latin5'a');
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE), (latin5_turkish_ci,COERCIBLE) for operation 'concat'
select concat(_latin1'a',_latin2'a',_latin5'a',_latin7'a');
ERROR HY000: Illegal mix of collations for operation 'concat'
select concat_ws(_latin1'a',_latin2'a');
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'concat_ws'
select FIELD('b','A','B');
FIELD('b','A','B')
2
......
......@@ -195,6 +195,8 @@ select concat(_latin1'a',_latin2'a');
select concat(_latin1'a',_latin2'a',_latin5'a');
--error 1271
select concat(_latin1'a',_latin2'a',_latin5'a',_latin7'a');
--error 1267
select concat_ws(_latin1'a',_latin2'a');
#
# Test FIELD() and collations
......
......@@ -628,9 +628,11 @@ void Item_func_concat_ws::fix_length_and_dec()
max_length=separator->max_length*(arg_count-1);
for (uint i=0 ; i < arg_count ; i++)
{
DTCollation tmp(collation.collation, collation.derivation);
max_length+=args[i]->max_length;
if (collation.aggregate(args[i]->collation))
{
collation.set(tmp); // Restore the previous value
my_coll_agg_error(collation, args[i]->collation, func_name());
break;
}
......
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