Bug #119977 NULL > ALL(subquery) produces NULL but IS NULL / IS UNKNOWN both return FALSE
| Submitted: | 3 Mar 13:44 | Modified: | 3 Mar 20:54 |
|---|---|---|---|
| Reporter: | Bosheng Peng | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
| Version: | 8.0.36 | OS: | Any (windows 11) |
| Assigned to: | CPU Architecture: | Any |
[3 Mar 20:54]
Roy Lyseng
Thank you for the bug report. Verified as described for release 8.0.45. But notice this is not reproducible for release 8.4 or 9.6.
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: When executing the following queries: ```sql SELECT (NULL > ALL (SELECT 0 FROM t0)) AS val, (NULL > ALL (SELECT 0 FROM t0)) IS NULL AS is_null; ``` MySQL produces the following result: ``` +-----+---------+ | val | is_null | +-----+---------+ | NULL | 0 | +-----+---------+ 1 row in set (0.00 sec) ``` I regard this as a wrong result because `null is null` should be a true statement, which is not the case of the above execution. On the contrary, when executing the following queries: ``` SELECT (NULL > ALL (SELECT 0)) AS val, (NULL > ALL (SELECT 0)) IS NULL AS is_null, ``` MySQL produces the following result: ``` +------+---------+ | val | is_null | +------+---------+ | NULL | 1 | +------+---------+ 1 row in set (0.00 sec) ``` I wonder if this is a bug. How to repeat: ```sql DROP TABLE IF EXISTS t0; CREATE TABLE t0 ( c INT ); INSERT INTO t0 VALUES (0), (0); SELECT COUNT(*) AS cnt FROM t0; SELECT (NULL > ALL (SELECT 0 FROM t0)) AS val, (NULL > ALL (SELECT 0 FROM t0)) IS NULL AS is_null; SELECT (NULL > ALL (SELECT 0)) AS val, (NULL > ALL (SELECT 0)) IS NULL AS is_null; ```