diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index ba56b3071cd6061935bbe2acd6f36b96cc377e29..0ca1a7516e097b58d3f83e4e437a48230baa6fc7 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -6,7 +6,7 @@ Contains also create table and other data dictionary operations. Created 9/17/2000 Heikki Tuuri *******************************************************/ - + #include "row0mysql.h" #ifdef UNIV_NONINL diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 2fcde863b9c22b47619830ee3e8b4393cfb55022..320047b68facad637f3def61b1e5c48018d6fcc7 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -758,3 +758,14 @@ SELECT * FROM t3 WHERE id1="my-test-1" LOCK IN SHARE MODE; COMMIT; set autocommit=1; DROP TABLE t1,t2,t3; + +# +# Check update with conflicting key +# + +CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) type=innodb; +INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +# We need the a < 1000 test here to quard against the halloween problems +UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000; +SELECT * from t1; +drop table t1; diff --git a/sql/key.cc b/sql/key.cc index d103c07eb7242de2c2f42fb73574627be55fb882..8520dee215ebd0f94d5a61177e1cca1b2426c375 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -269,5 +269,13 @@ bool check_if_key_used(TABLE *table, uint idx, List<Item> &fields) return 1; } } + + /* + If table handler has primary key as part of the index, check that primary + key is not updated + */ + if (idx != table->primary_key && table->primary_key < MAX_KEY && + (table->file->option_flag() & HA_PRIMARY_KEY_IN_READ_INDEX)) + return check_if_key_used(table, table->primary_key, fields); return 0; } diff --git a/strings/strto.c b/strings/strto.c index c98b19a7e67d50f12decff1929c390d581013338..bd0c8e38fdea93108da176ae262932ffa05c2a48 100644 --- a/strings/strto.c +++ b/strings/strto.c @@ -35,6 +35,8 @@ it can be compiled with the UNSIGNED and/or LONGLONG flag set */ +#define strtoll glob_strtoll /* Fix for True64 */ + #include <my_global.h> #include "m_string.h" #include "m_ctype.h"