Bug #8554 Wrong result with update
Submitted: 16 Feb 2005 18:24 Modified: 16 Feb 2005 18:58
Reporter: Antti Pirilä Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1.8a (Debian) OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[16 Feb 2005 18:24] Antti Pirilä
Description:
Update with incorrect SQL-syntax is accepted but the result is nonsense. See "How to repeat" part.

How to repeat:
mysql> create table a(a char(1), b char(1));
Query OK, 0 rows affected (0.01 sec)

mysql> insert into a values('a', 'a');
Query OK, 1 row affected (0.00 sec)

mysql> insert into a values('a', 'b');
Query OK, 1 row affected (0.00 sec)

mysql> update a set a = 'c' and b='a';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> select * from a;
+------+------+
| a    | b    |
+------+------+
| 0    | a    |
| 0    | b    |
+------+------+
2 rows in set (0.00 sec)

Suggested fix:
Discard incorrect SQL statement and create an error.
[16 Feb 2005 18:37] Martin Friebe
explained in #8466