mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Bug#51980 mysqld service crashes with a simple COUNT(DISTINCT) query over a view
Problem: Segmentation fault in add_group_and_distinct_keys() when accessing field of what is assumed to be an Item_field object. Cause: In case of views, the item added to list by is_indexed_agg_distinct() was not of type Item_field, but Item_ref. Resolution: Add the real Item_field object, the one referred to by Item_ref object, to the list, instead.
This commit is contained in:
@@ -86,3 +86,11 @@ select count(distinct if(f1,3,f2)) from t1;
|
||||
count(distinct if(f1,3,f2))
|
||||
2
|
||||
drop table t1;
|
||||
create table t1 (i int);
|
||||
insert into t1 values (0), (1);
|
||||
create view v1 as select * from t1;
|
||||
select count(distinct i) from v1;
|
||||
count(distinct i)
|
||||
2
|
||||
drop table t1;
|
||||
drop view v1;
|
||||
|
||||
Reference in New Issue
Block a user