| 1 |
CREATE USER test2@localhost; |
| 2 |
CREATE DATABASE testdb; |
| 3 |
USE testdb; |
| 4 |
USE test; |
| 5 |
GRANT CREATE, ALTER, DROP, INSERT, SELECT on test.* TO test2@localhost; |
| 6 |
GRANT CREATE, ALTER, DROP, INSERT, SELECT on testdb.* TO test2@localhost; |
| 7 |
connect (test2,localhost,test2,,test,MASTER_MYPORT,MASTER_MYSOCK); |
| 8 |
ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE testdb.t_10; |
| 9 |
SELECT * FROM testdb.t_10; |
| 10 |
a b |
| 11 |
2 Two |
| 12 |
4 Four |
| 13 |
6 Six |
| 14 |
8 Eight |
| 15 |
SELECT * FROM tp WHERE a BETWEEN 0 AND 10; |
| 16 |
a b |
| 17 |
1 One |
| 18 |
3 Three |
| 19 |
5 Five |
| 20 |
9 Nine |
| 21 |
ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE testdb.t_10; |
| 22 |
SELECT * FROM testdb.t_10; |
| 23 |
a b |
| 24 |
1 One |
| 25 |
3 Three |
| 26 |
5 Five |
| 27 |
9 Nine |
| 28 |
SELECT * FROM tp WHERE a BETWEEN 0 AND 10; |
| 29 |
a b |
| 30 |
2 Two |
| 31 |
4 Four |
| 32 |
6 Six |
| 33 |
8 Eight |
| 34 |
ALTER TABLE testdb.tp EXCHANGE PARTITION p0 WITH TABLE t_10; |
| 35 |
SELECT * FROM t_10; |
| 36 |
a b |
| 37 |
2 Two |
| 38 |
4 Four |
| 39 |
6 Six |
| 40 |
8 Eight |
| 41 |
SELECT * FROM testdb.tp WHERE a BETWEEN 0 AND 10; |
| 42 |
a b |
| 43 |
1 One |
| 44 |
3 Three |
| 45 |
5 Five |
| 46 |
9 Nine |
| 47 |
ALTER TABLE testdb.tp EXCHANGE PARTITION p0 WITH TABLE t_10; |
| 48 |
SELECT * FROM t_10; |
| 49 |
a b |
| 50 |
1 One |
| 51 |
3 Three |
| 52 |
5 Five |
| 53 |
9 Nine |
| 54 |
SELECT * FROM testdb.tp WHERE a BETWEEN 0 AND 10; |
| 55 |
a b |
| 56 |
2 Two |
| 57 |
4 Four |
| 58 |
6 Six |
| 59 |
8 Eight |
| 60 |
disconnect test2; |
| 61 |
connection default; |
| 62 |
REVOKE INSERT ON testdb.* FROM test2@localhost; |
| 63 |
connect (test2,localhost,test2,,test,MASTER_MYPORT,MASTER_MYSOCK); |
| 64 |
ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE testdb.t_10; |
| 65 |
ERROR 42000: INSERT command denied to user 'test2'@'localhost' for table 't_10' |
| 66 |
ALTER TABLE testdb.tp EXCHANGE PARTITION p0 WITH TABLE t_10; |
| 67 |
ERROR 42000: INSERT command denied to user 'test2'@'localhost' for table 'tp' |
| 68 |
disconnect test2; |
| 69 |
connection default; |
| 70 |
DROP TABLE IF EXISTS t_10; |
| 71 |
DROP TABLE IF EXISTS t_100; |
| 72 |
DROP TABLE IF EXISTS t_1000; |
| 73 |
DROP TABLE IF EXISTS tp; |
| 74 |
DROP TABLE IF EXISTS tsp; |
| 75 |
DROP TABLE IF EXISTS tsp_00; |
| 76 |
DROP TABLE IF EXISTS tsp_01; |
| 77 |
DROP TABLE IF EXISTS tsp_02; |
| 78 |
DROP TABLE IF EXISTS tsp_03; |
| 79 |
DROP TABLE IF EXISTS tsp_04; |
| 80 |
DROP TABLE IF EXISTS t_empty; |
| 81 |
DROP TABLE IF EXISTS t_null; |
| 82 |
DROP USER test2@localhost; |
| 83 |
DROP DATABASE testdb; |