Debian Codegraph @

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

raw
1 # suite/funcs_1/t/is_character_sets.test
2 #
3 # Check the layout of information_schema.character_sets and run some
4 # functionality related tests.
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 let $is_table = CHARACTER_SETS;
14
15 # The table INFORMATION_SCHEMA.CHARACTER_SETS must exist
16 eval SHOW TABLES FROM information_schema LIKE '$is_table';
17
18 --echo #######################################################################
19 --echo # Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT
20 --echo #######################################################################
21 # Ensure that every INFORMATION_SCHEMA table can be queried with a SELECT
22 # statement, just as if it were an ordinary user-defined table.
23 #
24 --source suite/funcs_1/datadict/is_table_query.inc
25
26
27 --echo #########################################################################
28 --echo # Testcase 3.2.2.1: INFORMATION_SCHEMA.CHARACTER_SETS layout
29 --echo #########################################################################
30 # Ensure that the INFORMATION_SCHEMA.CHARACTER_SETS table has the following
31 # columns, in the following order:
32 #
33 # CHARACTER_SET_NAME (shows a character set name),
34 # DEFAULT_COLLATE_NAME (shows the name of the default collation for that
35 # character set),
36 # DESCRIPTION (shows a descriptive name for that character set),
37 # MAXLEN (shows the number of bytes used to store each character supported by
38 # that character set).
39 #
40 eval DESCRIBE information_schema.$is_table;
41 eval SHOW CREATE TABLE information_schema.$is_table;
42 eval SHOW COLUMNS FROM information_schema.$is_table;
43
44 # Note: Retrieval of information within information_schema.columns about
45 # information_schema.character_sets is in is_columns_is.test.
46 # Retrieval of information_schema.character_sets content is in
47 # charset_collation.inc (sourced by charset_collation_*.test).
48
49
50 echo # Testcases 3.2.2.2 and 3.2.2.3 are checked in suite/funcs_1/t/charset_collation*.test;
51
52 --echo ########################################################################
53 --echo # Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and
54 --echo # DDL on INFORMATION_SCHEMA tables are not supported
55 --echo ########################################################################
56 # 3.2.1.3: Ensure that no user may execute an INSERT statement on any
57 # INFORMATION_SCHEMA table.
58 # 3.2.1.4: Ensure that no user may execute an UPDATE statement on any
59 # INFORMATION_SCHEMA table.
60 # 3.2.1.5: Ensure that no user may execute a DELETE statement on any
61 # INFORMATION_SCHEMA table.
62 # 3.2.1.8: Ensure that no user may create an index on an
63 # INFORMATION_SCHEMA table.
64 # 3.2.1.9: Ensure that no user may alter the definition of an
65 # INFORMATION_SCHEMA table.
66 # 3.2.1.10: Ensure that no user may drop an INFORMATION_SCHEMA table.
67 # 3.2.1.11: Ensure that no user may move an INFORMATION_SCHEMA table to any
68 # other database.
69 # 3.2.1.12: Ensure that no user may directly add to, alter, or delete any data
70 # in an INFORMATION_SCHEMA table.
71 #
72 --disable_warnings
73 DROP DATABASE IF EXISTS db_datadict;
74 --enable_warnings
75 CREATE DATABASE db_datadict;
76
77 --error ER_DBACCESS_DENIED_ERROR
78 INSERT INTO information_schema.character_sets
79 SELECT * FROM information_schema.character_sets;
80
81 --error ER_DBACCESS_DENIED_ERROR
82 UPDATE information_schema.character_sets SET description = 'just updated';
83
84 --error ER_DBACCESS_DENIED_ERROR
85 DELETE FROM information_schema.character_sets WHERE table_name = 't1';
86 --error ER_DBACCESS_DENIED_ERROR
87 TRUNCATE information_schema.character_sets;
88
89 --error ER_DBACCESS_DENIED_ERROR
90 CREATE INDEX my_idx ON information_schema.character_sets(character_set_name);
91
92 --error ER_DBACCESS_DENIED_ERROR
93 ALTER TABLE information_schema.character_sets DROP PRIMARY KEY;
94 --error ER_DBACCESS_DENIED_ERROR
95 ALTER TABLE information_schema.character_sets ADD f1 INT;
96
97 --error ER_DBACCESS_DENIED_ERROR
98 DROP TABLE information_schema.character_sets;
99
100 --error ER_DBACCESS_DENIED_ERROR
101 ALTER TABLE information_schema.character_sets RENAME db_datadict.character_sets;
102 --error ER_DBACCESS_DENIED_ERROR
103 ALTER TABLE information_schema.character_sets
104 RENAME information_schema.xcharacter_sets;
105
106 # Cleanup
107 DROP DATABASE db_datadict;
108