summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/main/long_unique_bugs.result4
-rw-r--r--mysql-test/main/long_unique_bugs.test8
-rw-r--r--sql/temporary_tables.cc2
3 files changed, 14 insertions, 0 deletions
diff --git a/mysql-test/main/long_unique_bugs.result b/mysql-test/main/long_unique_bugs.result
index d81125eda91..05ddceb63f8 100644
--- a/mysql-test/main/long_unique_bugs.result
+++ b/mysql-test/main/long_unique_bugs.result
@@ -49,3 +49,7 @@ pk f row_end > DATE'2030-01-01'
1 foo 0
1 bar 0
drop table t1;
+create temporary table t1 (f blob, unique(f)) engine=innodb;
+insert into t1 values (1);
+replace into t1 values (1);
+drop table t1;
diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test
index 6220a22e759..f00b3171a54 100644
--- a/mysql-test/main/long_unique_bugs.test
+++ b/mysql-test/main/long_unique_bugs.test
@@ -56,3 +56,11 @@ update t1 set f = 'foo';
select * from t1;
select pk, f, row_end > DATE'2030-01-01' from t1 for system_time all;
drop table t1;
+
+#
+# MDEV-18747 InnoDB: Failing assertion: table->get_ref_count() == 0 upon dropping temporary table with unique blob
+#
+create temporary table t1 (f blob, unique(f)) engine=innodb;
+insert into t1 values (1);
+replace into t1 values (1);
+drop table t1;
diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc
index 917a85e6c3b..77e19830119 100644
--- a/sql/temporary_tables.cc
+++ b/sql/temporary_tables.cc
@@ -731,6 +731,8 @@ void THD::mark_tmp_tables_as_free_for_reuse()
{
if ((table->query_id == query_id) && !table->open_by_handler)
{
+ if (table->update_handler)
+ table->delete_update_handler();
mark_tmp_table_as_free_for_reuse(table);
}
}