Bug #82562 exists (select max(id) from t3 where id=2) produced the undesired result
| Submitted: | 12 Aug 2016 5:12 | Modified: | 12 Aug 2016 7:52 |
|---|---|---|---|
| Reporter: | chen chen (OCA) | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
| Version: | 5.6.31,5.7.14 | OS: | Any |
| Assigned to: | CPU Architecture: | Any |
[12 Aug 2016 5:12]
chen chen
[12 Aug 2016 7:52]
MySQL Verification Team
Hello Chen, Thank you for the report and test case. Imho it is expected behavior because MAX()/MIN() returns NULL if there were no matching rows. -- 4.1,5.0, 5.1, 5.5, 5.6 and 5.7 mysql> select 1 from dual where exists (select max(id) from t3 where id=2); +---+ | 1 | +---+ | 1 | +---+ 1 row in set (0.00 sec) mysql> select max(id) from t3 where id=2; +---------+ | max(id) | +---------+ | NULL | +---------+ 1 row in set (0.00 sec) mysql> select 1 from dual where exists (SELECT NULL); +---+ | 1 | +---+ | 1 | +---+ 1 row in set (0.00 sec) Thanks, Umesh
[12 Aug 2016 7:56]
MySQL Verification Team
See, Bug #5365
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.036 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.