Commit 9c686c8a authored by unknown's avatar unknown

Bug#19392 Rename Database: Crash if case change

Problem:
Renaming a database to itself crashed server.
It hapenned because of wrong DBUG_ASSERT.
Fix: removing wrong DBUG_ASSERT. Now it reports
a correct error message "database alreadt exists".


mysql-test/r/renamedb.result:
  Adding test case
mysql-test/t/renamedb.test:
  Adding test case
sql/sql_db.cc:
  DBUG_ASSERT crashed server when renaming a database to itself.
parent de0e4a9a
...@@ -27,3 +27,7 @@ a ...@@ -27,3 +27,7 @@ a
2 2
3 3
drop database testdb2; drop database testdb2;
create database testdb1;
rename database testdb1 to testdb1;
ERROR HY000: Can't create database 'testdb1'; database exists
drop database testdb1;
...@@ -16,3 +16,11 @@ select database(); ...@@ -16,3 +16,11 @@ select database();
show tables; show tables;
select a from t1 order by a; select a from t1 order by a;
drop database testdb2; drop database testdb2;
#
# Bug#19392 Rename Database: Crash if case change
#
create database testdb1;
--error 1007
rename database testdb1 to testdb1;
drop database testdb1;
...@@ -134,9 +134,9 @@ void lock_db_delete(const char *name, uint length) ...@@ -134,9 +134,9 @@ void lock_db_delete(const char *name, uint length)
{ {
my_dblock_t *opt; my_dblock_t *opt;
safe_mutex_assert_owner(&LOCK_lock_db); safe_mutex_assert_owner(&LOCK_lock_db);
opt= (my_dblock_t *)hash_search(&lock_db_cache, (const byte*) name, length); if (opt= (my_dblock_t *)hash_search(&lock_db_cache,
DBUG_ASSERT(opt != NULL); (const byte*) name, length))
hash_delete(&lock_db_cache, (byte*) opt); hash_delete(&lock_db_cache, (byte*) opt);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment