Bug #20728 REPLACE does not work correctly for NDB table with PK and unique index
Submitted: 27 Jun 2006 17:58 Modified: 14 Jul 2006 4:21
Reporter: Dmitry Lenev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:5.0.23-bk OS:Any (ALL)
Assigned to: Dmitry Lenev CPU Architecture:Any

[27 Jun 2006 17:58] Dmitry Lenev
Description:
REPLACE statement does not work correctly for NDB table which has both primary key and unique key defined. Such statement doesn't set proper values for columns which aren't explicitly mentioned in statement when replace happens.

See How to repeat section for more information.

How to repeat:
create table t1 (pk int primary key, apk int unique, data int) engine=ndbcluster;
insert into t1 values (1, 1, 1), (2, 2, 2), (3, 3, 3);
replace into t1 (pk, apk) values (4, 1), (5, 2);
# With myisam we get NULL values in data column for last two rows
select * from t1 order by pk;
# pk    apk     data
# 3     3       3
# 4     1       1
# 5     2       2
drop table t1;
[30 Jun 2006 13:30] 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/8557
[1 Jul 2006 21:25] 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/8598
[7 Jul 2006 20:34] Konstantin Osipov
Pushed into 5.0-runtime.
[13 Jul 2006 16:09] Konstantin Osipov
Pushed into 5.0.25 and 5.1.12
[14 Jul 2006 4:21] Jon Stephens
Documented bugfix in 5.0.25 and 5.1.12 changelogs.