Debian Codegraph @

mysql-test/suite/perfschema/t/column_privilege.test

raw
1 # Tests for PERFORMANCE_SCHEMA
2 # Test how columns privileges can be used on performance schema tables,
3 # for very fine control.
4
5 --source include/not_embedded.inc
6 --source include/have_perfschema.inc
7
8 show grants;
9
10 create user 'pfs_user_5'@localhost;
11 grant usage on *.* to 'pfs_user_5'@localhost with GRANT OPTION;
12
13 # Test per column privileges on performance_schema
14
15 grant SELECT(thread_id, event_id) on performance_schema.events_waits_current
16 to 'pfs_user_5'@localhost;
17
18 grant UPDATE(enabled) on performance_schema.setup_instruments
19 to 'pfs_user_5'@localhost;
20
21 flush privileges;
22
23 connect (con1, localhost, pfs_user_5, , );
24
25 # Commented because the result is not consistent (uppercase/lowercase)
26 # show grants;
27
28 # For statements that works, we do not look at the output
29 --disable_result_log
30
31 select thread_id from performance_schema.events_waits_current;
32
33 select thread_id, event_id from performance_schema.events_waits_current;
34
35 update performance_schema.setup_instruments set enabled='YES';
36
37 --enable_result_log
38
39 # For statements that are denied, check the error number and error text.
40
41 --error ER_COLUMNACCESS_DENIED_ERROR
42 select event_name from performance_schema.events_waits_current;
43
44 --error ER_COLUMNACCESS_DENIED_ERROR
45 select thread_id, event_id, event_name
46 from performance_schema.events_waits_current;
47
48 --error ER_COLUMNACCESS_DENIED_ERROR
49 update performance_schema.setup_instruments set name='illegal';
50
51 --error ER_COLUMNACCESS_DENIED_ERROR
52 update performance_schema.setup_instruments set timed='NO';
53
54 # Cleanup
55
56 --connection default
57 --disconnect con1
58 REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'pfs_user_5'@localhost;
59 DROP USER 'pfs_user_5'@localhost;
60 flush privileges;
61 UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';
62