Bug #120098 Incorrect result when using EXISTS with INTERSECT ALL and correlated subquery
| Submitted: | 18 Mar 9:58 | Modified: | 18 Mar 10:58 |
|---|---|---|---|
| Reporter: | Guo Yuxiao | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Optimizer | Severity: | S1 (Critical) |
| Version: | 8.0.45 | OS: | Any |
| Assigned to: | CPU Architecture: | Any |
[18 Mar 10:58]
Roy Lyseng
Thank you for the bug report. Verified as described.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.038 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: I found a logic bug in MySQL 9.6.0. When using INTERSECT ALL in EXCEPT, NULL values will be erroneously included in the execution result. How to repeat: -- create table DROP TABLE IF EXISTS t2; CREATE TABLE t2 (c0 VARCHAR(10)); INSERT INTO t2 VALUES (''), (NULL); -- query, expect:{''}, actual:{'', NULL} SELECT t2.c0 FROM t2 WHERE EXISTS ( SELECT 1 FROM t2 AS t4 WHERE t2.c0 IS NOT NULL INTERSECT ALL SELECT 1 FROM t2 AS t4 WHERE t2.c0 IS NOT NULL );