Bug #6794 Wrong outcome of update operation of ndb table
Submitted: 24 Nov 2004 9:39 Modified: 6 Dec 2004 14:22
Reporter: Martin Skold Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S2 (Serious)
Version:4.1 OS:
Assigned to: Martin Skold CPU Architecture:Any

[24 Nov 2004 9:39] Martin Skold
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.