Skip to content

bug: GROUP_CONCAT() function return result set error #938

@davidshiz

Description

@davidshiz

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • I confirm there is no existing issue for this

Describe the problem

GROUP_CONCAT() function, by default, the values of group are separated by (, ) operator,
But here, the result set did not separate by the comma (, ).

The wrong result is as follows:

mysql> select * from test;
+---------------+
| d1            |
+---------------+
|          1234 |
| 1234567890123 |
|      56789012 |
+---------------+
3 rows in set (0.00 sec)
 
 mysql> SELECT group_concat(d1 ORDER BY d1) FROM (SELECT d1 FROM test)a1;
+------------------------------+
| group_concat(d1 ORDER BY d1) |
+------------------------------+
| 1234123456789012356789012    |
+------------------------------+
1 row in set (0.00 sec)

Expected behavior

mysql> SELECT group_concat(d1 ORDER BY d1) FROM (SELECT d1 FROM test)a1;
+------------------------------+
| group_concat(d1 ORDER BY d1) |
+------------------------------+
| 1234,56789012,1234567890123  |
+------------------------------+
1 row in set (0.00 sec)

How To Reproduce

CREATE TABLE test (d1 DECIMAL(17));
INSERT INTO test VALUES
    (1234),     
    (1234567890123),
    (56789012);
SELECT group_concat(d1 ORDER BY d1) FROM (SELECT d1 FROM test)a1;

Environment

root@localhost:/# /stonedb57/install/bin/mysqld --version
/stonedb57/install/bin/mysqld  Ver 5.7.36-StoneDB for Linux on x86_64 (build-)
build information as follow:
        Repository address: https://github.com/stoneatom/stonedb.git:stonedb-5.7-dev
        Branch name: stonedb-5.7-dev
        Last commit ID: d0c2e01b6
        Last commit time: Date:   Wed Nov 2 19:58:00 2022 +0800
        Build time: Date: Sun 06 Nov 2022 08:50:06 AM UTC
root@ub01:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"

Are you interested in submitting a PR to solve the problem?

  • Yes, I will!

Metadata

Metadata

Assignees

Labels

A-bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions