Bug #118967 Bug Report: DECIMAL(22,2) Column Comparison with >= -0.001 Excludes 0.00 Row
Submitted: 9 Sep 8:28 Modified: 9 Sep 11:58
Reporter: fan alan Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:8.4.4 OS:Any
Assigned to: MySQL Verification Team CPU Architecture:Any

[9 Sep 8:28] fan alan
Description:
When running a WHERE a >= -0.001 filter on a DECIMAL(22,2) column, rows with the exact value 0.00 are not returned

Moreover, this query works correctly on MySQL 5.7, and no other database systems exhibit this issue. It only fails on MySQL 8.0 and later versions.

How to repeat:
1.Create a test table and insert sample data:

DROP TABLE IF EXISTS bug_decimal;
CREATE TABLE bug_decimal (
  a DECIMAL(22,2) NOT NULL
);
INSERT INTO bug_decimal VALUES (0.00), (1.23), (-0.01), (-0.10);

2.Run the following query:

SELECT * 
FROM bug_decimal 
WHERE a >= -0.001;

3.The query returns:

+-------+
| a     |
+-------+
|  1.23 |
+-------+

Rows with a = 0.00 are not returned.
[9 Sep 11:58] MySQL Verification Team
Duplicate of Bug#118941