~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
# suite/funcs_1/t/is_collations.test
2
#
3
# Check the layout of information_schema.collations and 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 = COLLATIONS;
13
14
# The table INFORMATION_SCHEMA.COLLATIONS 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.3.1: INFORMATION_SCHEMA.COLLATIONS layout
28
--echo #########################################################################
29
# Ensure that the INFORMATION_SCHEMA.COLLATIONS table has the following
30
# columns, in the following order:
31
#
32
# COLLATION_NAME (shows a collation name),
33
# CHARACTER_SET_NAME (shows the name of the character set to which the
34
#       collation applies),
35
# ID (shows a numeric identifier for that collation/character set combination),
36
# IS_DEFAULT (shows whether the collation is the default collation for the
37
#       character set shown),
38
# IS_COMPILED (indicates whether the collation is compiled into the MySQL server),
39
# SORTLEN (shows a value related to the amount of memory required to sort
40
#       strings using this collation/character set combination).
41
#
42
eval DESCRIBE          information_schema.$is_table;
43
eval SHOW CREATE TABLE information_schema.$is_table;
44
eval SHOW COLUMNS FROM information_schema.$is_table;
45
46
# Note: Retrieval of information within information_schema.columns about
47
#       information_schema.collations is in is_columns_is.test.
48
#       Retrieval of information_schema.collations content is in
49
#       charset_collation.inc (sourced by charset_collation_*.test).
50
51
echo # Testcases 3.2.3.2 and 3.2.3.3 are checked in suite/funcs_1/t/charset_collation*.test;
52
53
--echo ########################################################################
54
--echo # Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and
55
--echo #           DDL on INFORMATION_SCHEMA tables are not supported
56
--echo ########################################################################
57
# 3.2.1.3:  Ensure that no user may execute an INSERT statement on any
58
#           INFORMATION_SCHEMA table.
59
# 3.2.1.4:  Ensure that no user may execute an UPDATE statement on any
60
#           INFORMATION_SCHEMA table.
61
# 3.2.1.5:  Ensure that no user may execute a DELETE statement on any
62
#           INFORMATION_SCHEMA table.
63
# 3.2.1.8:  Ensure that no user may create an index on an 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.collations
79
SELECT * FROM information_schema.collations;
80
--error ER_DBACCESS_DENIED_ERROR
81
INSERT INTO information_schema.collations
82
       (collation_name,character_set_name,id,is_default,is_compiled,sortlen)
83
VALUES (  'cp1251_bin',          'cp1251',50,        '',         '',0);
84
85
--error ER_DBACCESS_DENIED_ERROR
86
UPDATE information_schema.collations SET description = 'just updated';
87
88
--error ER_DBACCESS_DENIED_ERROR
89
DELETE FROM information_schema.collations WHERE table_name = 't1';
90
--error ER_DBACCESS_DENIED_ERROR
91
TRUNCATE information_schema.collations;
92
93
--error ER_DBACCESS_DENIED_ERROR
94
CREATE INDEX my_idx ON information_schema.collations(character_set_name);
95
96
--error ER_DBACCESS_DENIED_ERROR
97
ALTER TABLE information_schema.collations DROP PRIMARY KEY;
98
--error ER_DBACCESS_DENIED_ERROR
99
ALTER TABLE information_schema.collations ADD f1 INT;
100
--error ER_DBACCESS_DENIED_ERROR
101
ALTER TABLE information_schema.collations ENABLE KEYS;
102
103
--error ER_DBACCESS_DENIED_ERROR
104
DROP TABLE information_schema.collations;
105
106
--error ER_DBACCESS_DENIED_ERROR
107
ALTER TABLE information_schema.collations RENAME db_datadict.collations;
108
--error ER_DBACCESS_DENIED_ERROR
109
ALTER TABLE information_schema.collations
110
RENAME information_schema.xcollations;
111
112
# Cleanup
113
DROP DATABASE db_datadict;
114