Skip to content

[Bug]: GROUP_CONCAT ignores group_concat_max_len #25370

Closed

Description

@Ariznawlll

MatrixOne version

latest main tested locally: 0e8602b78

MySQL version

MySQL 8.0.45

Steps to Reproduce

drop database if exists mysql_compat_model8_group_concat;
create database mysql_compat_model8_group_concat;
use mysql_compat_model8_group_concat;

create table t(id int primary key, s varchar(16));
insert into t values (1,'aa'),(2,'bb'),(3,'cc');

set session group_concat_max_len = 5;
select group_concat(s order by s separator '') from t;

Expected Behavior

MySQL honors group_concat_max_len and truncates the result to 5 characters with a warning:

aabbc

Actual Behavior

MatrixOne returns the full concatenated string:

aabbcc

Notes

I searched existing issues for group_concat_max_len and GROUP_CONCAT max_len before filing and did not find a duplicate.

Activity

  1. added
    kind/bug
    severity/s1
    on Jul 2, 2026
  2. added this to the MO-202607 milestone on Jul 2, 2026
  3. added theissue type on Jul 2, 2026
  4. added and removed
    severity/s1
    on Jul 2, 2026
  5. removed
    kind/bug
    on Jul 2, 2026
  6. added
    ai-easy
    on Jul 28, 2026
  7. jiangxinmeng1 commented on Jul 28, 2026

    @jiangxinmeng1
    Contributor

    fixed by #26199

  8. Ariznawlll commented on Jul 28, 2026

    @Ariznawlll
    CollaboratorAuthor

    已在最新 main 分支完成验证,当前问题已修复。

    测试版本:

    • MatrixOne branch:main
    • MatrixOne commit:c8e443bf8610b2af4333ad943ba2075485b16cf8
    • 修复提交:8c9bb6689(fix: honor group_concat_max_len)

    测试步骤:

    1. 创建测试表并写入 aa、bb、cc 和一条 NULL。
    2. 设置 group_concat_max_len=5,执行带固定排序和空分隔符的 GROUP_CONCAT。
    3. 将限制调整为 4,再次执行相同查询。
    4. 在限制为 1024 时创建 PREPARE,然后分别把当前 session 的限制改为 4 和 1024 后执行,验证执行阶段读取当前 session 变量,而不是固化 PREPARE 时的值。
    5. 相同测试连续运行 3 轮,并补充执行相关 GROUP_CONCAT max_len UT 3 轮。

    关键结果:

    group_concat_max_len=5    -> aabbc
    group_concat_max_len=4    -> aabb
    
    PREPARE 后执行:
    group_concat_max_len=4    -> aabb
    group_concat_max_len=1024 -> aabbcc
    

    结果符合预期,未再出现忽略 group_concat_max_len、返回完整字符串的问题。

    已加入 motr 黑盒回归:

    motr 在最新 main 上串行 3 轮和并行 3 轮均通过。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ai-easy

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions