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