Bug #61591 | Update statement using AND in place of comma causes no warnings or errors | ||
---|---|---|---|
Submitted: | 21 Jun 2011 18:20 | Modified: | 21 Jun 2011 18:36 |
Reporter: | Benjamin Bearman | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: General | Severity: | S2 (Serious) |
Version: | 5.1.46 | OS: | Solaris (SunOS 5.10) |
Assigned to: | CPU Architecture: | Any | |
Tags: | and, comma, no error, no warning, UPDATE |
[21 Jun 2011 18:20]
Benjamin Bearman
[21 Jun 2011 18:21]
Benjamin Bearman
Whoops, test_table3 needs to be test_table or vice versa.
[21 Jun 2011 18:36]
Valeriy Kravchuk
This is not a bug. Your statement is interpreted as: update test_table3 set pk_1 = ('L0000003' AND pk_2 = 'L00000004') where pk_1='L0000001' and pk_2 = 'L0000002'; then strings are converted to numbers for AND operation, both end up as 0 (because they start with letter L), and (0 AND 0) gives 0 as a result, then is converted back to string, '0'. All these steps are documented. Hint: execute SHOW WARNINGS\G next time when you'll see that statement generated warnings. This will help to find out what was wrong with the statement executed.