Bug #100223 | unexpected returned result of & operation | ||
---|---|---|---|
Submitted: | 15 Jul 2020 7:12 | Modified: | 15 Jul 2020 13:12 |
Reporter: | ick R | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 8.0.21 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[15 Jul 2020 7:12]
ick R
[15 Jul 2020 7:38]
ick R
Another case: select CONV(-2456,10,2) & 1; --1 select CONV(2456,10,2) & 1; --0
[15 Jul 2020 8:11]
ick R
sorry,it should be : select bin(-24656); select bin(-24656) & bin(1); select bin(24656); select bin(24656) & bin(1); in HOW TO REPEAT
[15 Jul 2020 13:12]
MySQL Verification Team
Hi Mr. R, Thank you for your bug report. However, this is not a bug, but a support question. In short, the operator '&' works as a binary one and not as a logical one. Also, please read the following comment.
[15 Jul 2020 13:12]
MySQL Verification Team
We're sorry, but the bug system is not the appropriate forum for asking help on using MySQL products. Your problem is not the result of a bug. For details on getting support for MySQL products see http://www.mysql.com/support/ You can also check our forums (free) at http://forums.mysql.com/ Thank you for your interest in MySQL.
[15 Jul 2020 13:25]
Yushan ZHANG
I think the bug is related to the `&` result: select CONV(-2456,10,2); -- incorrect 5.7.31 & 8.0.21 select CONV(-2456,10,2) & 1; select (-2456) & 1; It is a bitwise operation, then the second query should give the same result as the last one, however, it returns 1.
[15 Jul 2020 13:27]
Yushan ZHANG
Forgot to append the result to the queries: -- incorrect mysql> select CONV(-2456,10,2) & 1; +----------------------+ | CONV(-2456,10,2) & 1 | +----------------------+ | 1 | +----------------------+ 1 row in set (0.00 sec) mysql> select (-2456) & 1; +-------------+ | (-2456) & 1 | +-------------+ | 0 | +-------------+ 1 row in set (0.00 sec)