mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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
This commit is contained in:
@ -641,3 +641,16 @@ select charset(group_concat(c1 order by c2)) from t1;
|
||||
charset(group_concat(c1 order by c2))
|
||||
latin1
|
||||
drop table t1;
|
||||
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;
|
||||
a CHAR_LENGTH(b)
|
||||
1 120000
|
||||
2 120000
|
||||
SELECT CHAR_LENGTH( GROUP_CONCAT(b) ) FROM t1;
|
||||
CHAR_LENGTH( GROUP_CONCAT(b) )
|
||||
240001
|
||||
SET GROUP_CONCAT_MAX_LEN = 1024;
|
||||
DROP TABLE t1;
|
||||
|
Reference in New Issue
Block a user