| 1 |
|
| 2 |
CREATE USER test1@localhost; |
| 3 |
CREATE USER test2@localhost; |
| 4 |
GRANT USAGE ON *.* TO test1@localhost; |
| 5 |
GRANT USAGE ON *.* TO test2@localhost; |
| 6 |
GRANT CREATE, DROP, INSERT, SELECT ON test.* TO test1@localhost; |
| 7 |
GRANT CREATE, DROP, ALTER, UPDATE, INSERT, SELECT ON test.* TO test2@localhost; |
| 8 |
|
| 9 |
--echo connect (test1,localhost,test1,,test,MASTER_MYPORT,MASTER_MYSOCK); |
| 10 |
connect (test1,localhost,test1,,test,$MASTER_MYPORT,$MASTER_MYSOCK); |
| 11 |
SELECT current_user(); |
| 12 |
SHOW GRANTS FOR CURRENT_USER; |
| 13 |
--disable_result_log |
| 14 |
--disable_query_log |
| 15 |
--source suite/parts/inc/part_exch_tabs.inc |
| 16 |
--enable_result_log |
| 17 |
--enable_query_log |
| 18 |
--error ER_TABLEACCESS_DENIED_ERROR |
| 19 |
ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10; |
| 20 |
--echo disconnect test1; |
| 21 |
disconnect test1; |
| 22 |
|
| 23 |
|
| 24 |
--echo connect (test2,localhost,test2,,test,MASTER_MYPORT,MASTER_MYSOCK); |
| 25 |
connect (test2,localhost,test2,,test,$MASTER_MYPORT,$MASTER_MYSOCK); |
| 26 |
USE test; |
| 27 |
SELECT current_user(); |
| 28 |
SHOW GRANTS FOR CURRENT_USER; |
| 29 |
|
| 30 |
# 9) Exchanges with different owner. |
| 31 |
# Privilege for ALTER and SELECT |
| 32 |
ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10; |
| 33 |
--sorted_result |
| 34 |
SELECT * FROM t_10; |
| 35 |
--sorted_result |
| 36 |
SELECT * FROM tp WHERE a BETWEEN 0 AND 10; |
| 37 |
# Back to former values. |
| 38 |
ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10; |
| 39 |
--sorted_result |
| 40 |
SELECT * FROM t_10; |
| 41 |
--sorted_result |
| 42 |
SELECT * FROM tp WHERE a BETWEEN 0 AND 10; |
| 43 |
ALTER TABLE tsp EXCHANGE PARTITION sp00 WITH TABLE tsp_00; |
| 44 |
--sorted_result |
| 45 |
SELECT * FROM tsp_00; |
| 46 |
--sorted_result |
| 47 |
SELECT * FROM tsp WHERE a BETWEEN 0 AND 10; |
| 48 |
# Back to former values. |
| 49 |
ALTER TABLE tsp EXCHANGE PARTITION sp00 WITH TABLE tsp_00; |
| 50 |
--sorted_result |
| 51 |
SELECT * FROM tsp_00; |
| 52 |
--sorted_result |
| 53 |
SELECT * FROM tsp WHERE a BETWEEN 0 AND 10; |
| 54 |
--echo disconnect test2; |
| 55 |
disconnect test2; |
| 56 |
|
| 57 |
--echo connection default; |
| 58 |
connection default; |
| 59 |
REVOKE ALTER ON test.* FROM test2@localhost; |
| 60 |
|
| 61 |
--echo connect (test2,localhost,test2,,test,MASTER_MYPORT,MASTER_MYSOCK); |
| 62 |
connect (test2,localhost,test2,,test,$MASTER_MYPORT,$MASTER_MYSOCK); |
| 63 |
USE test; |
| 64 |
SELECT current_user(); |
| 65 |
SHOW GRANTS FOR CURRENT_USER; |
| 66 |
# Privilege for ALTER and SELECT |
| 67 |
--error ER_TABLEACCESS_DENIED_ERROR |
| 68 |
ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10; |
| 69 |
SELECT * FROM tp WHERE a BETWEEN 0 AND 10; |
| 70 |
# Back to former values. |
| 71 |
--error ER_TABLEACCESS_DENIED_ERROR |
| 72 |
ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10; |
| 73 |
--error ER_TABLEACCESS_DENIED_ERROR |
| 74 |
ALTER TABLE tsp EXCHANGE PARTITION sp00 WITH TABLE tsp_00; |
| 75 |
# Back to former values. |
| 76 |
--error ER_TABLEACCESS_DENIED_ERROR |
| 77 |
ALTER TABLE tsp EXCHANGE PARTITION sp00 WITH TABLE tsp_00; |
| 78 |
|
| 79 |
--echo connection default; |
| 80 |
connection default; |
| 81 |
--echo disconnect test2; |
| 82 |
disconnect test2; |
| 83 |
|
| 84 |
--source suite/parts/inc/part_exch_drop_tabs.inc |
| 85 |
|
| 86 |
DROP USER test1@localhost; |
| 87 |
DROP USER test2@localhost; |
| 88 |
|