Bug #44174 update syntax Bug
Submitted: 9 Apr 2009 2:51 Modified: 10 Apr 2009 3:29
Reporter: Yao roman Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.1.30 OS:Linux
Assigned to: CPU Architecture:Any
Tags: update syntax Bug

[9 Apr 2009 2:51] Yao roman
Description:
Ver:5.1.31
Engine:InnoDB

oot:DbStatus>  select * from xjc where f_ip='10.10.3.65' and f_type='cpu_use' and f_report_date='2009-01-11 19:15:00'
    -> ;
+---------+------------+--------+--------------+--------+---------+----------+-----------+---------------------+
| f_host  | f_ip       | f_port | f_class      | f_desc | f_type  | f_values | f_content | f_report_date       |
+---------+------------+--------+--------------+--------+---------+----------+-----------+---------------------+
| park-s1 | 10.10.3.65 |      0 | myclass      |        | cpu_use |     0.00 |           | 2009-01-11 19:15:00 | 
+---------+------------+--------+--------------+--------+---------+----------+-----------+---------------------+
1 row in set (0.00 sec)

root:DbStatus> update xjc set f_host='aa' and f_class='bb' where f_ip='10.10.3.65' and f_type='cpu_use' and f_report_date='2009-01-11 19:15:00';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

root:DbStatus> show warnings;
+---------+------+----------------------------------------+
| Level   | Code | Message                                |
+---------+------+----------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: 'aa' | 
+---------+------+----------------------------------------+
1 row in set (0.00 sec)

root:DbStatus> select * from xjc where f_ip='10.10.3.65' and f_type='cpu_use' and f_report_date='2009-01-11 19:15:00';
+--------+------------+--------+--------------+--------+---------+----------+-----------+---------------------+
| f_host | f_ip       | f_port | f_class      | f_desc | f_type  | f_values | f_content | f_report_date       |
+--------+------------+--------+--------------+--------+---------+----------+-----------+---------------------+
| 0      | 10.10.3.65 |      0 | myclass     |        | cpu_use |     0.00 |           | 2009-01-11 19:15:00 | 
+--------+------------+--------+--------------+--------+---------+----------+-----------+---------------------+
1 row in set (0.00 sec)

When you use "update table_name set col1=new_value1 and col2 = new_value2 where conditions",It does not prompt syntax error but to execute this  statement ,so you'll get a wrong value that is not your expectancy;

How to repeat:
Just use "update table_name set col1=new_value1 and col2 = new_value2 where conditions"
[9 Apr 2009 2:57] MySQL Verification Team
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php
[10 Apr 2009 3:29] Yao roman
Why it's not a bug?
This is a syntax error ,it should prompt a error ,and should not execute successfully!
[10 Apr 2009 3:47] talen xu
I think this is a serious problem!
If this is not a syntax error,why column f_host as varchar is updated 0?