summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/funcs_1/t/charset_collation.test
blob: d3d7a519115b814c7fb94eb75336df1b739a4e10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# suite/funcs_1/t/charset_collation.test
#
# Tests checking the content of the information_schema tables
#      character_sets
#      collations
#      collation_character_set_applicability
#
# Created:
# 2009-04-28 mleich Replace the charset_collation_* test which failed too often
#                   because of changes
#                   - in general available character sets and collations
#                   - in build types
#                   (Bug#40545, Bug#40209, Bug#40618, Bug#38346)
#

# Create a low privileged user.
--error 0, ER_CANNOT_USER
DROP USER dbdict_test@localhost;
CREATE USER dbdict_test@localhost;

connect (con,localhost,dbdict_test,,);
################################################################################
#
# The original requirements for the following tests were:
#
# 3.2.2.2: Ensure that the table (information_schema.character_sets) shows the
#          relevant information on every character set for which the current
#          user or PUBLIC have the USAGE privilege.
#
# 3.2.2.3: Ensure that the table (information_schema.character_sets) does not
#          show any information on any character set for which the current user
#          or PUBLIC have no USAGE privilege.
#
#
# 3.2.3.2: Ensure that the table (information_schema.collations) shows the
#          relevant information on every collation for which the current user
#          or PUBLIC have the USAGE privilege.
#
# 3.2.3.3: Ensure that the table (information_schema.collations) does not show
#          any information on any collations for which the current user and
#          PUBLIC have no USAGE privilege.
#
#
# 3.2.4.2: Ensure that the table
#                information_schema.collation_character_set_applicability
#          shows the relevant information on every collation/character set
#          combination for which the current user or PUBLIC have the USAGE
#          privilege.
#
# 3.2.4.3: Ensure that the table
#                information_schema.collation_character_set_applicability
#          does not show any information on any collation/character set
#          combinations for which the current user and PUBLIC have no
#          USAGE privilege.
#
# Notes (2009-04-28 mleich):
# - The requirements are outdated because grant/revoke privilege for using a
#   characterset/collation were never implemented.
#   Therefore the tests focus on the completeness and correctness of the
#   content (rows and columns) of these tables.
# - The amount of collations/character sets grows with new MySQL releases.
#   Even within the same release the amount of records within these tables
#   can differ between different build types (community, enterprise, source,...)
#   Therefore we limit the queries to character sets and collations which
#   - exist in all build types
#   - have in all build types the same "state".
#   The character set
#   - utf8 is used for Metadata
#   - ascii is a quite usual
#   The collations <character set>_general_ci and <character set>_bin seem
#   to be available all time.
#
################################################################################

let $char_set_condition= character_set_name IN ('utf8mb3','latin1','binary');
let $collation_condition=
   (collation_name LIKE CONCAT(character_set_name,'_general_ci')
    OR
    collation_name LIKE CONCAT(character_set_name,'_bin'));
--echo
eval SELECT *
FROM information_schema.character_sets
WHERE $char_set_condition
ORDER BY character_set_name;

--echo
eval SELECT *
FROM information_schema.collations
WHERE $char_set_condition
  AND $collation_condition
ORDER BY collation_name;

--echo
eval SELECT *
FROM information_schema.collation_character_set_applicability
WHERE $char_set_condition
  AND $collation_condition
ORDER BY collation_name, character_set_name;


# Cleanup
connection default;
disconnect con;
DROP USER dbdict_test@localhost;