Debian Codegraph @

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

raw
1 # suite/funcs_1/t/is_schemata_is_mysql_test.test
2 #
3 # Check the content of information_schema.schemata about the databases
4 # information_schema and mysql 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 # This test cannot be used for the embedded server because we check here
13 # privileges.
14 --source include/not_embedded.inc
15 --source include/default_charset.inc
16
17 --echo #################################################################################
18 --echo # Testcases 3.2.9.2 + 3.2.9.3: INFORMATION_SCHEMA.SCHEMATA accessible information
19 --echo #################################################################################
20 # 3.2.9.2 Ensure that the table shows the relevant information for every
21 # database on which the current user or PUBLIC have privileges.
22 # 3.2.9.3 Ensure that the table does not show any information on any databases
23 # on which the current user and PUBLIC have no privileges.
24 #
25 --disable_warnings
26 DROP DATABASE IF EXISTS db_datadict;
27 --enable_warnings
28 CREATE DATABASE db_datadict;
29
30 # Create a low privileged user.
31 # Note: The database db_datadict is just a "home" for the low privileged user
32 # and not in the focus of testing.
33 --error 0,ER_CANNOT_USER
34 DROP USER 'testuser1'@'localhost';
35 CREATE USER 'testuser1'@'localhost';
36 GRANT SELECT ON db_datadict.* TO 'testuser1'@'localhost';
37
38 let $my_select = SELECT * FROM information_schema.schemata
39 WHERE schema_name IN ('information_schema','mysql','test')
40 ORDER BY schema_name;
41 let $my_show1 = SHOW DATABASES LIKE 'information_schema';
42 let $my_show2 = SHOW DATABASES LIKE 'mysql';
43 let $my_show3 = SHOW DATABASES LIKE 'test';
44 eval $my_select;
45 eval $my_show1;
46 eval $my_show2;
47 eval $my_show3;
48
49 --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
50 connect (testuser1, localhost, testuser1, , db_datadict);
51 eval $my_select;
52 eval $my_show1;
53 eval $my_show2;
54 eval $my_show3;
55
56 # Cleanup
57 connection default;
58 DROP USER 'testuser1'@'localhost';
59 DROP DATABASE db_datadict;