diff --git a/mysql-test/suite/period/r/overlaps.result b/mysql-test/suite/period/r/overlaps.result index d7eb1a92b2b..efbbe7cf15b 100644 --- a/mysql-test/suite/period/r/overlaps.result +++ b/mysql-test/suite/period/r/overlaps.result @@ -344,4 +344,10 @@ insert into t1 values ('2024-12-21','2034-06-29',0), ('2024-12-21','2034-06-29',1); update t1 set b = 1; ERROR 23000: Duplicate entry '\x01-2034-06-29-2024-12-21' for key 'b' +# MDEV-22677 Server crashes in ha_partition::open upon update on +# partitioned HEAP table with WITHOUT OVERLAPS +create or replace table t (id int, s date, e date, period for p(s,e), +primary key(id, p without overlaps) +) engine=heap partition by hash(id); +update t set id = 1; drop table t, t1; diff --git a/mysql-test/suite/period/t/overlaps.test b/mysql-test/suite/period/t/overlaps.test index adf004ad405..6cd78769d4a 100644 --- a/mysql-test/suite/period/t/overlaps.test +++ b/mysql-test/suite/period/t/overlaps.test @@ -335,4 +335,12 @@ insert into t1 values ('2024-12-21','2034-06-29',0), update t1 set b = 1; +--echo # MDEV-22677 Server crashes in ha_partition::open upon update on +--echo # partitioned HEAP table with WITHOUT OVERLAPS + +create or replace table t (id int, s date, e date, period for p(s,e), + primary key(id, p without overlaps) + ) engine=heap partition by hash(id); +update t set id = 1; + drop table t, t1; diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index f8c2e72ba4a..96f4f4dc53a 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -153,7 +153,7 @@ int ha_heap::close(void) handler *ha_heap::clone(const char *name, MEM_ROOT *mem_root) { - handler *new_handler= get_new_handler(table->s, mem_root, table->s->db_type()); + handler *new_handler= get_new_handler(table->s, mem_root, ht); if (new_handler && !new_handler->ha_open(table, file->s->name, table->db_stat, HA_OPEN_IGNORE_IF_LOCKED)) return new_handler;