Bug #80224 | CONCAT_WS duplication of arguments when used in conjunction with HAVING | ||
---|---|---|---|
Submitted: | 1 Feb 2016 19:13 | Modified: | 15 Feb 2016 8:59 |
Reporter: | Fredric Johansson | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 5.5.46, 5.6.28, 5.7.11 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[1 Feb 2016 19:13]
Fredric Johansson
[15 Feb 2016 8:59]
MySQL Verification Team
Hello Fredric, Thank you for the report and test case. Observed with 5.7.11 build. Thanks, Umesh
[15 Feb 2016 9:00]
MySQL Verification Team
-- 5.7.11 mysql> SELECT CONCAT_WS('-', GROUP_CONCAT(eg.eg_id), 'f', 'a' ) a, MAX(ep_id) epmax FROM eg JOIN ep USING (eg_id) GROUP BY en_id HAVING epmax>=1 AND a; +-------------------------------------+---------+ | a | epmax | +-------------------------------------+---------+ | 1008437,1008437,1008437,1008437-f-a | 3360182 | | 1008438,1008438-f-a-f-a | 3390182 | | 1008439,1008439,1008439,1008439-f-a | 3810002 | +-------------------------------------+---------+ 3 rows in set (0.00 sec) mysql> SELECT CONCAT_WS('-', GROUP_CONCAT(eg.eg_id), 'f', 'a' ) a, MAX(ep_id) epmax FROM eg JOIN ep USING (eg_id) GROUP BY en_id HAVING epmax>=1; +-------------------------------------+---------+ | a | epmax | +-------------------------------------+---------+ | 1008437,1008437,1008437,1008437-f-a | 3360182 | | 1008438,1008438-f-a | 3390182 | | 1008439,1008439,1008439,1008439-f-a | 3810002 | +-------------------------------------+---------+ 3 rows in set (0.00 sec) mysql> SELECT CONCAT_WS('-', GROUP_CONCAT(DISTINCT eg.eg_id), 'f', 'a' ) a, MAX(ep_id) epmax FROM eg JOIN ep USING (eg_id) GROUP BY en_id HAVING epmax>=1 AND a; +-------------+---------+ | a | epmax | +-------------+---------+ | 1008437-f-a | 3360182 | | 1008438-f-a | 3390182 | | 1008439-f-a | 3810002 | +-------------+---------+ 3 rows in set (0.01 sec)