Debian Codegraph @

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

raw
1 CREATE USER test2@localhost;
2
3 --disable_result_log
4 --disable_query_log
5 --source suite/parts/inc/part_exch_tabs.inc
6 --enable_result_log
7 --enable_query_log
8
9 CREATE DATABASE testdb;
10 USE testdb;
11 --disable_result_log
12 --disable_query_log
13 --source suite/parts/inc/part_exch_tabs.inc
14 --enable_result_log
15 --enable_query_log
16
17 USE test;
18 GRANT CREATE, ALTER, DROP, INSERT, SELECT on test.* TO test2@localhost;
19 GRANT CREATE, ALTER, DROP, INSERT, SELECT on testdb.* TO test2@localhost;
20
21 # 8) Exchanges partition and table and back in 2 sessions with 2 databases.
22 --echo connect (test2,localhost,test2,,test,MASTER_MYPORT,MASTER_MYSOCK);
23 connect (test2,localhost,test2,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
24 # Privileges on both DB's
25 ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE testdb.t_10;
26 --sorted_result
27 SELECT * FROM testdb.t_10;
28 --sorted_result
29 SELECT * FROM tp WHERE a BETWEEN 0 AND 10;
30 # Exchange back.
31 ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE testdb.t_10;
32 --sorted_result
33 SELECT * FROM testdb.t_10;
34 --sorted_result
35 SELECT * FROM tp WHERE a BETWEEN 0 AND 10;
36
37 ALTER TABLE testdb.tp EXCHANGE PARTITION p0 WITH TABLE t_10;
38 --sorted_result
39 SELECT * FROM t_10;
40 --sorted_result
41 SELECT * FROM testdb.tp WHERE a BETWEEN 0 AND 10;
42 # Exchange back.
43 ALTER TABLE testdb.tp EXCHANGE PARTITION p0 WITH TABLE t_10;
44 --sorted_result
45 SELECT * FROM t_10;
46 --sorted_result
47 SELECT * FROM testdb.tp WHERE a BETWEEN 0 AND 10;
48 --echo disconnect test2;
49 disconnect test2;
50
51 --echo connection default;
52 connection default;
53 REVOKE INSERT ON testdb.* FROM test2@localhost;
54
55 --echo connect (test2,localhost,test2,,test,MASTER_MYPORT,MASTER_MYSOCK);
56 connect (test2,localhost,test2,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
57 --error ER_TABLEACCESS_DENIED_ERROR
58 ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE testdb.t_10;
59 --error ER_TABLEACCESS_DENIED_ERROR
60 ALTER TABLE testdb.tp EXCHANGE PARTITION p0 WITH TABLE t_10;
61 --echo disconnect test2;
62 disconnect test2;
63
64 --echo connection default;
65 connection default;
66 --source suite/parts/inc/part_exch_drop_tabs.inc
67
68 DROP USER test2@localhost;
69 DROP DATABASE testdb;
70