Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
-
12.3.2
-
None
-
 Windows 11 64-bit
Database Server: MariaDB 12.3.2-MariaDB
-
Not for Release Notes
-
An optimizer bug could incorrectly filter rows when a constant predicate containing nested NOT and IN operators is used in a WHERE clause.
Description
-
-
- Description
-
MariaDB evaluates the following predicate as TRUE when it is selected directly, but treats the same predicate as FALSE when it is used in a WHERE clause.
-
-
- Reproduction
-
```sql
SELECT NOT (NOT ((NOT (NOT (0.9632180211473692))) IN (1))) AS value;
SELECT NOT (NOT ((NOT (NOT (0.9632180211473692))) IN (1))) AS value
FROM DUAL
WHERE NOT (NOT ((NOT (NOT (0.9632180211473692))) IN (1)));
-
-
- Expected result
Both statements should return one row:
-------value -------
1 -------
- Expected result
-
The expression is constant and evaluates to TRUE, so using it in the WHERE clause should not remove the row.
-
-
- Actual result
On MariaDB 12.3.2:
The first statement returns:
-------value -------
1 -------
- Actual result
-
The second statement returns an empty result set: Empty set
The same two statements return one row with value 1 on MySQL 8.0.46 and MySQL 8.4.7
Attachments
Issue Links
- duplicates
-
MDEV-36440 Double negation is treated as original value in WHERE clause
-
- Confirmed
-