Bug #7068 Update with AND does not produce error
Submitted: 7 Dec 2004 10:56 Modified: 7 Dec 2004 11:35
Reporter: Lars Thalmann Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.8 (from source) OS:
Assigned to: CPU Architecture:Any

[7 Dec 2004 10:56] Lars Thalmann
Description:
The 'and' is not legal syntax, but system does not complain
(no warning or error message):

How to repeat:
mysql> create table t1 (i int);
Query OK, 0 rows affected (0.00 sec)

mysql> create table t2 (i int);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into t1 values (1);
Query OK, 1 row affected (0.01 sec)

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

mysql> update t1,t2 set t1.i=2 and t2.i=2 where t1.i=t2.i;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from t1;         
+------+
| i    |
+------+
|    0 |
+------+
1 row in set (0.00 sec)

mysql> select * from t2;
+------+
| i    |
+------+
|    1 |
+------+
1 row in set (0.00 sec)
[7 Dec 2004 11:35] Hartmut Holzgraefe
It is evaluated as 

  update t1, t2 set t1.i = (2 and t2.i=2) where t1.i=t2.i;

which is perfectly ok IMHO