diff options
author | Sergei Golubchik <serg@mariadb.org> | 2020-05-04 11:32:08 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2020-05-05 19:41:12 +0200 |
commit | 937dfb74cb6b2292cfdff47fbb3c52172a2afc4c (patch) | |
tree | 11107b76bb106472c7ecdbdee5493ec0042eca6c | |
parent | 18502f99eb24f37d11e2431a89fd041cbdaea621 (diff) | |
download | mariadb-git-937dfb74cb6b2292cfdff47fbb3c52172a2afc4c.tar.gz |
MDEV-22424 Server crashes in handler::check_duplicate_long_entry_key or Assertion `inited == NONE || lookup_handler != this' failed upon DELETE FOR PORTION on table with long unique key
even if we're *allowed to* convert DELETE .. FOR PERIOD OF
into an update internally, doesn't think we'll *be able to*.
We always have to prepare for insert.
-rw-r--r-- | mysql-test/suite/period/r/delete.result | 4 | ||||
-rw-r--r-- | mysql-test/suite/period/t/delete.test | 8 | ||||
-rw-r--r-- | sql/sql_delete.cc | 3 |
3 files changed, 13 insertions, 2 deletions
diff --git a/mysql-test/suite/period/r/delete.result b/mysql-test/suite/period/r/delete.result index 451017e5340..260037735c1 100644 --- a/mysql-test/suite/period/r/delete.result +++ b/mysql-test/suite/period/r/delete.result @@ -368,3 +368,7 @@ drop procedure sp; drop table t,t2,t3,log_tbl; drop view v; drop procedure log; +create table t1 (pk int, s date, e date, period for se (s,e), primary key (pk,se without overlaps)); +insert into t1 values (1,'2020-01-01','2020-02-20'); +delete from t1 for portion of se from '2020-01-30' to '2020-01-31'; +drop table t1; diff --git a/mysql-test/suite/period/t/delete.test b/mysql-test/suite/period/t/delete.test index 738d77d2c19..e8035ca6ae7 100644 --- a/mysql-test/suite/period/t/delete.test +++ b/mysql-test/suite/period/t/delete.test @@ -198,3 +198,11 @@ drop procedure sp; drop table t,t2,t3,log_tbl; drop view v; drop procedure log; + +# +# MDEV-22424 Server crashes in handler::check_duplicate_long_entry_key or Assertion `inited == NONE || lookup_handler != this' failed upon DELETE FOR PORTION on table with long unique key +# +create table t1 (pk int, s date, e date, period for se (s,e), primary key (pk,se without overlaps)); +insert into t1 values (1,'2020-01-01','2020-02-20'); +delete from t1 for portion of se from '2020-01-30' to '2020-01-31'; +drop table t1; diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 2bb63552c6a..039ed417078 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -753,8 +753,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, && !table->versioned() && table->file->has_transactions(); - if (table->versioned(VERS_TIMESTAMP) || - (table_list->has_period() && !portion_of_time_through_update)) + if (table->versioned(VERS_TIMESTAMP) || (table_list->has_period())) table->file->prepare_for_insert(1); DBUG_ASSERT(table->file->inited != handler::NONE); |