Commit 638c294b authored by mskold/marty@mysql.com/linux.site's avatar mskold/marty@mysql.com/linux.site

Merge mysql.com:/windows/Linux_space/MySQL/mysql-5.0

into  mysql.com:/windows/Linux_space/MySQL/mysql-5.0-ndb
parents 1d041fa5 af324d9c
...@@ -17,8 +17,17 @@ pk1 b c ...@@ -17,8 +17,17 @@ pk1 b c
0 0 0 0 0 0
2 2 2 2 2 2
4 1 1 4 1 1
UPDATE t1 set pk1 = 4 where pk1 = 2;
ERROR 23000: Duplicate entry '4' for key 1
UPDATE IGNORE t1 set pk1 = 4 where pk1 = 2;
select * from t1 order by pk1;
pk1 b c
0 0 0
2 2 2
4 1 1
UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4; UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4;
ERROR 23000: Duplicate entry '' for key 0 ERROR 23000: Duplicate entry '' for key 0
UPDATE IGNORE t1 set pk1 = 1, c = 2 where pk1 = 4;
select * from t1 order by pk1; select * from t1 order by pk1;
pk1 b c pk1 b c
0 0 0 0 0 0
......
...@@ -23,8 +23,13 @@ UPDATE t1 set b = c; ...@@ -23,8 +23,13 @@ UPDATE t1 set b = c;
select * from t1 order by pk1; select * from t1 order by pk1;
UPDATE t1 set pk1 = 4 where pk1 = 1; UPDATE t1 set pk1 = 4 where pk1 = 1;
select * from t1 order by pk1; select * from t1 order by pk1;
--error 1062
UPDATE t1 set pk1 = 4 where pk1 = 2;
UPDATE IGNORE t1 set pk1 = 4 where pk1 = 2;
select * from t1 order by pk1;
-- error 1062 -- error 1062
UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4; UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4;
UPDATE IGNORE t1 set pk1 = 1, c = 2 where pk1 = 4;
select * from t1 order by pk1; select * from t1 order by pk1;
UPDATE t1 set pk1 = pk1 + 10; UPDATE t1 set pk1 = pk1 + 10;
select * from t1 order by pk1; select * from t1 order by pk1;
......
...@@ -2387,6 +2387,21 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data) ...@@ -2387,6 +2387,21 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
uint i; uint i;
DBUG_ENTER("update_row"); DBUG_ENTER("update_row");
/*
* If IGNORE the ignore constraint violations on primary and unique keys
*/
if (m_ignore_dup_key)
{
int peek_res= peek_indexed_rows(new_data);
if (!peek_res)
{
DBUG_RETURN(HA_ERR_FOUND_DUPP_KEY);
}
if (peek_res != HA_ERR_KEY_NOT_FOUND)
DBUG_RETURN(peek_res);
}
statistic_increment(thd->status_var.ha_update_count, &LOCK_status); statistic_increment(thd->status_var.ha_update_count, &LOCK_status);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE) if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment