diff -ruN mysql-9.7.0/sql/item_sum.cc mysql-9.7.0.patched/sql/item_sum.cc --- mysql-9.7.0/sql/item_sum.cc 2026-04-07 16:08:28.000000000 +0000 +++ mysql-9.7.0.patched/sql/item_sum.cc 2026-04-28 08:44:36.083552761 +0000 @@ -4368,9 +4368,13 @@ result->length(), &well_formed_error); result->length(old_length + add_length); item->warning_for_row = true; - push_warning_printf( - current_thd, Sql_condition::SL_WARNING, ER_CUT_VALUE_GROUP_CONCAT, - ER_THD(current_thd, ER_CUT_VALUE_GROUP_CONCAT), item->row_count); + + if (current_thd->variables.strict_group_concat) + my_error(ER_CUT_VALUE_GROUP_CONCAT, MYF(0), item->row_count); + else + push_warning_printf( + current_thd, Sql_condition::SL_WARNING, ER_CUT_VALUE_GROUP_CONCAT, + ER_THD(current_thd, ER_CUT_VALUE_GROUP_CONCAT), item->row_count); /** To avoid duplicated warnings in Item_func_group_concat::val_str() @@ -4863,9 +4867,13 @@ if (table && table->blob_storage && table->blob_storage->is_truncated_value()) { warning_for_row = true; - push_warning_printf( - current_thd, Sql_condition::SL_WARNING, ER_CUT_VALUE_GROUP_CONCAT, - ER_THD(current_thd, ER_CUT_VALUE_GROUP_CONCAT), row_count); + + if (current_thd->variables.strict_group_concat) + my_error(ER_CUT_VALUE_GROUP_CONCAT, MYF(0), row_count); + else + push_warning_printf( + current_thd, Sql_condition::SL_WARNING, ER_CUT_VALUE_GROUP_CONCAT, + ER_THD(current_thd, ER_CUT_VALUE_GROUP_CONCAT), row_count); } return &result; diff -ruN mysql-9.7.0/sql/sys_vars.cc mysql-9.7.0.patched/sql/sys_vars.cc --- mysql-9.7.0/sql/sys_vars.cc 2026-04-07 16:08:28.000000000 +0000 +++ mysql-9.7.0.patched/sql/sys_vars.cc 2026-04-28 08:07:13.948369433 +0000 @@ -5699,6 +5699,12 @@ HINT_UPDATEABLE SESSION_VAR(group_concat_max_len), CMD_LINE(REQUIRED_ARG), VALID_RANGE(4, ULONG_MAX), DEFAULT(1024), BLOCK_SIZE(1)); +static Sys_var_bool Sys_strict_group_concat( + "strict_group_concat", + "When GROUP_CONCAT function handle exceeds group_concat_max_len, " + "make an error instead of a warning.", + HINT_UPDATEABLE SESSION_VAR(strict_group_concat), CMD_LINE(OPT_ARG), DEFAULT(false)); + static char *glob_hostname_ptr; static Sys_var_charptr Sys_hostname( "hostname", "Server host name", diff -ruN mysql-9.7.0/sql/system_variables.h mysql-9.7.0.patched/sql/system_variables.h --- mysql-9.7.0/sql/system_variables.h 2026-04-07 16:08:28.000000000 +0000 +++ mysql-9.7.0.patched/sql/system_variables.h 2026-04-28 07:21:41.723981542 +0000 @@ -274,6 +274,7 @@ ulong trans_alloc_block_size; ulong trans_prealloc_size; ulong group_concat_max_len; + bool strict_group_concat; ulong binlog_format; ///< binlog format for this thd (see enum_binlog_format) ulong rbr_exec_mode_options; // see enum_rbr_exec_mode bool binlog_direct_non_trans_update;