Debian Codegraph @

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

raw
1 # suite/funcs_1/t/charset_collation.test
2 #
3 # Tests checking the content of the information_schema tables
4 # character_sets
5 # collations
6 # collation_character_set_applicability
7 #
8 # Created:
9 # 2009-04-28 mleich Replace the charset_collation_* test which failed too often
10 # because of changes
11 # - in general available character sets and collations
12 # - in build types
13 # (Bug#40545, Bug#40209, Bug#40618, Bug#38346)
14 #
15
16 # Create a low privileged user.
17 --error 0, ER_CANNOT_USER
18 DROP USER dbdict_test@localhost;
19 CREATE USER dbdict_test@localhost;
20
21 connect (con,localhost,dbdict_test,,);
22 ################################################################################
23 #
24 # The original requirements for the following tests were:
25 #
26 # 3.2.2.2: Ensure that the table (information_schema.character_sets) shows the
27 # relevant information on every character set for which the current
28 # user or PUBLIC have the USAGE privilege.
29 #
30 # 3.2.2.3: Ensure that the table (information_schema.character_sets) does not
31 # show any information on any character set for which the current user
32 # or PUBLIC have no USAGE privilege.
33 #
34 #
35 # 3.2.3.2: Ensure that the table (information_schema.collations) shows the
36 # relevant information on every collation for which the current user
37 # or PUBLIC have the USAGE privilege.
38 #
39 # 3.2.3.3: Ensure that the table (information_schema.collations) does not show
40 # any information on any collations for which the current user and
41 # PUBLIC have no USAGE privilege.
42 #
43 #
44 # 3.2.4.2: Ensure that the table
45 # information_schema.collation_character_set_applicability
46 # shows the relevant information on every collation/character set
47 # combination for which the current user or PUBLIC have the USAGE
48 # privilege.
49 #
50 # 3.2.4.3: Ensure that the table
51 # information_schema.collation_character_set_applicability
52 # does not show any information on any collation/character set
53 # combinations for which the current user and PUBLIC have no
54 # USAGE privilege.
55 #
56 # Notes (2009-04-28 mleich):
57 # - The requirements are outdated because grant/revoke privilege for using a
58 # characterset/collation were never implemented.
59 # Therefore the tests focus on the completeness and correctness of the
60 # content (rows and columns) of these tables.
61 # - The amount of collations/character sets grows with new MySQL releases.
62 # Even within the same release the amount of records within these tables
63 # can differ between different build types (community, enterprise, source,...)
64 # Therefore we limit the queries to character sets and collations which
65 # - exist in all build types
66 # - have in all build types the same "state".
67 # The character set
68 # - utf8 is used for Metadata
69 # - ascii is a quite usual
70 # The collations <character set>_general_ci and <character set>_bin seem
71 # to be available all time.
72 #
73 ################################################################################
74
75 let $char_set_condition= character_set_name IN ('utf8mb3','latin1','binary');
76 let $collation_condition=
77 (collation_name LIKE CONCAT(character_set_name,'_general_ci')
78 OR
79 collation_name LIKE CONCAT(character_set_name,'_bin'));
80 --echo
81 eval SELECT *
82 FROM information_schema.character_sets
83 WHERE $char_set_condition
84 ORDER BY character_set_name;
85
86 --echo
87 eval SELECT *
88 FROM information_schema.collations
89 WHERE $char_set_condition
90 AND $collation_condition
91 ORDER BY collation_name;
92
93 --echo
94 eval SELECT *
95 FROM information_schema.collation_character_set_applicability
96 WHERE $char_set_condition
97 AND $collation_condition
98 ORDER BY collation_name, character_set_name;
99
100
101 # Cleanup
102 connection default;
103 disconnect con;
104 DROP USER dbdict_test@localhost;