List:Commits« Previous MessageNext Message »
From:Øystein Grøvlen Date:October 3 2010 4:13pm
Subject:Re: bzr commit into mysql-trunk-bugfixing branch (bar:3283) Bug#55744
View as plain text  
Looks good. Verified that it fixes the problem.

--
Øystein


On 09/30/2010 01:27 PM, Alexander Barkov wrote:
> #At file:///home/bar/mysql-bzr/mysql-trunk-bugfixing.b55744/ based on
> revid:vvaintroub@stripped
>
>   3283 Alexander Barkov	2010-09-30
>        Bug#55744 GROUP_CONCAT + CASE + ucs return garbage
>
>        Problem: CASE didn't work with a mixture of different character
>        sets in THEN/ELSE in some cases.
>        This happened because after character set aggregation
>        newly created Item_func_conv_charset items corresponding
>        to THEN/ELSE arguments were not put back to args[] array.
>
>        Fix:
>        put all Item_func_conv_charset back to args[].
>
>
>          @ mysql-test/include/ctype_numconv.inc
>          @ mysql-test/r/ctype_ucs.result
>          Adding tests
>
>          @ sql/item_cmpfunc.cc
>          Put "agg" back to args[] after character set aggregation.
>
>      modified:
>        mysql-test/include/ctype_numconv.inc
>        mysql-test/r/ctype_ucs.result
>        sql/item_cmpfunc.cc
> === modified file 'mysql-test/include/ctype_numconv.inc'
> --- a/mysql-test/include/ctype_numconv.inc	2010-08-19 11:55:35 +0000
> +++ b/mysql-test/include/ctype_numconv.inc	2010-09-30 11:22:44 +0000
> @@ -1635,12 +1635,7 @@ CREATE TABLE t1 (a MEDIUMINT NULL) ENGIN
>   INSERT INTO t1 VALUES (1234567);
>   SELECT GROUP_CONCAT(IFNULL(a,'')) FROM t1;
>   SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1;
> -if (`SELECT @@character_set_connection != 'ucs2'`)
> -{
> -  # Temporarily disable for ucs2
> -  # For details, see Bug#55744 GROUP_CONCAT + CASE + ucs return garbage
> -  SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1;
> -}
> +SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1;
>   --enable_metadata
>   SELECT COALESCE(a,'') FROM t1 GROUP BY 1;
>   --disable_metadata
>
> === modified file 'mysql-test/r/ctype_ucs.result'
> --- a/mysql-test/r/ctype_ucs.result	2010-08-19 12:17:24 +0000
> +++ b/mysql-test/r/ctype_ucs.result	2010-09-30 11:22:44 +0000
> @@ -3919,6 +3919,9 @@ GROUP_CONCAT(IFNULL(a,''))
>   SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1;
>   GROUP_CONCAT(IF(a,a,''))
>   1234567
> +SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1;
> +GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END)
> +1234567
>   SELECT COALESCE(a,'') FROM t1 GROUP BY 1;
>   Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max
> length	Is_null	Flags	Decimals	Charsetnr
>   def					COALESCE(a,'')	253	9	7	Y	0	31	8
>
> === modified file 'sql/item_cmpfunc.cc'
> --- a/sql/item_cmpfunc.cc	2010-09-27 11:37:21 +0000
> +++ b/sql/item_cmpfunc.cc	2010-09-30 11:22:44 +0000
> @@ -3029,6 +3029,14 @@ void Item_func_case::fix_length_and_dec(
>     {
>       if (agg_arg_charsets_for_string_result(collation, agg, nagg))
>         return;
> +    /*
> +      Copy all THEN and ELSE items back to args[] array.
> +      Some of the items might have been changed to Item_func_conv_charset.
> +    */
> +    for (nagg= 0 ; nagg<  ncases / 2 ; nagg++)
> +      args[nagg * 2 + 1]= agg[nagg];
> +    if (else_expr_num != -1)
> +      args[else_expr_num]= agg[nagg++];
>     }
>     else
>       collation.set_numeric();
>
>
>
>
>


Thread
bzr commit into mysql-trunk-bugfixing branch (bar:3283) Bug#55744Alexander Barkov30 Sep
  • Re: bzr commit into mysql-trunk-bugfixing branch (bar:3283) Bug#55744Øystein Grøvlen3 Oct