summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/repair.result7
-rw-r--r--mysql-test/t/repair.test10
-rw-r--r--sql/sql_base.cc2
3 files changed, 18 insertions, 1 deletions
diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result
index c069824e9f0..815305013be 100644
--- a/mysql-test/r/repair.result
+++ b/mysql-test/r/repair.result
@@ -48,3 +48,10 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
t1 1 a 1 a A 5 NULL NULL YES BTREE
SET myisam_repair_threads=@@global.myisam_repair_threads;
DROP TABLE t1;
+CREATE TABLE t1(a INT);
+USE mysql;
+REPAIR TABLE test.t1 USE_FRM;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+USE test;
+DROP TABLE t1;
diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test
index f086d5b0c2a..91d03ce3082 100644
--- a/mysql-test/t/repair.test
+++ b/mysql-test/t/repair.test
@@ -45,4 +45,14 @@ SHOW INDEX FROM t1;
SET myisam_repair_threads=@@global.myisam_repair_threads;
DROP TABLE t1;
+#
+# BUG#22562 - REPAIR TABLE .. USE_FRM causes server crash on Windows and
+# server hangs on Linux
+#
+CREATE TABLE t1(a INT);
+USE mysql;
+REPAIR TABLE test.t1 USE_FRM;
+USE test;
+DROP TABLE t1;
+
# End of 4.1 tests
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 0a9529d6067..561d75a765e 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -821,7 +821,7 @@ TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table_list)
if (!(table = table_list->table))
DBUG_RETURN(0);
- char* db = thd->db ? thd->db : table_list->db;
+ char *db= table_list->db;
char* table_name = table_list->real_name;
char key[MAX_DBKEY_LENGTH];
uint key_length;