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