Debian Codegraph @

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

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