Bug #58743 | UPDATE statement is accepted but produces wrong results when AND is used in SET | ||
---|---|---|---|
Submitted: | 5 Dec 2010 17:36 | Modified: | 5 Dec 2010 19:50 |
Reporter: | Nikos Sarkas | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
Version: | 5.1.45 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[5 Dec 2010 17:36]
Nikos Sarkas
[5 Dec 2010 17:38]
Nikos Sarkas
Provided a more informative synopsos
[5 Dec 2010 19:11]
Peter Laursen
Obviously it is interpreted like update test set b=(2 and c=2) where a=1; .. and since (2 and c=2) is not valid it truncates to ZERO. Peter (not a MySQL person)
[5 Dec 2010 19:15]
Peter Laursen
I think there should at least be a warning. DROP TABLE IF EXISTS test; CREATE TABLE test(a INT,b INT, c INT); INSERT INTO test VALUES(1,1,1); SELECT * FROM test; UPDATE test SET b=2 AND c=2 WHERE a=1; SHOW WARNINGS; -- empty result set. I'd expect "data truncated for column 'b'"
[5 Dec 2010 19:50]
MySQL Verification Team
not a bug. nothing is truncated either hence no warnings to be returned. (c=2) == 0 (2 and 0) == 0 0 is a perfectly valid int.
[5 Dec 2010 19:50]
Peter Laursen
.. and besides I was not able to find an SQL_MODE where an error is returned (I expected that with 'traditional' mode it would - but it doesn't)