[MDEV-18943] Group Concat with limit not working with views Created: 2019-03-15  Updated: 2019-05-03  Resolved: 2019-05-03

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.3, 10.4
Fix Version/s: 10.3.15, 10.4.5

Type: Bug Priority: Major
Reporter: Varun Gupta (Inactive) Assignee: Varun Gupta (Inactive)
Resolution: Fixed Votes: 0
Labels: None


 Description   

DATASET

create table t1 (grp int, a bigint unsigned, c char(10) , d char(10) not null);
insert into t1 values (1,1,NULL,"a");
insert into t1 values (1,10,"b","a");
insert into t1 values (1,11,"c","a");
insert into t1 values (2,2,"c","a");
insert into t1 values (2,3,"b","b");
insert into t1 values (3,4,"E","a");
insert into t1 values (3,5,"C","b");
insert into t1 values (3,6,"D","c");
insert into t1 values (3,7,"E","c");

MariaDB [test]> select grp,group_concat(c) from t1 group by grp;
+------+-----------------+
| grp  | group_concat(c) |
+------+-----------------+
|    1 | b,c             |
|    2 | c,b             |
|    3 | E,C,D,E         |
+------+-----------------+
3 rows in set (0.003 sec)
 
MariaDB [test]> select grp,group_concat(c limit 1,1 ) from t1 group by grp;
+------+----------------------------+
| grp  | group_concat(c limit 1,1 ) |
+------+----------------------------+
|    1 | c                          |
|    2 | b                          |
|    3 | C                          |
+------+----------------------------+
3 rows in set (0.003 sec)

When I run the same query as above but wrapped in a view, then limit does not work with GROUP_CONCAT

MariaDB [test]> create view v1 as select grp,group_concat(c limit 1,1 ) from t1 group by grp;
Query OK, 0 rows affected (0.003 sec)
 
MariaDB [test]> select * from v1;
+------+----------------------------+
| grp  | group_concat(c limit 1,1 ) |
+------+----------------------------+
|    1 | b,c                        |
|    2 | c,b                        |
|    3 | E,C,D,E                    |
+------+----------------------------+
3 rows in set (0.006 sec)



 Comments   
Comment by Varun Gupta (Inactive) [ 2019-03-16 ]

Patch
http://lists.askmonty.org/pipermail/commits/2019-March/013563.html

Comment by Igor Babaev [ 2019-05-01 ]

Ok to push into 10.3

Generated at Thu Feb 08 08:47:54 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.