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:
@ -1443,3 +1443,78 @@ drop table t1;
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
#
|
||||
# MDEV-31276: Execution of PS from grouping query with join
|
||||
# and GROUP_CONCAT set function
|
||||
#
|
||||
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");
|
||||
set group_concat_max_len=5;
|
||||
select count(*), group_concat(t1.b,t2.c)
|
||||
from t1 join t2 on t1.a=t2.a group by t1.a;
|
||||
count(*) group_concat(t1.b,t2.c)
|
||||
2 aaaaa
|
||||
2 bbbbb
|
||||
Warnings:
|
||||
Warning 1260 Row 1 was cut by GROUP_CONCAT()
|
||||
Warning 1260 Row 2 was cut by GROUP_CONCAT()
|
||||
explain select count(*), group_concat(t1.b,t2.c)
|
||||
from t1 join t2 on t1.a=t2.a group by t1.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
|
||||
prepare stmt from "select count(*), group_concat(t1.b,t2.c)
|
||||
from t1 join t2 on t1.a=t2.a group by t1.a";
|
||||
execute stmt;
|
||||
count(*) group_concat(t1.b,t2.c)
|
||||
2 aaaaa
|
||||
2 bbbbb
|
||||
Warnings:
|
||||
Warning 1260 Row 1 was cut by GROUP_CONCAT()
|
||||
Warning 1260 Row 2 was cut by GROUP_CONCAT()
|
||||
execute stmt;
|
||||
count(*) group_concat(t1.b,t2.c)
|
||||
2 aaaaa
|
||||
2 bbbbb
|
||||
Warnings:
|
||||
Warning 1260 Row 1 was cut by GROUP_CONCAT()
|
||||
Warning 1260 Row 2 was cut by GROUP_CONCAT()
|
||||
deallocate prepare stmt;
|
||||
set join_cache_level=0;
|
||||
select count(*), group_concat(t1.b,t2.c)
|
||||
from t1 join t2 on t1.a=t2.a group by t1.a;
|
||||
count(*) group_concat(t1.b,t2.c)
|
||||
2 aaaaa
|
||||
2 bbbbb
|
||||
Warnings:
|
||||
Warning 1260 Row 1 was cut by GROUP_CONCAT()
|
||||
Warning 1260 Row 2 was cut by GROUP_CONCAT()
|
||||
explain select count(*), group_concat(t1.b,t2.c)
|
||||
from t1 join t2 on t1.a=t2.a group by t1.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using filesort
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
|
||||
prepare stmt from "select count(*), group_concat(t1.b,t2.c)
|
||||
from t1 join t2 on t1.a=t2.a group by t1.a";
|
||||
execute stmt;
|
||||
count(*) group_concat(t1.b,t2.c)
|
||||
2 aaaaa
|
||||
2 bbbbb
|
||||
Warnings:
|
||||
Warning 1260 Row 1 was cut by GROUP_CONCAT()
|
||||
Warning 1260 Row 2 was cut by GROUP_CONCAT()
|
||||
execute stmt;
|
||||
count(*) group_concat(t1.b,t2.c)
|
||||
2 aaaaa
|
||||
2 bbbbb
|
||||
Warnings:
|
||||
Warning 1260 Row 1 was cut by GROUP_CONCAT()
|
||||
Warning 1260 Row 2 was cut by GROUP_CONCAT()
|
||||
deallocate prepare stmt;
|
||||
set join_cache_level=default;
|
||||
set group_concat_max_len=default;
|
||||
drop table t1,t2;
|
||||
# End of 10.5 tests
|
||||
|
Reference in New Issue
Block a user