Description:
Updates with a set of a field using other fields in the same
row give the wrong values. Most likely it is because the read
preceeding has not set the query_id for the fields in the value
part of the expression.
How to repeat:
mysql> create table t1(x int primary key, y int, z int);
Query OK, 0 rows affected (0.73 sec)
mysql> insert into t1 values(1,1,1),(2,2,2);
Query OK, 2 rows affected (0.04 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> select * from t1;
+---+------+------+
| x | y | z |
+---+------+------+
| 1 | 1 | 1 |
| 2 | 2 | 2 |
+---+------+------+
2 rows in set (0.05 sec)
mysql> update t1 set z = y+1;
Query OK, 2 rows affected (0.01 sec)
Rows matched: 2 Changed: 2 Warnings: 0
mysql> select * from t1;
+---+------+------+
| x | y | z |
+---+------+------+
| 1 | 1 | 3 |
| 2 | 2 | 3 |
+---+------+------+
2 rows in set (0.01 sec)
Suggested fix:
Make sure the proper query_id is set for the fileds to be read.