Debian Codegraph @

mysql-test/suite/perfschema/include/privilege.inc

raw
1 # Tests for PERFORMANCE_SCHEMA
2
3 --disable_warnings
4 drop table if exists test.t1;
5 --enable_warnings
6
7 ## The result of show grants is not consistent across platforms ...
8 ## show grants;
9
10 ## Not enforced yet: deny CREATE_ACL and DROP_ACL
11 ## Waiting to remove .FRM files first
12 ##
13 ## --error ER_DBACCESS_DENIED_ERROR
14 ## create table performance_schema.t1(a int);
15 ##
16 ## --error ER_DBACCESS_DENIED_ERROR
17 ## drop table performance_schema.t1;
18 ##
19 ## --error ER_DBACCESS_DENIED_ERROR
20 ## create table performance_schema.setup_instruments(a int);
21 ##
22 ## --error ER_DBACCESS_DENIED_ERROR
23 ## create table performance_schema.events_waits_current(a int);
24 ##
25 ## --error ER_DBACCESS_DENIED_ERROR
26 ## create table performance_schema.file_instances(a int);
27 ##
28 ## --error ER_DBACCESS_DENIED_ERROR
29 ## drop table performance_schema.setup_instruments;
30 ##
31 ## --error ER_DBACCESS_DENIED_ERROR
32 ## drop table performance_schema.events_waits_current;
33 ##
34 ## --error ER_DBACCESS_DENIED_ERROR
35 ## drop table performance_schema.file_instances;
36
37 --error ER_DBACCESS_DENIED_ERROR
38 rename table performance_schema.setup_instruments to test.t1;
39
40 --error ER_DBACCESS_DENIED_ERROR
41 rename table performance_schema.events_waits_current to test.t1;
42
43 --error ER_DBACCESS_DENIED_ERROR
44 rename table performance_schema.file_instances to test.t1;
45
46 --error ER_DBACCESS_DENIED_ERROR
47 rename table performance_schema.setup_instruments to performance_schema.t1;
48
49 --error ER_DBACCESS_DENIED_ERROR
50 rename table performance_schema.events_waits_current to performance_schema.t1;
51
52 --error ER_DBACCESS_DENIED_ERROR
53 rename table performance_schema.file_instances to performance_schema.t1;
54
55 --error ER_DBACCESS_DENIED_ERROR
56 rename table performance_schema.setup_instruments
57 to performance_schema.events_waits_current;
58
59 --error ER_DBACCESS_DENIED_ERROR
60 rename table performance_schema.events_waits_current
61 to performance_schema.setup_instruments;
62
63 --error ER_DBACCESS_DENIED_ERROR
64 create procedure performance_schema.my_proc() begin end;
65
66 --error ER_DBACCESS_DENIED_ERROR
67 create function performance_schema.my_func() returns int return 0;
68
69 --error ER_DBACCESS_DENIED_ERROR
70 create event performance_schema.my_event on schedule every 15 minute
71 do begin end;
72
73 --error ER_DBACCESS_DENIED_ERROR
74 create trigger performance_schema.bi_setup_instruments
75 before insert on performance_schema.setup_instruments
76 for each row begin end;
77
78 --error ER_DBACCESS_DENIED_ERROR
79 create trigger performance_schema.bi_events_waits_current
80 before insert on performance_schema.events_waits_current
81 for each row begin end;
82
83 --error ER_DBACCESS_DENIED_ERROR
84 create trigger performance_schema.bi_file_instances
85 before insert on performance_schema.file_instances
86 for each row begin end;
87
88 --error ER_WRONG_PERFSCHEMA_USAGE
89 create table test.t1(a int) engine=PERFORMANCE_SCHEMA;
90
91 --error ER_WRONG_PERFSCHEMA_USAGE
92 create table test.t1 like performance_schema.setup_instruments;
93
94 --error ER_WRONG_PERFSCHEMA_USAGE
95 create table test.t1 like performance_schema.events_waits_current;
96
97 --error ER_WRONG_PERFSCHEMA_USAGE
98 create table test.t1 like performance_schema.file_instances;
99
100 --error ER_TABLEACCESS_DENIED_ERROR
101 insert into performance_schema.setup_instruments
102 set name="foo";
103
104 --error ER_TABLEACCESS_DENIED_ERROR
105 insert into performance_schema.events_waits_current
106 set name="foo";
107
108 --error ER_TABLEACCESS_DENIED_ERROR
109 insert into performance_schema.file_instances
110 set name="foo";
111
112 --error ER_TABLEACCESS_DENIED_ERROR
113 delete from performance_schema.setup_instruments;
114
115 --error ER_TABLEACCESS_DENIED_ERROR
116 delete from performance_schema.events_waits_current;
117
118 --error ER_TABLEACCESS_DENIED_ERROR
119 delete from performance_schema.file_instances;
120
121 lock table performance_schema.setup_instruments read;
122 unlock tables;
123
124 lock table performance_schema.setup_instruments write;
125 unlock tables;
126
127 --error ER_TABLEACCESS_DENIED_ERROR
128 lock table performance_schema.events_waits_current read;
129 unlock tables;
130
131 --error ER_TABLEACCESS_DENIED_ERROR
132 lock table performance_schema.events_waits_current write;
133 unlock tables;
134
135 --error ER_TABLEACCESS_DENIED_ERROR
136 lock table performance_schema.file_instances read;
137 unlock tables;
138
139 --error ER_TABLEACCESS_DENIED_ERROR
140 lock table performance_schema.file_instances write;
141 unlock tables;
142
143 --echo #
144 --echo # WL#4818, NFS2: Can use grants to give normal user access
145 --echo # to view data from _current and _history tables
146 --echo #
147 --echo # Should work as pfs_user_1 and pfs_user_2, but not as pfs_user_3.
148 --echo # (Except for events_waits_current, which is granted.)
149
150 # Errors here will be caught by the diff afterwards
151 --disable_abort_on_error
152
153 SELECT "can select" FROM performance_schema.events_waits_history LIMIT 1;
154
155 SELECT "can select" FROM performance_schema.events_waits_history_long LIMIT 1;
156
157 SELECT "can select" FROM performance_schema.events_waits_current LIMIT 1;
158
159 SELECT "can select" FROM performance_schema.events_waits_summary_by_instance LIMIT 1;
160
161 SELECT "can select" FROM performance_schema.file_summary_by_instance LIMIT 1;
162
163 --enable_abort_on_error
164