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