mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / t / partition_grant.test
blobcf944e507fd5f8d276b2436182174f87d0752904
1 -- source include/have_partition.inc
2 # Grant tests not performed with embedded server
3 -- source include/not_embedded.inc
5 --disable_warnings
6 drop schema if exists mysqltest_1;
7 --enable_warnings
11 # Bug #17139: ALTER TABLE ... DROP PARTITION should require DROP privilege
14 create schema mysqltest_1;
15 use mysqltest_1;
17 create table t1 (a int) partition by list (a) (partition p1 values in (1), partition p2 values in (2), partition p3 values in (3));
18 insert into t1 values (1),(2);
20 # We don't have DROP USER IF EXISTS. Use this workaround to
21 # cleanup possible grants for mysqltest_1 left by previous tests
22 # and ensure consistent results of SHOW GRANTS command below.
23 --disable_warnings
24 grant usage on *.* to mysqltest_1@localhost;
25 revoke all privileges on *.* from mysqltest_1@localhost;
26 --enable_warnings
28 grant select,alter on mysqltest_1.* to mysqltest_1@localhost;
30 connect (conn1,localhost,mysqltest_1,,mysqltest_1);
31 show grants for current_user;
32 alter table t1 add b int;
33 --error ER_TABLEACCESS_DENIED_ERROR
34 alter table t1 drop partition p2;
35 disconnect conn1;
37 connection default;
38 grant drop on mysqltest_1.* to mysqltest_1@localhost;
40 connect (conn2,localhost,mysqltest_1,,mysqltest_1);
41 alter table t1 drop partition p2;
42 disconnect conn2;
44 connection default;
45 revoke alter on mysqltest_1.* from mysqltest_1@localhost;
47 connect (conn3,localhost,mysqltest_1,,mysqltest_1);
48 --error ER_TABLEACCESS_DENIED_ERROR
49 alter table t1 drop partition p3;
50 disconnect conn3;
52 connection default;
54 revoke select,alter,drop on mysqltest_1.* from mysqltest_1@localhost;
55 drop table t1;
58 # Bug #23675 Partitions: possible security breach via alter 
61 create table t1 (s1 int);
62 insert into t1 values (1);
63 grant alter on mysqltest_1.* to mysqltest_1@localhost;
64 connect (conn4,localhost,mysqltest_1,,mysqltest_1);
65 connection conn4;
66 --error ER_NO_PARTITION_FOR_GIVEN_VALUE
67 alter table t1 partition by list (s1) (partition p1 values in (2));
68 connection default;
69 grant select, alter on mysqltest_1.* to mysqltest_1@localhost;
70 disconnect conn4;
71 connect (conn5,localhost,mysqltest_1,,mysqltest_1);
72 --error ER_NO_PARTITION_FOR_GIVEN_VALUE
73 alter table t1 partition by list (s1) (partition p1 values in (2));
74 disconnect conn5;
75 connection default;
76 drop table t1;
78 drop user mysqltest_1@localhost;
79 drop schema mysqltest_1;
81 --echo End of 5.1 tests