1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-31276 Wrong warnings on 2-nd execution of PS for query with GROUP_CONCAT

If a query with GROUP_CONCAT is executed then the server reports a warning
every time when the length of the result of this function exceeds the set
value of the system variable group_concat_max_len. This bug led to the set
of warnings from the second execution of the prepared statement that did
not coincide with the one from the first execution if the executed query
was a grouping query over a join of tables using GROUP_CONCAT function and
join cache was not allowed to be employed.
The descrepancy of the sets of warnings was due to lack of cleanup for
Item_func_group_concat::row_count after execution of the query.

Approved by Oleksandr Byelkin <sanja@mariadb.com>
This commit is contained in:
Igor Babaev
2024-02-22 22:58:52 -08:00
parent e63311c2cf
commit 8778a83eee
5 changed files with 116 additions and 15 deletions

View File

@ -1066,3 +1066,43 @@ drop table t1;
--echo #
--echo # End of 10.3 tests
--echo #
--echo #
--echo # MDEV-31276: Execution of PS from grouping query with join
--echo # and GROUP_CONCAT set function
--echo #
create table t1 (a int, b varchar(20)) engine=myisam;
create table t2 (a int, c varchar(20)) engine=myisam;
insert into t1 values (1,"aaaaaaaaaa"),(2,"bbbbbbbbbb");
insert into t2 values (1,"cccccccccc"),(2,"dddddddddd");
insert into t2 values (1,"eeeeeee"),(2,"fffffff");
let $q=
select count(*), group_concat(t1.b,t2.c)
from t1 join t2 on t1.a=t2.a group by t1.a;
set group_concat_max_len=5;
eval $q;
eval explain $q;
eval prepare stmt from "$q";
execute stmt;
execute stmt;
deallocate prepare stmt;
set join_cache_level=0;
eval $q;
eval explain $q;
eval prepare stmt from "$q";
execute stmt;
execute stmt;
deallocate prepare stmt;
set join_cache_level=default;
set group_concat_max_len=default;
drop table t1,t2;
--echo # End of 10.5 tests