Bug #119958 EXISTS subquery result behaves inconsistently based on source table
| Submitted: | 28 Feb 13:09 | Modified: | 2 Mar 13:02 |
|---|---|---|---|
| Reporter: | Seren Zhou | 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 |
[2 Mar 13:02]
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.048 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 an `EXISTS` subquery is used in comparison with `ALL`/`ANY` quantifiers, the result differs based on the source table in the EXISTS subquery, even though `EXISTS` should always return a boolean value (TRUE/FALSE or 1/0) How to repeat: CREATE TABLE t63 (c1 DOUBLE, c2 BIT(14)); CREATE TABLE t64 (c1 MEDIUMTEXT NOT NULL); INSERT INTO t63 VALUES (1.0, b'111'); INSERT INTO t64 (c1) VALUES ('4r4d'); INSERT INTO t64 (c1) VALUES ('poe_test'); mysql> SELECT ((EXISTS (SELECT c1 FROM t63)) >= ALL (SELECT c1 FROM t64)) AS result; +--------+ | result | +--------+ | 0 | +--------+ 1 row in set (0.001 sec) mysql> SELECT ((EXISTS (SELECT c1 FROM t64)) >= ALL (SELECT c1 FROM t64)) AS result; +--------+ | result | +--------+ | 1 | +--------+ 1 row in set (0.001 sec)