Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
-
12.2.2
-
None
-
Not for Release Notes
Description
A double negation around an ANY subquery comparison changes the result of the expression.
The following two expressions should be logically equivalent:
5 <> ANY(SELECT 6) |
and:
NOT (NOT (5 <> ANY(SELECT 6))) |
However, MariaDB returns different results. The original expression returns 1, but the double-negated expression returns 0.
This violates the expected boolean identity NOT (NOT P) = P.
How to repeat
SELECT
|
5 <> ANY(SELECT 6) AS orig, |
NOT (NOT (5 <> ANY(SELECT 6))) AS double_negated; |
|
|
SELECT
|
5 < ANY(SELECT 6) AS orig, |
NOT (NOT (5 < ANY(SELECT 6))) AS double_negated; |
Observed result
orig double_negated
|
1 0 |
|
|
orig double_negated
|
1 0 |
Expected result
orig double_negated
|
1 1 |
|
|
orig double_negated
|
1 1 |
Attachments
Issue Links
- duplicates
-
MDEV-35435 Inconsistent behavior with NOT and ANY in WHERE Clause
-
- Confirmed
-