summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <tsmith@ramayana.hindu.god>2007-12-07 00:54:32 -0700
committerunknown <tsmith@ramayana.hindu.god>2007-12-07 00:54:32 -0700
commit20bbe71d73013fcb2d40be213592650539b38560 (patch)
tree2d437f9c8281b820a3fe56e10ca20aa8b675ac62 /mysql-test
parent80360321849dad159ae26d35fccd5886f0291776 (diff)
downloadmariadb-git-20bbe71d73013fcb2d40be213592650539b38560.tar.gz
Move the test case for bug #20901 from create.test to grant.test, so
testing embedded server works correctly. mysql-test/r/create.result: Move one test from create.test to grant.test, because it actually tests privileges (and thus doesn't work with embedded server). mysql-test/r/grant.result: Move one test from create.test to grant.test, because it actually tests privileges (and thus doesn't work with embedded server). mysql-test/t/create.test: Move one test from create.test to grant.test, because it actually tests privileges (and thus doesn't work with embedded server). mysql-test/t/grant.test: Move one test from create.test to grant.test, because it actually tests privileges (and thus doesn't work with embedded server).
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/create.result38
-rw-r--r--mysql-test/r/grant.result39
-rw-r--r--mysql-test/t/create.test76
-rw-r--r--mysql-test/t/grant.test78
4 files changed, 117 insertions, 114 deletions
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 23d2013cba5..73a9dba4e69 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -763,44 +763,6 @@ t2 CREATE TABLE `t2` (
drop table t1, t2;
create table t1(a set("a,b","c,d") not null);
ERROR 22007: Illegal set 'a,b' value found during parsing
-create database mysqltest;
-use mysqltest;
-grant create on mysqltest.* to mysqltest@localhost;
-create table t1 (i INT);
-insert into t1 values (1);
-ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't1'
-create table t2 (i INT);
-create table t4 (i INT);
-grant select, insert on mysqltest.t2 to mysqltest@localhost;
-grant insert on mysqltest.t4 to mysqltest@localhost;
-grant create, insert on mysqltest.t5 to mysqltest@localhost;
-grant create, insert on mysqltest.t6 to mysqltest@localhost;
-flush privileges;
-insert into t2 values (1);
-create table if not exists t1 select * from t2;
-ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't1'
-create table if not exists t3 select * from t2;
-ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't3'
-create table if not exists t4 select * from t2;
-Warnings:
-Note 1050 Table 't4' already exists
-create table if not exists t5 select * from t2;
-create table t6 select * from t2;
-create table t7 select * from t2;
-ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't7'
-create table t4 select * from t2;
-ERROR 42S01: Table 't4' already exists
-create table t1 select * from t2;
-ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't1'
-drop table t1,t2,t4,t5,t6;
-revoke create on mysqltest.* from mysqltest@localhost;
-revoke select, insert on mysqltest.t2 from mysqltest@localhost;
-revoke insert on mysqltest.t4 from mysqltest@localhost;
-revoke create, insert on mysqltest.t5 from mysqltest@localhost;
-revoke create, insert on mysqltest.t6 from mysqltest@localhost;
-flush privileges;
-drop database mysqltest;
-use test;
create table t1 (i int) engine=myisam max_rows=100000000000;
show create table t1;
Table Create Table
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 4d402d7d0e9..5df0b4d9448 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -1226,3 +1226,42 @@ drop user юзер_юзер@localhost;
grant select on test.* to очень_длинный_юзер@localhost;
ERROR HY000: String 'очень_длинный_юзер' is too long for user name (should be no longer than 16)
set names default;
+create database mysqltest;
+use mysqltest;
+grant create on mysqltest.* to mysqltest@localhost;
+create table t1 (i INT);
+insert into t1 values (1);
+ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't1'
+create table t2 (i INT);
+create table t4 (i INT);
+grant select, insert on mysqltest.t2 to mysqltest@localhost;
+grant insert on mysqltest.t4 to mysqltest@localhost;
+grant create, insert on mysqltest.t5 to mysqltest@localhost;
+grant create, insert on mysqltest.t6 to mysqltest@localhost;
+flush privileges;
+insert into t2 values (1);
+create table if not exists t1 select * from t2;
+ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't1'
+create table if not exists t3 select * from t2;
+ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't3'
+create table if not exists t4 select * from t2;
+Warnings:
+Note 1050 Table 't4' already exists
+create table if not exists t5 select * from t2;
+create table t6 select * from t2;
+create table t7 select * from t2;
+ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't7'
+create table t4 select * from t2;
+ERROR 42S01: Table 't4' already exists
+create table t1 select * from t2;
+ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't1'
+drop table t1,t2,t4,t5,t6;
+revoke create on mysqltest.* from mysqltest@localhost;
+revoke select, insert on mysqltest.t2 from mysqltest@localhost;
+revoke insert on mysqltest.t4 from mysqltest@localhost;
+revoke create, insert on mysqltest.t5 from mysqltest@localhost;
+revoke create, insert on mysqltest.t6 from mysqltest@localhost;
+drop user mysqltest@localhost;
+drop database mysqltest;
+use test;
+End of 5.1 tests
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 15c36dfff84..45ee4c1c88d 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -658,82 +658,6 @@ drop table t1, t2;
--error 1367
create table t1(a set("a,b","c,d") not null);
-#
-# Bug #20901 - CREATE privilege is enough to insert into a table
-#
-
-create database mysqltest;
-use mysqltest;
-
-grant create on mysqltest.* to mysqltest@localhost;
-create table t1 (i INT);
-
-connect (user1,localhost,mysqltest,,mysqltest);
-connection user1;
-# show we don't have INSERT
---error 1142
-insert into t1 values (1);
-# show we have CREATE
-create table t2 (i INT);
-create table t4 (i INT);
-
-connection default;
-grant select, insert on mysqltest.t2 to mysqltest@localhost;
-grant insert on mysqltest.t4 to mysqltest@localhost;
-# to specify ACLs for non-existent objects, must explictly |CREATE
-grant create, insert on mysqltest.t5 to mysqltest@localhost;
-grant create, insert on mysqltest.t6 to mysqltest@localhost;
-flush privileges;
-
-connection user1;
-insert into t2 values (1);
-
-
-# CREATE IF NOT EXISTS...SELECT, t1 exists, no INSERT, must fail
---error 1142
-create table if not exists t1 select * from t2;
-
-# CREATE IF NOT EXISTS...SELECT, no t3 yet, no INSERT, must fail
---error 1142
-create table if not exists t3 select * from t2;
-
-# CREATE IF NOT EXISTS...SELECT, t4 exists, have INSERT, must succeed
-create table if not exists t4 select * from t2;
-
-# CREATE IF NOT EXISTS...SELECT, no t5 yet, have INSERT, must succeed
-create table if not exists t5 select * from t2;
-
-
-# CREATE...SELECT, no t6 yet, have INSERT, must succeed
-create table t6 select * from t2;
-
-# CREATE...SELECT, no t7 yet, no INSERT, must fail
---error 1142
-create table t7 select * from t2;
-
-# CREATE...SELECT, t4 exists, have INSERT, must still fail (exists)
---error 1050
-create table t4 select * from t2;
-
-# CREATE...SELECT, t1 exists, no INSERT, must fail
---error 1142
-create table t1 select * from t2;
-
-
-connection default;
-drop table t1,t2,t4,t5,t6;
-
-revoke create on mysqltest.* from mysqltest@localhost;
-revoke select, insert on mysqltest.t2 from mysqltest@localhost;
-revoke insert on mysqltest.t4 from mysqltest@localhost;
-revoke create, insert on mysqltest.t5 from mysqltest@localhost;
-revoke create, insert on mysqltest.t6 from mysqltest@localhost;
-flush privileges;
-
-disconnect user1;
-drop database mysqltest;
-use test;
-
# End of 4.1 tests
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index 8d909d63f51..73775c95d52 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -1277,3 +1277,81 @@ drop user юзер_юзер@localhost;
--error ER_WRONG_STRING_LENGTH
grant select on test.* to очень_длинный_юзер@localhost;
set names default;
+
+#
+# Bug #20901 - CREATE privilege is enough to insert into a table
+#
+
+create database mysqltest;
+use mysqltest;
+
+grant create on mysqltest.* to mysqltest@localhost;
+create table t1 (i INT);
+
+connect (user1,localhost,mysqltest,,mysqltest);
+connection user1;
+# show we don't have INSERT
+--error 1142
+insert into t1 values (1);
+# show we have CREATE
+create table t2 (i INT);
+create table t4 (i INT);
+
+connection default;
+grant select, insert on mysqltest.t2 to mysqltest@localhost;
+grant insert on mysqltest.t4 to mysqltest@localhost;
+# to specify ACLs for non-existent objects, must explictly |CREATE
+grant create, insert on mysqltest.t5 to mysqltest@localhost;
+grant create, insert on mysqltest.t6 to mysqltest@localhost;
+flush privileges;
+
+connection user1;
+insert into t2 values (1);
+
+
+# CREATE IF NOT EXISTS...SELECT, t1 exists, no INSERT, must fail
+--error 1142
+create table if not exists t1 select * from t2;
+
+# CREATE IF NOT EXISTS...SELECT, no t3 yet, no INSERT, must fail
+--error 1142
+create table if not exists t3 select * from t2;
+
+# CREATE IF NOT EXISTS...SELECT, t4 exists, have INSERT, must succeed
+create table if not exists t4 select * from t2;
+
+# CREATE IF NOT EXISTS...SELECT, no t5 yet, have INSERT, must succeed
+create table if not exists t5 select * from t2;
+
+
+# CREATE...SELECT, no t6 yet, have INSERT, must succeed
+create table t6 select * from t2;
+
+# CREATE...SELECT, no t7 yet, no INSERT, must fail
+--error 1142
+create table t7 select * from t2;
+
+# CREATE...SELECT, t4 exists, have INSERT, must still fail (exists)
+--error 1050
+create table t4 select * from t2;
+
+# CREATE...SELECT, t1 exists, no INSERT, must fail
+--error 1142
+create table t1 select * from t2;
+
+
+connection default;
+drop table t1,t2,t4,t5,t6;
+
+revoke create on mysqltest.* from mysqltest@localhost;
+revoke select, insert on mysqltest.t2 from mysqltest@localhost;
+revoke insert on mysqltest.t4 from mysqltest@localhost;
+revoke create, insert on mysqltest.t5 from mysqltest@localhost;
+revoke create, insert on mysqltest.t6 from mysqltest@localhost;
+drop user mysqltest@localhost;
+
+disconnect user1;
+drop database mysqltest;
+use test;
+
+--echo End of 5.1 tests