diff --git a/mysql-test/main/long_unique_bugs.result b/mysql-test/main/long_unique_bugs.result index b1c881b0809..2b9ec4731de 100644 --- a/mysql-test/main/long_unique_bugs.result +++ b/mysql-test/main/long_unique_bugs.result @@ -337,3 +337,7 @@ a b 1 foo 3 bar drop table if exists t1, t2; +create table t1 (a int, b int, unique (b) using hash) engine=innodb partition by key (a) partitions 2; +insert into t1 values (1,10),(2,20); +update t1 set b = 30 limit 1; +drop table t1; diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test index 856a944d9d5..5c6763a5f15 100644 --- a/mysql-test/main/long_unique_bugs.test +++ b/mysql-test/main/long_unique_bugs.test @@ -402,3 +402,11 @@ create or replace table t2 (a int, b blob, unique(b)) replace as select * from t select * from t2; drop table if exists t1, t2; + +# +# MDEV-22185 Failing assertion: node->pcur->rel_pos == BTR_PCUR_ON or ER_KEY_NOT_FOUND or Assertion `inited==NONE' failed in handler::ha_index_init +# +create table t1 (a int, b int, unique (b) using hash) engine=innodb partition by key (a) partitions 2; +insert into t1 values (1,10),(2,20); +update t1 set b = 30 limit 1; +drop table t1; diff --git a/sql/handler.cc b/sql/handler.cc index 3633f4aa961..3eb29a1f9fe 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -7009,7 +7009,7 @@ int handler::ha_update_row(const uchar *old_data, const uchar *new_data) MYSQL_UPDATE_ROW_START(table_share->db.str, table_share->table_name.str); mark_trx_read_write(); increment_statistics(&SSV::ha_update_count); - if (table->s->long_unique_table && + if (table->s->long_unique_table && this == table->file && (error= check_duplicate_long_entries_update(new_data))) { return error;