summaryrefslogtreecommitdiff
path: root/mysql-test/t/drop-no_root.test
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@ibmvm>2009-10-07 20:39:57 +0400
committerAlexander Nozdrin <alik@ibmvm>2009-10-07 20:39:57 +0400
commit9384835087d71b77ef1ee0f197704060c713af2c (patch)
tree36172354a44f415d1a716da83486600d055b7305 /mysql-test/t/drop-no_root.test
parent1733a974b4811f439806d5b6cfc388462b9bd675 (diff)
downloadmariadb-git-9384835087d71b77ef1ee0f197704060c713af2c.tar.gz
A backport of patch for Bug#26704.
Original revision is from mysql-6.0-codebase: revno: 2630.3.1 committer: Alexander Nozdrin <alik@mysql.com> branch nick: 6.0-rt-bug26704 timestamp: Thu 2008-05-29 21:04:06 +0400 message: A fix for Bug#26704: Failing DROP DATABASE brings mysql-client out of sync. The problem was that we changed current database w/o caring whether it was dropped successfully or not. The fix is not to change current database if we failed to drop it.
Diffstat (limited to 'mysql-test/t/drop-no_root.test')
-rw-r--r--mysql-test/t/drop-no_root.test49
1 files changed, 49 insertions, 0 deletions
diff --git a/mysql-test/t/drop-no_root.test b/mysql-test/t/drop-no_root.test
new file mode 100644
index 00000000000..05418b9dbb7
--- /dev/null
+++ b/mysql-test/t/drop-no_root.test
@@ -0,0 +1,49 @@
+# This test uses chmod, can't be run with root permissions
+--source include/not_as_root.inc
+
+###########################################################################
+
+--echo
+--echo # --
+--echo # -- Bug#26704: Failing DROP DATABASE brings mysql-client out of sync.
+--echo # --
+
+--echo
+--disable_warnings
+DROP DATABASE IF EXISTS mysql_test;
+--enable_warnings
+
+--echo
+CREATE DATABASE mysql_test;
+CREATE TABLE mysql_test.t1(c INT);
+
+use mysql_test;
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--echo
+--echo chmod 000 mysql_test/t1.frm
+--chmod 0000 $MYSQLD_DATADIR/mysql_test/t1.frm
+
+--echo
+--error ER_DB_DROP_RMDIR
+DROP DATABASE mysql_test;
+
+--echo
+SELECT DATABASE();
+
+--echo
+--echo rm mysql_test/t1.MYD mysql_test/t1.MYI
+--exec rm $MYSQLD_DATADIR/mysql_test/t1.MYD
+--exec rm $MYSQLD_DATADIR/mysql_test/t1.MYI
+
+--echo
+DROP DATABASE mysql_test;
+
+--echo
+use test;
+
+--echo
+--echo # -- End of Bug#26704.
+
+###########################################################################