WHERE returns a row for an IN predicate that evaluates to FALSE
Summary
Dolt returns a row from a WHERE ... IN (...) query even though the same IN expression evaluates to FALSE for that row when selected as a projected expression.
The issue reproduces with an INT column and a mixed integer/fractional numeric list. The table has no indexes.
Environment
- Dolt versions tested: 2.3.2 and 2.3.4
- OS: Windows x64
Steps to Reproduce
Run the following SQL in a Dolt database:
CREATE DATABASE dolt_in_fractional_repro;
USE dolt_in_fractional_repro;
CREATE TABLE t (v INT) ENGINE=InnoDB;
INSERT INTO t VALUES (0), (9);
SELECT v, v IN (9, 0.49) AS in_result
FROM t
ORDER BY v;
SELECT v
FROM t
WHERE v IN (9, 0.49)
ORDER BY v;Expected Result
The first query returns:
| v | in_result |
|---|---|
| 0 | 0 |
| 9 | 1 |
Since the predicate is false for v = 0, the second query should return only: v 9
Actual Result
On Dolt 2.3.2 and 2.3.4, the first query returns the expected projected predicate values, but the second query returns both rows: v 0 9 Thus, WHERE v IN (9, 0.49) includes v = 0, even though the same predicate evaluates to FALSE for that row in the projection.
Additionally,the same reproducer returns only 9 on MySQL 8.0.46, MySQL 8.4.7, and MariaDB 12.3.2.
Source: dolthub/dolt