diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/alter_table.result | 71 | ||||
-rw-r--r-- | mysql-test/r/union.result | 2 | ||||
-rw-r--r-- | mysql-test/t/alter_table.test | 77 | ||||
-rw-r--r-- | mysql-test/t/union.test | 2 | ||||
-rw-r--r-- | mysql-test/t/update.test | 1 |
5 files changed, 93 insertions, 60 deletions
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index dee7433404f..c82f181da81 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -1,4 +1,5 @@ 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, @@ -85,6 +86,45 @@ OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK DROP TABLE t1; +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; +i +1 +2 +3 +4 +drop table t1; +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; +name +current +select * from mysqltest.t1; +name +mysqltest +alter table t1 rename mysqltest.t1; +ERROR 42S01: Table 't1' already exists +select * from t1; +name +current +select * from mysqltest.t1; +name +mysqltest +drop table t1; +drop database mysqltest; +create database mysqltest; +create table mysqltest.t1 (a int,b int,c int); +grant all on mysqltest.t1 to mysqltest_1@localhost; +alter table t1 rename t2; +insert command denied to user: 'mysqltest_1@localhost' for table 't2' +revoke all privileges on mysqltest.t1 from mysqltest_1@localhost; +delete from mysql.user where user='mysqltest_1'; +drop database mysqltest; create table t1 (n1 int not null, n2 int, n3 int, n4 float, unique(n1), key (n1, n2, n3, n4), @@ -143,16 +183,6 @@ t1 1 n4 3 n2 A 10 NULL NULL YES BTREE t1 1 n4 4 n3 A 10 NULL NULL YES BTREE drop table t1; 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; -i -1 -2 -3 -4 -drop table t1; -create table t1 (i int unsigned not null auto_increment primary key); alter table t1 rename t2; alter table t2 rename t1, add c char(10) comment "no comment"; show columns from t1; @@ -428,27 +458,6 @@ t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE t1 0 PRIMARY 2 User A 0 NULL NULL BTREE t1 1 Host 1 Host A NULL NULL NULL BTREE disabled DROP TABLE t1; -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; -name -current -select * from mysqltest.t1; -name -mysqltest -alter table t1 rename mysqltest.t1; -ERROR 42S01: Table 't1' already exists -select * from t1; -name -current -select * from mysqltest.t1; -name -mysqltest -drop table t1; -drop database mysqltest; CREATE TABLE t1 (a int PRIMARY KEY, b INT UNIQUE); ALTER TABLE t1 DROP PRIMARY KEY; SHOW CREATE TABLE t1; diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index c00b2732bd1..908c1d285f5 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -434,6 +434,8 @@ create temporary table t1 select a from t1 union select a from t2; drop temporary table t1; create table t1 select a from t1 union select a from t2; ERROR HY000: You can't specify target table 't1' for update in FROM clause +select a from t1 union select a from t2 order by t2.a; +Unknown column 't2.a' in 'ORDER BY' drop table t1,t2; select length(version()) > 1 as `*` UNION select 2; * 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); diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index b744610ce3d..eaa1415d41f 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -251,6 +251,8 @@ create temporary table t1 select a from t1 union select a from t2; drop temporary table t1; --error 1093 create table t1 select a from t1 union select a from t2; +--error 1054 +select a from t1 union select a from t2 order by t2.a; drop table t1,t2; # diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test index 3406dfd6158..6ca75cf0c26 100644 --- a/mysql-test/t/update.test +++ b/mysql-test/t/update.test @@ -125,7 +125,6 @@ insert into t1 (F1,F2,F3,cnt,groupid) values ('0','0','0',1,6), ('0','1','2',1,5), ('0','2','0',1,3), ('1','0','1',1,2), ('1','2','1',1,1), ('1','2','2',1,1), ('2','0','1',2,4), ('2','2','0',1,7); - delete from m1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3); select * from t1; drop table t1; |