Debian Codegraph @

mysql-test/suite/parts/inc/part_exch_qa_5.inc

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