| Bug #120510 | A false DECIMAL equality wrongly returns a row in the original path | ||
|---|---|---|---|
| Submitted: | 21 May 7:22 | Modified: | 21 May 11:50 |
| Reporter: | y x | Email Updates: | |
| Status: | Can't repeat | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 9.6.0 | OS: | Ubuntu |
| Assigned to: | CPU Architecture: | x86 | |
[21 May 8:05]
Roy Lyseng
Thank you for the bug report. However, on both our supported versions, 8.4 and 9.7, I get the expected result, an empty result set.
[21 May 11:50]
y x
Thank you for checking. On my local instance, `SELECT VERSION()` returns `9.6.0`. If this no longer reproduces on 8.4 and 9.7, then it may already be fixed there. Could you please confirm whether this was fixed between 9.6 and 9.7?

Description: `t1.c0` and `t2.c0` are scale-0 `DECIMAL` columns, so inserting the two non-integer literals stores both as `0`; the final filter `t2.c0 = 0.019732417266349445` should therefore be false, but in the original path MySQL incorrectly treats it as true after combining it with the other always-true DECIMAL predicates. How to repeat: CREATE TABLE t1(c0 DECIMAL); CREATE TABLE t2(c0 DECIMAL); INSERT INTO t1 VALUES(0.167019786236149); INSERT INTO t2 VALUES(0.12736447690010488); SELECT t2.c0 AS ref0 FROM t1 INNER JOIN t2 ON ((t1.c0) = (t2.c0)) && ((((((((t2.c0) IS NOT NULL) AND ((t2.c0) > (IFNULL((+ (4.47373999E8)), 1861378397)))) || ((t2.c0) NOT IN ((+ (0.14355415844276698))))) OR ((t2.c0) NOT IN ((+ (t2.c0))))) && ((IFNULL(t2.c0, IFNULL(t2.c0, t2.c0))) IN (-1234616201, -496856630, t2.c0, t2.c0, (+ (-296021719))))) OR ((t2.c0) IN (t2.c0))) AND ((t2.c0) BETWEEN ((+ (t2.c0))) AND (t2.c0))) WHERE ((t1.c0) LIKE (t2.c0)) AND ((t2.c0) = (0.019732417266349445)); -- Expected correct result: <empty> -- actual Wrong result: 0