Bug #5653 'WHERE"-statement fails on certain values
| Submitted: | 19 Sep 2004 15:37 | Modified: | 7 Oct 2004 3:13 |
|---|---|---|---|
| Reporter: | Jan Schroeder | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server | Severity: | S1 (Critical) |
| Version: | 4.1.x | OS: | Any (All) |
| Assigned to: | Lachlan Mulcahy | CPU Architecture: | Any |
[19 Sep 2004 15:37]
Jan Schroeder
[19 Sep 2004 16:20]
Jan Schroeder
MySQL 4.0.21 is not affected. Thus, backporting to this release will help.
[7 Oct 2004 2:18]
Lachlan Mulcahy
I have confirmed this bug on current dev tree on MacOSX and appended the mysql-tests as follows to demonstrate in my own private tree. I will leave it to the developer to add these when the fix is done: -- mysql-test/t/type_decimal.test -- # Bug 5653 - Some decimals are not matched correctly by WHEREs CREATE TABLE t1 (val1 double(10,2) NOT NULL default '0.00') ENGINE=MyISAM; INSERT INTO t1 VALUES (571.23); INSERT INTO t1 VALUES (578.84); SELECT * FROM t1 WHERE val1=571.23; SELECT * FROM t1 WHERE val1=578.84; DROP TABLE t1; -- r/type_decimal.result -- CREATE TABLE t1 (val1 double(10,2) NOT NULL default '0.00') ENGINE=MyISAM; INSERT INTO t1 VALUES (571.23); INSERT INTO t1 VALUES (578.84); SELECT * FROM t1 WHERE val1=571.23; val1 571.23 SELECT * FROM t1 WHERE val1=578.84; val1 578.84 DROP TABLE t1;
[7 Oct 2004 3:04]
Lachlan Mulcahy
This is actually an inherent problem with floating point math, rather than a bug in MySQL. For these kinds of fields you should use DECIMAL type for accuracy. You can read more here: http://dev.mysql.com/doc/mysql/en/Problems_with_float.html
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.053 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.