summaryrefslogtreecommitdiff
path: root/mysql-test/t/alter_table.test
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-03-25 22:05:09 +0200
committerunknown <monty@mysql.com>2004-03-25 22:05:09 +0200
commit7f0a632c1965aeab06976aff650cb545e7192cb4 (patch)
tree84d7297d8f71762a061e90217363681f271907fd /mysql-test/t/alter_table.test
parent5a685dc81f0d83e303a6deb18903510b08bc9443 (diff)
parent143e585a7f5deed19e618cfa7e2987d0949d7ad7 (diff)
downloadmariadb-git-7f0a632c1965aeab06976aff650cb545e7192cb4.tar.gz
merge with 3.23
BitKeeper/etc/logging_ok: auto-union scripts/mysqlbug.sh: Auto merged sql/sql_parse.cc: Auto merged mysql-test/t/alter_table.test: Merge code with 3.23 sql/nt_servc.cc: use original code
Diffstat (limited to 'mysql-test/t/alter_table.test')
-rw-r--r--mysql-test/t/alter_table.test76
1 files changed, 49 insertions, 27 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 1937cdbe985..21ea4fcc01f 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -3,6 +3,8 @@
#
drop table if exists t1,t2;
+drop database if exists mysqltest;
+
create table t1 (
col1 int not null auto_increment primary key,
col2 varchar(30) not null,
@@ -77,6 +79,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,0,mysql-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,0,mysql-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,
@@ -99,16 +148,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
#
@@ -204,20 +243,3 @@ 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;