diff --git a/mysql-test/r/ndb_update.result b/mysql-test/r/ndb_update.result index 7603686ea35..1efc41c4ea4 100644 --- a/mysql-test/r/ndb_update.result +++ b/mysql-test/r/ndb_update.result @@ -18,7 +18,7 @@ pk1 b c 2 2 2 4 1 1 UPDATE t1 set pk1 = 4 where pk1 = 2; -ERROR 23000: Duplicate entry '4' for key 1 +ERROR 23000: Duplicate entry '4' for key 'PRIMARY' UPDATE IGNORE t1 set pk1 = 4 where pk1 = 2; select * from t1 order by pk1; pk1 b c diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index cd2e8c28f52..558837c5b73 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -3835,6 +3835,15 @@ int ha_ndbcluster::extra(enum ha_extra_function operation) DBUG_PRINT("info", ("HA_EXTRA_IGNORE_DUP_KEY")); DBUG_PRINT("info", ("Ignoring duplicate key")); m_ignore_dup_key= TRUE; + if (table_share->primary_key != MAX_KEY) + { + /* + Table has a primary key + We need to read all fields for UPDATE IGNORE of pk + since this is implemented as delete+insert + */ + bitmap_set_all(table->read_set); + } break; case HA_EXTRA_NO_IGNORE_DUP_KEY: DBUG_PRINT("info", ("HA_EXTRA_NO_IGNORE_DUP_KEY"));