Debian Codegraph @

mysql-test/suite/funcs_1/t/is_schema_privileges_is_mysql_test.test

raw
1 # suite/funcs_1/t/is_schema_privileges_is_mysql_test.test
2 #
3 # Check the content of information_schema.schema_privileges about the databases
4 # information_schema, mysql and test visible to high and low privileged users.
5 #
6 # Author:
7 # 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
8 # testsuite funcs_1
9 # Create this script based on older scripts and new code.
10 #
11
12
13 --echo ##############################################################################
14 --echo # Testcases 3.2.9.2+3.2.9.3 INFORMATION_SCHEMA.SCHEMATA accessible information
15 --echo ##############################################################################
16 # 3.2.9.2 Ensure that the table shows the relevant information for every
17 # database on which the current user or PUBLIC have privileges.
18 # 3.2.9.3 Ensure that the table does not show any information on any databases
19 # on which the current user and PUBLIC have no privileges.
20 #
21 --disable_warnings
22 DROP DATABASE IF EXISTS db_datadict;
23 --enable_warnings
24 CREATE DATABASE db_datadict;
25
26 # Create a low privileged user.
27 # Note: The database db_datadict is just a "home" for the low privileged user
28 # and not in the focus of testing.
29 --error 0,ER_CANNOT_USER
30 DROP USER 'testuser1'@'localhost';
31 CREATE USER 'testuser1'@'localhost';
32 GRANT SELECT ON db_datadict.* TO 'testuser1'@'localhost';
33
34 let $my_select = SELECT * FROM information_schema.schema_privileges
35 WHERE table_schema IN ('information_schema','mysql','test')
36 ORDER BY grantee, table_schema, privilege_type;
37 let $my_show1 = SHOW DATABASES LIKE 'information_schema';
38 let $my_show2 = SHOW DATABASES LIKE 'mysql';
39 let $my_show3 = SHOW DATABASES LIKE 'test';
40 eval $my_select;
41 eval $my_show1;
42 eval $my_show2;
43 eval $my_show3;
44
45 --echo # Establish connection testuser1 (user=testuser1)
46 --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
47 connect (testuser1, localhost, testuser1, , db_datadict);
48 eval $my_select;
49 eval $my_show1;
50 eval $my_show2;
51 eval $my_show3;
52
53 # Cleanup
54 --echo # Switch to connection default and close connection testuser1
55 connection default;
56 DROP USER 'testuser1'@'localhost';
57 DROP DATABASE db_datadict;
58