Bug #119973 Inconsistent results depending on whether the column has a PRIMARY KEY index
Submitted: 2 Mar 21:01 Modified: 3 Mar 8:44
Reporter: Seren Zhou Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S1 (Critical)
Version:8.0.45 OS:Any
Assigned to: CPU Architecture:Any

[2 Mar 21:01] Seren Zhou
Description:
MySQL returns inconsistent results depending on whether the column has a PRIMARY KEY index. 

How to repeat:
CREATE TABLE t191 (c1 VARCHAR(20) NULL, c2 BIT);
INSERT INTO t191 (c1, c2) VALUES ('44', b'0'), ('OVMHN45', b'1');

SELECT (BINARY 1) IN (SELECT c2 FROM t191) AS result;
+--------+
| result |
+--------+
|      1 |
+--------+

ALTER TABLE t191 ADD PRIMARY KEY (c2);
SELECT (BINARY 1) IN (SELECT c2 FROM t191) AS result;
+--------+
| result |
+--------+
|      0 |
+--------+
[3 Mar 8:44] Roy Lyseng
Thank you for the test case.
Verified as described.