Skip to content

[Compatibility]: prepared GROUP_CONCAT ignores MySQL prepare-time limit floor #28253

Closed

Description

@Ariznawlll

Problem

A prepared GROUP_CONCAT statement reacts differently from MySQL when group_concat_max_len is reduced after PREPARE.

MySQL preserves the statement's prepare-time lower bound: preparing with a sufficiently large value and then reducing the session value does not shorten later executions. MatrixOne applies the reduced execution-time value and returns a truncated result.

Increasing the value after preparing with a small limit expands the result in both systems, so this is specifically the missing prepare-time lower-bound behavior rather than a generally fixed parameter value.

Version

  • MatrixOne main: e7bb0572235ec4bac81eb098eb0ad8900f0065ab
  • MySQL: 8.3.0

Reproduction

create database codex_group_concat_prepare_limit;
use codex_group_concat_prepare_limit;
create table g(id int primary key, v varchar(20));
insert into g values (1,'éé'),(2,'中中'),(3,'abcd');

set session group_concat_max_len=1024;
prepare ps from
  'select group_concat(v order by id separator \'|\') from g';

set session group_concat_max_len=5;
execute ps;

MatrixOne returns the execution-time-limited value:

éé|

MySQL returns the complete value:

éé|中中|abcd

The reverse direction confirms the boundary:

set session group_concat_max_len=5;
prepare ps2 from
  'select group_concat(v order by id separator \'|\') from g';
execute ps2; -- both: éé|

set session group_concat_max_len=1024;
execute ps2; -- both: éé|中中|abcd

Expected behavior

Prepared GROUP_CONCAT statements should follow MySQL's behavior when group_concat_max_len changes after preparation, including retaining the prepare-time lower bound when the session value is reduced.

Activity

  1. added this to the MO-202609 milestone on Sep 5, 2026
  2. added
    kind/bug
    on Sep 5, 2026
  3. added theissue type on Sep 5, 2026
  4. self-assigned this
    on Sep 5, 2026
  5. added a commit that references this issue on Sep 10, 2026
    2b250ab
  6. Ariznawlll commented on Sep 10, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试版本

    • 分支:main
    • commit:2b250abbc74b4443a2776655b2004bb9dc94ebe3
    • 部署方式:本地隔离 standalone,1 CN / 1 TN / 1 LogService
    • 测试日期:2026-09-10

    原问题验证

    先以 group_concat_max_len=1024 PREPARE 聚合,再将会话值降为 5 后 EXECUTE;结果仍稳定返回完整 éé|中中|abcd,保留 prepare-time lower bound。连续执行 3 轮一致。

    Happy Path 覆盖

    1. 大上限 PREPARE 后降为 5:两次 EXECUTE 都返回完整结果。
    2. 大上限恢复为 1024 后再次 EXECUTE:结果仍完整,证明预处理状态可复用。
    3. 小上限 5 PREPARE 后立即 EXECUTE:返回截断结果 éé|;随后提升为 1024 后正确扩展为完整结果。

    Unhappy Path 覆盖

    1. 上限降低后的执行不会错误使用执行期 5 截断已按大上限 PREPARE 的语句。
    2. 小上限预处理后提升上限不会固定为旧值;两种方向均验证,预处理语句均已 DEALLOCATE,未产生会话污染。

    白盒验证

    不适用。本轮以 SQL PREPARE/EXECUTE 的公开语义验证;修复 PR #28504 中 TestPreparedGroupConcatFloorCapturedWithoutPhysicalCompile 定向测试已在当前 main 通过。

    回归测试

    已加入 MOTR:motr#156,文件 suites/14_issue_regression/t/issue_28221_28252_28253_findinset_group_concat.test。该 case 连续 3 轮通过,共 135/135 条 SQL 成功。

    测试证据

    • 修复 PR:matrixone#28504,已包含于测试 commit。
    • MOTR 回归 PR:motr#156。
    • 3 轮黑盒输出 SHA-256 完全一致。

    测试结论

    测试通过。

  7. added 3 commits that reference this issue on Sep 17, 2026
    42809b0
    9615a40
    9f290b5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions