2006-03-07 12:42:23 -08:00
|
|
|
drop schema if exists mysqltest_1;
|
|
|
|
create schema mysqltest_1;
|
|
|
|
use mysqltest_1;
|
|
|
|
create table t1 (a int) partition by list (a) (partition p1 values in (1), partition p2 values in (2), partition p3 values in (3));
|
|
|
|
insert into t1 values (1),(2);
|
2015-08-11 18:45:38 +02:00
|
|
|
create user mysqltest_1@localhost;
|
2006-08-14 19:05:35 +04:00
|
|
|
grant usage on *.* to mysqltest_1@localhost;
|
|
|
|
revoke all privileges on *.* from mysqltest_1@localhost;
|
2006-03-07 12:42:23 -08:00
|
|
|
grant select,alter on mysqltest_1.* to mysqltest_1@localhost;
|
2016-03-25 20:51:22 +04:00
|
|
|
connect conn1,localhost,mysqltest_1,,mysqltest_1;
|
2006-03-07 12:42:23 -08:00
|
|
|
show grants for current_user;
|
|
|
|
Grants for mysqltest_1@localhost
|
2019-11-06 12:35:19 +01:00
|
|
|
GRANT USAGE ON *.* TO `mysqltest_1`@`localhost`
|
|
|
|
GRANT SELECT, ALTER ON `mysqltest_1`.* TO `mysqltest_1`@`localhost`
|
2006-03-07 12:42:23 -08:00
|
|
|
alter table t1 add b int;
|
|
|
|
alter table t1 drop partition p2;
|
2022-07-16 14:39:17 +02:00
|
|
|
ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table `mysqltest_1`.`t1`
|
2016-03-25 20:51:22 +04:00
|
|
|
disconnect conn1;
|
|
|
|
connection default;
|
2006-03-07 12:42:23 -08:00
|
|
|
grant drop on mysqltest_1.* to mysqltest_1@localhost;
|
2016-03-25 20:51:22 +04:00
|
|
|
connect conn2,localhost,mysqltest_1,,mysqltest_1;
|
2006-03-07 12:42:23 -08:00
|
|
|
alter table t1 drop partition p2;
|
2016-03-25 20:51:22 +04:00
|
|
|
disconnect conn2;
|
|
|
|
connection default;
|
2006-03-07 12:42:23 -08:00
|
|
|
revoke alter on mysqltest_1.* from mysqltest_1@localhost;
|
2016-03-25 20:51:22 +04:00
|
|
|
connect conn3,localhost,mysqltest_1,,mysqltest_1;
|
2006-03-07 12:42:23 -08:00
|
|
|
alter table t1 drop partition p3;
|
2022-07-16 14:39:17 +02:00
|
|
|
ERROR 42000: ALTER command denied to user 'mysqltest_1'@'localhost' for table `mysqltest_1`.`t1`
|
2016-03-25 20:51:22 +04:00
|
|
|
disconnect conn3;
|
|
|
|
connection default;
|
2006-03-07 12:42:23 -08:00
|
|
|
revoke select,alter,drop on mysqltest_1.* from mysqltest_1@localhost;
|
|
|
|
drop table t1;
|
2007-04-04 14:01:47 +05:00
|
|
|
create table t1 (s1 int);
|
|
|
|
insert into t1 values (1);
|
|
|
|
grant alter on mysqltest_1.* to mysqltest_1@localhost;
|
2016-03-25 20:51:22 +04:00
|
|
|
connect conn4,localhost,mysqltest_1,,mysqltest_1;
|
|
|
|
connection conn4;
|
2007-04-04 14:01:47 +05:00
|
|
|
alter table t1 partition by list (s1) (partition p1 values in (2));
|
|
|
|
ERROR HY000: Table has no partition for some existing values
|
2016-03-25 20:51:22 +04:00
|
|
|
connection default;
|
2007-04-04 14:01:47 +05:00
|
|
|
grant select, alter on mysqltest_1.* to mysqltest_1@localhost;
|
2016-03-25 20:51:22 +04:00
|
|
|
disconnect conn4;
|
|
|
|
connect conn5,localhost,mysqltest_1,,mysqltest_1;
|
2007-04-04 14:01:47 +05:00
|
|
|
alter table t1 partition by list (s1) (partition p1 values in (2));
|
|
|
|
ERROR HY000: Table has no partition for value 1
|
2016-03-25 20:51:22 +04:00
|
|
|
disconnect conn5;
|
|
|
|
connection default;
|
2007-04-04 14:01:47 +05:00
|
|
|
drop table t1;
|
|
|
|
drop user mysqltest_1@localhost;
|
2006-03-07 12:42:23 -08:00
|
|
|
drop schema mysqltest_1;
|
|
|
|
End of 5.1 tests
|