Details
-
Bug
-
Status: In Review (View Workflow)
-
Critical
-
Resolution: Unresolved
-
10.11
-
Unexpected results
-
Q4/2026 Server Development
Description
When querying an indexed integer column with a decimal constant, MariaDB returns rows matching the rounded value. When the index is not used it behaves as expected.
CREATE TABLE t1 (i INT, KEY(i)); |
INSERT INTO t1 VALUES (46),(47),(48); |
|
|
-- Wrong: returns 47 (expected: empty result)
|
SELECT i FROM t1 WHERE i = 46.5; |
|
|
-- Correct without the index: empty result
|
SELECT i FROM t1 IGNORE INDEX(i) WHERE i = 46.5; |
|
|
-- Shows ref access without "Using where", so the condition is never checked
|
EXPLAIN SELECT i FROM t1 WHERE i = 46.5; |
|
|
DROP TABLE t1; |
Affected types:
- TINYINT, SMALLINT, MEDIUMINT, INT, BIGINT
- DECIMAL (dec(5,1) = 1.25)
- DATETIME and TIME with fractional-second constants
Attachments
Issue Links
- is duplicated by
-
MDEV-41921 Forced index lookups on TINYINT, SMALLINT and MEDIUMINT match 1 against DOUBLE 0.6e0
-
- Closed
-