summaryrefslogtreecommitdiff
path: root/mysql-test/t/alter_table.test
diff options
context:
space:
mode:
authorunknown <ingo@mysql.com>2005-08-29 16:54:33 +0200
committerunknown <ingo@mysql.com>2005-08-29 16:54:33 +0200
commit0f7161b050d398971495bbe1b674684665162753 (patch)
treea8552252801267060754c1595ab9cd2a5166ed36 /mysql-test/t/alter_table.test
parentf876fae9c87b8330b3405a51ad886151ee300db4 (diff)
downloadmariadb-git-0f7161b050d398971495bbe1b674684665162753.tar.gz
Bug#11493 - Alter table rename to default database does not work without db name qualifying
Supplied the default database name for ALTER TABLE ... RENAME for the new table instead of the old tables db like we do for other ALTERs. mysql-test/r/alter_table.result: Bug#11493 - Alter table rename to default database does not work without db name qualifying The test result. mysql-test/t/alter_table.test: Bug#11493 - Alter table rename to default database does not work without db name qualifying The test case.
Diffstat (limited to 'mysql-test/t/alter_table.test')
-rw-r--r--mysql-test/t/alter_table.test31
1 files changed, 31 insertions, 0 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index a237b21f403..9bd34c2a610 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -361,4 +361,35 @@ create table t1 ( a timestamp );
alter table t1 add unique ( a(1) );
drop table t1;
+#
+# Bug#11493 - Alter table rename to default database does not work without
+# db name qualifying
+#
+create database mysqltest1;
+create table t1 (c1 int);
+# Move table to other database.
+alter table t1 rename mysqltest1.t1;
+# Assure that it has moved.
+--error 1051
+drop table t1;
+# Move table back.
+alter table mysqltest1.t1 rename t1;
+# Assure that it is back.
+drop table t1;
+# Now test for correct message if no database is selected.
+# Create t1 in 'test'.
+create table t1 (c1 int);
+# Change to other db.
+use mysqltest1;
+# Drop the current db. This de-selects any db.
+drop database mysqltest1;
+# Now test for correct message.
+--error 1046
+alter table test.t1 rename t1;
+# Check that explicit qualifying works even with no selected db.
+alter table test.t1 rename test.t1;
+# Go back to standard 'test' db.
+use test;
+drop table t1;
+
# End of 4.1 tests