Bug #75896 Undesired boolean coercion: WHERE id = 1 OR 2
| Submitted: | 13 Feb 2015 15:12 | Modified: | 13 May 2015 9:38 |
|---|---|---|---|
| Reporter: | Morgan Tocker | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Optimizer | Severity: | S4 (Feature request) |
| Version: | 5.7.6, 5.7.8, 8.0 | OS: | Any |
| Assigned to: | CPU Architecture: | Any |
[13 Feb 2015 15:12]
Morgan Tocker
[13 May 2015 9:37]
MySQL Verification Team
Hello Morgan, Thank you for report. Thanks, Umesh
[7 Oct 2015 19:49]
Simon Mudd
Note: I think the where clause here is where (id = 1) or 2 as = has higher precedence over 'or' (see: https://dev.mysql.com/doc/refman/5.7/en/operator-precedence.html) and ideally the 2 should not match as a boolean comparison so maybe should fail. Some implicit type conversions just cause trouble. MySQL is famous for this and usually it works but when it doesn't you may not notice and you may not get the results you expect.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.040 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.