Bug #37516 DELETE using UNIQUE index deletes the wrong row
Submitted: 19 Jun 2008 7:55 Modified: 2 Jul 2008 17:36
Reporter: Axel Schwenke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S1 (Critical)
Version:5.1.24-6.3.15 OS:Any
Assigned to: Frazer Clement CPU Architecture:Any

[19 Jun 2008 7:55] Axel Schwenke
Description:
Delete using a UNIQUE index to filter the WHERE condition matches the wrong row. It seems always to be the last row. Does not happen when the index is PRIMARY or non-unique.

How to repeat:
drop table if exists t1;
create table t1 (c1 varchar(36), c2 int, unique(c1)) engine ndbcluster;
insert into t1 values ('aaa',1), ('bbb',2), ('ccc',3), ('ddd',4);
select * from t1;
delete from t1 where c1='aaa';
select * from t1;
delete from t1 where c1='aaa';
select * from t1;
delete from t1 where c1='aaa';
select * from t1;
[26 Jun 2008 7:12] Jonas Oreland
ok to push
[26 Jun 2008 9:35] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/48556
[26 Jun 2008 11:08] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/48561
[2 Jul 2008 17:36] Jon Stephens
Documented in the NDB 6.3.16 changelog as follows:

        DELETE ... WHERE unique_index_column=value deleted the wrong row from the 
        table.