summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/main/long_unique_bugs.result6
-rw-r--r--mysql-test/main/long_unique_bugs.test10
-rw-r--r--sql/sql_base.cc6
-rw-r--r--sql/sql_update.cc4
4 files changed, 21 insertions, 5 deletions
diff --git a/mysql-test/main/long_unique_bugs.result b/mysql-test/main/long_unique_bugs.result
index 9a5f35a2e70..08f7bd5a3df 100644
--- a/mysql-test/main/long_unique_bugs.result
+++ b/mysql-test/main/long_unique_bugs.result
@@ -20,3 +20,9 @@ t1 CREATE TABLE `t1` (
UNIQUE KEY `b` (`b`) USING HASH
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1;
+create table t1 (pk int, b blob, primary key(pk), unique(b)) engine=myisam;
+insert into t1 values (1,'foo');
+replace into t1 (pk) values (1);
+alter table t1 force;
+replace into t1 (pk) values (1);
+drop table t1;
diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test
index d979a052547..f8e49471a74 100644
--- a/mysql-test/main/long_unique_bugs.test
+++ b/mysql-test/main/long_unique_bugs.test
@@ -26,3 +26,13 @@ alter table t1 add unique (b);
alter table t1 force;
show create table t1;
drop table t1;
+
+#
+# MDEV-18713 Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed in test_if_reopen upon REPLACE into table with key on blob
+#
+create table t1 (pk int, b blob, primary key(pk), unique(b)) engine=myisam;
+insert into t1 values (1,'foo');
+replace into t1 (pk) values (1);
+alter table t1 force;
+replace into t1 (pk) values (1);
+drop table t1;
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index ad7ff34190a..566c1970691 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -850,12 +850,16 @@ void close_thread_tables(THD *thd)
DBUG_ASSERT(thd->transaction.stmt.is_empty() || thd->in_sub_stmt ||
(thd->state_flags & Open_tables_state::BACKUPS_AVAIL));
- /* Detach MERGE children after every statement. Even under LOCK TABLES. */
for (table= thd->open_tables; table; table= table->next)
{
+ if (table->update_handler)
+ table->delete_update_handler();
+
/* Table might be in use by some outer statement. */
DBUG_PRINT("tcache", ("table: '%s' query_id: %lu",
table->s->table_name.str, (ulong) table->query_id));
+
+ /* Detach MERGE children after every statement. Even under LOCK TABLES. */
if (thd->locked_tables_mode <= LTM_LOCK_TABLES ||
table->query_id == thd->query_id)
{
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index ea1cc93a4ea..c4f11b1ab81 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -1137,8 +1137,6 @@ update_begin:
break;
}
}
- if (table->update_handler)
- table->delete_update_handler();
ANALYZE_STOP_TRACKING(&explain->command_tracker);
table->auto_increment_field_not_null= FALSE;
dup_key_found= 0;
@@ -2371,8 +2369,6 @@ multi_update::~multi_update()
for (table= update_tables ; table; table= table->next_local)
{
table->table->no_keyread= 0;
- if (table->table->update_handler)
- table->table->delete_update_handler();
if (ignore)
table->table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
}