summaryrefslogtreecommitdiff
path: root/mysql-test/t/alter_table.test
diff options
context:
space:
mode:
authormonty@mysql.com <>2004-03-25 23:29:45 +0200
committermonty@mysql.com <>2004-03-25 23:29:45 +0200
commite0e0314d606399778f595d33a191c248f15cb4c2 (patch)
tree7815fb40163d1db39e3991dcd19341ef57d08d74 /mysql-test/t/alter_table.test
parent3b34a6a2dd73792e1b79047a491bd02b30d5ec68 (diff)
parent488fe61074a83ff31e6ac2f609ba596f903f4d4d (diff)
downloadmariadb-git-e0e0314d606399778f595d33a191c248f15cb4c2.tar.gz
Merge with 4.0
Diffstat (limited to 'mysql-test/t/alter_table.test')
-rw-r--r--mysql-test/t/alter_table.test77
1 files changed, 49 insertions, 28 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index bb174c0225a..39c84eceb94 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -3,6 +3,7 @@
#
--disable_warnings
drop table if exists t1,t2;
+drop database if exists mysqltest;
--enable_warnings
create table t1 (
@@ -79,6 +80,53 @@ OPTIMIZE TABLE t1;
DROP TABLE t1;
#
+# Drop and add an auto_increment column
+#
+
+create table t1 (i int unsigned not null auto_increment primary key);
+insert into t1 values (null),(null),(null),(null);
+alter table t1 drop i,add i int unsigned not null auto_increment, drop primary key, add primary key (i);
+select * from t1;
+drop table t1;
+
+#
+# Bug #2628: 'alter table t1 rename mysqltest.t1' silently drops mysqltest.t1
+# if it exists
+#
+create table t1 (name char(15));
+insert into t1 (name) values ("current");
+create database mysqltest;
+create table mysqltest.t1 (name char(15));
+insert into mysqltest.t1 (name) values ("mysqltest");
+select * from t1;
+select * from mysqltest.t1;
+--error 1050
+alter table t1 rename mysqltest.t1;
+select * from t1;
+select * from mysqltest.t1;
+drop table t1;
+drop database mysqltest;
+
+#
+# Rights for renaming test (Bug #3270)
+#
+connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock);
+connection root;
+--disable_warnings
+create database mysqltest;
+--enable_warnings
+create table mysqltest.t1 (a int,b int,c int);
+grant all on mysqltest.t1 to mysqltest_1@localhost;
+connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,master.sock);
+connection user1;
+-- error 1142
+alter table t1 rename t2;
+connection root;
+revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
+delete from mysql.user where user='mysqltest_1';
+drop database mysqltest;
+
+#
# ALTER TABLE ... ENABLE/DISABLE KEYS
create table t1 (n1 int not null, n2 int, n3 int, n4 float,
@@ -101,16 +149,6 @@ show keys from t1;
drop table t1;
#
-# Drop and add an auto_increment column
-#
-
-create table t1 (i int unsigned not null auto_increment primary key);
-insert into t1 values (null),(null),(null),(null);
-alter table t1 drop i,add i int unsigned not null auto_increment, drop primary key, add primary key (i);
-select * from t1;
-drop table t1;
-
-#
# Alter table and rename
#
@@ -255,26 +293,9 @@ LOCK TABLES t1 WRITE;
ALTER TABLE t1 DISABLE KEYS;
SHOW INDEX FROM t1;
DROP TABLE t1;
-#
-# Bug #2628: 'alter table t1 rename mysqltest.t1' silently drops mysqltest.t1
-# if it exists
-#
-create table t1 (name char(15));
-insert into t1 (name) values ("current");
-create database mysqltest;
-create table mysqltest.t1 (name char(15));
-insert into mysqltest.t1 (name) values ("mysqltest");
-select * from t1;
-select * from mysqltest.t1;
---error 1050
-alter table t1 rename mysqltest.t1;
-select * from t1;
-select * from mysqltest.t1;
-drop table t1;
-drop database mysqltest;
#
-# Bug 2361
+# Bug 2361 (Don't drop UNIQUE with DROP PRIMARY KEY)
#
CREATE TABLE t1 (a int PRIMARY KEY, b INT UNIQUE);