Bug #121358 Prepared statement does not reflect updated group_concat_max_len during execution
Submitted: 23 Sep 7:46 Modified: 23 Sep 10:29
Reporter: Xiaoyuan Xie Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S2 (Serious)
Version:9.7.2 OS:Ubuntu
Assigned to: CPU Architecture:Any

[23 Sep 7:46] Xiaoyuan Xie
Description:
A prepared statement containing GROUP_CONCAT() does not reflect a subsequent change to the session variable group_concat_max_len.

In the following test case, the statement is prepared first, and group_concat_max_len is then set to 4. When the prepared statement is executed, GROUP_CONCAT() returns the complete 5-character string instead of truncating the result to the configured maximum length of 4.

How to repeat:
PREPARE s FROM 'SELECT GROUP_CONCAT(''12345'')';

SET SESSION group_concat_max_len = 4;

EXECUTE s;

Actual Result: 12345 
Expected Result: 1234
[23 Sep 10:29] Chaithra Marsur Gopala Reddy
Hi Xiaoyuan Xie,

Thank you for the test case. Verified as described. Increasing the group_concat_max_len seems to trigger re-preparation but not decreasing it. So marking this as a bug because of the inconsistency.