Bug #94611 Wrong results returned with "group by"
Submitted: 10 Mar 2019 2:14 Modified: 10 Mar 2019 5:27
Reporter: Hope Lee (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S2 (Serious)
Version:8.0.15-rds-dev, 8.0.15, 5.7.25,5.6.43 OS:CentOS
Assigned to: CPU Architecture:Any

[10 Mar 2019 2:14] Hope Lee
Description:
The time type results are inconsistent when requesting a query with or without group by.

How to repeat:
mysql> CREATE TABLE test_table1 (
       id bigint(20) NOT NULL,
       int_test int(11) DEFAULT NULL,
       PRIMARY KEY (id)) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
mysql> INSERT INTO test_table1 values(1, 24);
mysql> INSERT INTO test_table1 values(2, 30);
mysql> select id, int_test/7, maketime(int_test-12, int_test%4, int_test/7) as col1 from test_table1;
+----+------------+---------------+
| id | int_test/7 | col1          |
+----+------------+---------------+
|  1 |     3.4286 | 12:00:03.4285 |
|  2 |     4.2857 | 18:02:04.2857 |
+----+------------+---------------+
2 rows in set (0.00 sec)
mysql> select maketime(int_test-12, int_test%4, int_test/7) as col1 from test_table1 group by col1;
+---------------+
| col1          |
+---------------+
| 12:00:03.4286 |
| 18:02:04.2857 |
+---------------+
2 rows in set (0.00 sec)
[10 Mar 2019 5:27] MySQL Verification Team
Hello Lee,

Thank you for the report and test case.

regards,
Umesh