1 -- source include/have_partition.inc
2 # Grant tests not performed with embedded server
3 -- source include/not_embedded.inc
6 drop schema if exists mysqltest_1;
11 # Bug #17139: ALTER TABLE ... DROP PARTITION should require DROP privilege
14 create schema 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.
24 grant usage on *.* to mysqltest_1@localhost;
25 revoke all privileges on *.* from mysqltest_1@localhost;
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;
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;
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;
54 revoke select,alter,drop on mysqltest_1.* from mysqltest_1@localhost;
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);
66 --error ER_NO_PARTITION_FOR_GIVEN_VALUE
67 alter table t1 partition by list (s1) (partition p1 values in (2));
69 grant select, alter on mysqltest_1.* to mysqltest_1@localhost;
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));
78 drop user mysqltest_1@localhost;
79 drop schema mysqltest_1;
81 --echo End of 5.1 tests