Bug #67529 GROUP BY treats +0 and -0 as different values
| Submitted: | 9 Nov 2012 0:20 | Modified: | 1 Oct 14:11 |
|---|---|---|---|
| Reporter: | Igor T. | Email Updates: | |
| Status: | Duplicate | Impact on me: | |
| Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
| Version: | 5.1.41, 5.1.67, 5.5.29, 5.7.0 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | GROUP BY, round | ||
[9 Nov 2012 0:20]
Igor T.
[9 Nov 2012 11:16]
Valeriy Kravchuk
Please, check if the same problem still happens with a recent version, 5.1.65+. If it does, please, send the exact CREATE TABLE and INSERT statements used to reproduce this.
[9 Nov 2012 17:31]
Sveta Smirnova
Thank you for the report. Verified as described. Test case for MTR: create table tab(id int not null auto_increment primary key); insert into tab values(null); insert into tab select null from tab; insert into tab select null from tab; insert into tab select null from tab; insert into tab select null from tab; insert into tab select null from tab; insert into tab select null from tab; insert into tab select null from tab; insert into tab select null from tab; select x, count(1) from (select round(rand()-0.5,1) x from tab) t group by x;
[9 Nov 2012 18:29]
Igor T.
Here is a simpler example. create table x (x float); insert into x(x) values (-0.1), (0.1); mysql> select round(x), count(1) from x group by round(x); +----------+----------+ | round(x) | count(1) | +----------+----------+ | -0 | 1 | | 0 | 1 | +----------+----------+ 2 rows in set (0.00 sec)
[9 Jan 2017 18:55]
Hartmut Holzgraefe
Simple example that does not involve ROUND() MySQL [test]> create table x(x float); Query OK, 0 rows affected (0.01 sec) MySQL [test]> insert into x values (+0e0),(-0e0); Query OK, 2 rows affected (0.02 sec) Records: 2 Duplicates: 0 Warnings: 0 MySQL [test]> select x from x group by x; +------+ | x | +------+ | 0 | | -0 | +------+ 2 rows in set (0.00 sec)
[1 Oct 14:11]
Knut Anders Hatlen
This seems to have been fixed in MySQL 8.1.0, see bug#117845. Closing.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.055 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.