summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_gconcat.test
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@macbook.gmz>2006-07-25 11:45:10 +0300
committerunknown <gkodinov/kgeorge@macbook.gmz>2006-07-25 11:45:10 +0300
commit4e7121c07b0cfb5ed39e25edd9022ba1811d65fa (patch)
tree4f46bbdaea88db32a194b6e66baa82a41c8894c9 /mysql-test/t/func_gconcat.test
parenta8fd83d676a5d8a64921f1f13ba4fa4f45221da8 (diff)
downloadmariadb-git-4e7121c07b0cfb5ed39e25edd9022ba1811d65fa.tar.gz
Bug#16712: group_concat returns odd srting insead of intended result
when calculating GROUP_CONCAT all blob fields are transformed to varchar when making the temp table. However a varchar has at max 2 bytes for length. This fix makes the conversion only for blobs whose max length is below that limit. Otherwise blob field is created by make_string_field() call. mysql-test/r/func_gconcat.result: Bug#16712: group_concat returns odd srting insead of intended result * testsuite for the bug mysql-test/t/func_gconcat.test: Bug#16712: group_concat returns odd srting insead of intended result * testsuite for the bug sql/item_sum.cc: Bug#16712: group_concat returns odd srting insead of intended result * force blob->varchar conversion for small enough blobs only sql/sql_select.cc: Bug#16712: group_concat returns odd srting insead of intended result * force blob->varchar conversion for small enough blobs only
Diffstat (limited to 'mysql-test/t/func_gconcat.test')
-rw-r--r--mysql-test/t/func_gconcat.test14
1 files changed, 14 insertions, 0 deletions
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index fbfdfa3b5d0..98c21986aa9 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -433,3 +433,17 @@ create table t1 (c1 varchar(10), c2 int);
select charset(group_concat(c1 order by c2)) from t1;
drop table t1;
+#
+# Bug #16712: group_concat returns odd string instead of intended result
+#
+CREATE TABLE t1 (a INT(10), b LONGTEXT, PRIMARY KEY (a));
+
+SET GROUP_CONCAT_MAX_LEN = 20000000;
+
+INSERT INTO t1 VALUES (1,REPEAT(CONCAT('A',CAST(CHAR(0) AS BINARY),'B'), 40000));
+INSERT INTO t1 SELECT a + 1, b FROM t1;
+
+SELECT a, CHAR_LENGTH(b) FROM t1;
+SELECT CHAR_LENGTH( GROUP_CONCAT(b) ) FROM t1;
+SET GROUP_CONCAT_MAX_LEN = 1024;
+DROP TABLE t1;