summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/func_gconcat.result9
-rw-r--r--mysql-test/t/func_gconcat.test10
-rw-r--r--sql/item_sum.cc1
3 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index 12bc5ca2582..9ebda925b94 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -469,6 +469,15 @@ select collation(group_concat(a,b)) from t1;
ERROR HY000: Illegal mix of collations (cp1250_general_ci,IMPLICIT) and (koi8r_general_ci,IMPLICIT) for operation 'group_concat'
drop table t1;
drop table t2;
+CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp850);
+INSERT INTO t1 VALUES ('À');
+SELECT a FROM t1;
+a
+SELECT GROUP_CONCAT(a) FROM t1;
+GROUP_CONCAT(a)
+DROP TABLE t1;
CREATE TABLE t1 (id int);
SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL;
gc
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index 9e003d19ab9..99c64673c22 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -282,6 +282,16 @@ drop table t1;
drop table t2;
#
+# Bug #12829
+# Cannot convert the charset of a GROUP_CONCAT result
+#
+CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp850);
+INSERT INTO t1 VALUES ('À');
+SELECT a FROM t1;
+SELECT GROUP_CONCAT(a) FROM t1;
+DROP TABLE t1;
+
+#
# bug #7769: group_concat returning null is checked in having
#
CREATE TABLE t1 (id int);
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 000dcdb4997..6996924caa0 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1935,6 +1935,7 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
args, arg_count, MY_COLL_ALLOW_CONV))
return 1;
+ result.set_charset(collation.collation);
result_field= 0;
null_value= 1;
max_length= group_concat_max_len;