From d9360eae3b57c7ef4b1a14b270d06c8423df3bfb Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Nov 2006 12:45:48 +0400 Subject: Bug#23451 GROUP_CONCAT truncates a multibyte utf8 character Problem: GROUP_CONCAT on a multi-byte column can truncate in the middle of a multibyte character when applying group_concat_max_len limit. It produces an invalid multi-byte character in the result string. The second, easier version - reusing old "warning_for_row" flag, instead of introducing of "result_is_full" - which was added in the previous commit. mysql-test/r/func_gconcat.result: Adding test case mysql-test/t/func_gconcat.test: Adding test case sql/item_sum.cc: Adding well_formed_len() call not to cut in the middle of a multi-byte character. --- mysql-test/t/func_gconcat.test | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'mysql-test/t/func_gconcat.test') diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index d51d88d50ef..aebceeedcc3 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -390,6 +390,30 @@ select f1, group_concat(f1+1) from t1 group by f1 with rollup; select count(distinct (f1+1)) from t1 group by f1 with rollup; drop table t1; +# +# Bug#23451 GROUP_CONCAT truncates a multibyte utf8 character +# +set names utf8; +create table t1 +( + x text character set utf8 not null, + y integer not null +); +insert into t1 values (repeat('a', 1022), 0), (repeat(_utf8 0xc3b7, 4), 0); +let $1= 10; +while ($1) +{ + eval set group_concat_max_len= 1022 + $1; + --disable_result_log + select @x:=group_concat(x) from t1 group by y; + --enable_result_log + select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12); + dec $1; +} +drop table t1; +set group_concat_max_len=1024; +set names latin1; + # # Bug#14169 type of group_concat() result changed to blob if tmp_table was used # -- cgit v1.2.1