| 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 |
|
| 13 |
let $is_table = COLLATIONS; |
| 14 |
|
| 15 |
# The table INFORMATION_SCHEMA.COLLATIONS must exist |
| 16 |
eval SHOW TABLES FROM information_schema LIKE '$is_table'; |
| 17 |
|
| 18 |
--echo ####################################################################### |
| 19 |
--echo # Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT |
| 20 |
--echo ####################################################################### |
| 21 |
# Ensure that every INFORMATION_SCHEMA table can be queried with a SELECT |
| 22 |
# statement, just as if it were an ordinary user-defined table. |
| 23 |
# |
| 24 |
--source suite/funcs_1/datadict/is_table_query.inc |
| 25 |
|
| 26 |
|
| 27 |
--echo ######################################################################### |
| 28 |
--echo # Testcase 3.2.3.1: INFORMATION_SCHEMA.COLLATIONS layout |
| 29 |
--echo ######################################################################### |
| 30 |
# Ensure that the INFORMATION_SCHEMA.COLLATIONS table has the following |
| 31 |
# columns, in the following order: |
| 32 |
# |
| 33 |
# COLLATION_NAME (shows a collation name), |
| 34 |
# CHARACTER_SET_NAME (shows the name of the character set to which the |
| 35 |
# collation applies), |
| 36 |
# ID (shows a numeric identifier for that collation/character set combination), |
| 37 |
# IS_DEFAULT (shows whether the collation is the default collation for the |
| 38 |
# character set shown), |
| 39 |
# IS_COMPILED (indicates whether the collation is compiled into the MySQL server), |
| 40 |
# SORTLEN (shows a value related to the amount of memory required to sort |
| 41 |
# strings using this collation/character set combination). |
| 42 |
# |
| 43 |
eval DESCRIBE information_schema.$is_table; |
| 44 |
eval SHOW CREATE TABLE information_schema.$is_table; |
| 45 |
eval SHOW COLUMNS FROM information_schema.$is_table; |
| 46 |
|
| 47 |
# Note: Retrieval of information within information_schema.columns about |
| 48 |
# information_schema.collations is in is_columns_is.test. |
| 49 |
# Retrieval of information_schema.collations content is in |
| 50 |
# charset_collation.inc (sourced by charset_collation_*.test). |
| 51 |
|
| 52 |
echo # Testcases 3.2.3.2 and 3.2.3.3 are checked in suite/funcs_1/t/charset_collation*.test; |
| 53 |
|
| 54 |
--echo ######################################################################## |
| 55 |
--echo # Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and |
| 56 |
--echo # DDL on INFORMATION_SCHEMA tables are not supported |
| 57 |
--echo ######################################################################## |
| 58 |
# 3.2.1.3: Ensure that no user may execute an INSERT statement on any |
| 59 |
# INFORMATION_SCHEMA table. |
| 60 |
# 3.2.1.4: Ensure that no user may execute an UPDATE statement on any |
| 61 |
# INFORMATION_SCHEMA table. |
| 62 |
# 3.2.1.5: Ensure that no user may execute a DELETE statement on any |
| 63 |
# INFORMATION_SCHEMA table. |
| 64 |
# 3.2.1.8: Ensure that no user may create an index on an INFORMATION_SCHEMA table. |
| 65 |
# 3.2.1.9: Ensure that no user may alter the definition of an |
| 66 |
# INFORMATION_SCHEMA table. |
| 67 |
# 3.2.1.10: Ensure that no user may drop an INFORMATION_SCHEMA table. |
| 68 |
# 3.2.1.11: Ensure that no user may move an INFORMATION_SCHEMA table to any |
| 69 |
# other database. |
| 70 |
# 3.2.1.12: Ensure that no user may directly add to, alter, or delete any data |
| 71 |
# in an INFORMATION_SCHEMA table. |
| 72 |
# |
| 73 |
--disable_warnings |
| 74 |
DROP DATABASE IF EXISTS db_datadict; |
| 75 |
--enable_warnings |
| 76 |
CREATE DATABASE db_datadict; |
| 77 |
|
| 78 |
--error ER_DBACCESS_DENIED_ERROR |
| 79 |
INSERT INTO information_schema.collations |
| 80 |
SELECT * FROM information_schema.collations; |
| 81 |
--error ER_DBACCESS_DENIED_ERROR |
| 82 |
INSERT INTO information_schema.collations |
| 83 |
(collation_name,character_set_name,id,is_default,is_compiled,sortlen) |
| 84 |
VALUES ( 'cp1251_bin', 'cp1251',50, '', '',0); |
| 85 |
|
| 86 |
--error ER_DBACCESS_DENIED_ERROR |
| 87 |
UPDATE information_schema.collations SET description = 'just updated'; |
| 88 |
|
| 89 |
--error ER_DBACCESS_DENIED_ERROR |
| 90 |
DELETE FROM information_schema.collations WHERE table_name = 't1'; |
| 91 |
--error ER_DBACCESS_DENIED_ERROR |
| 92 |
TRUNCATE information_schema.collations; |
| 93 |
|
| 94 |
--error ER_DBACCESS_DENIED_ERROR |
| 95 |
CREATE INDEX my_idx ON information_schema.collations(character_set_name); |
| 96 |
|
| 97 |
--error ER_DBACCESS_DENIED_ERROR |
| 98 |
ALTER TABLE information_schema.collations DROP PRIMARY KEY; |
| 99 |
--error ER_DBACCESS_DENIED_ERROR |
| 100 |
ALTER TABLE information_schema.collations ADD f1 INT; |
| 101 |
--error ER_DBACCESS_DENIED_ERROR |
| 102 |
ALTER TABLE information_schema.collations ENABLE KEYS; |
| 103 |
|
| 104 |
--error ER_DBACCESS_DENIED_ERROR |
| 105 |
DROP TABLE information_schema.collations; |
| 106 |
|
| 107 |
--error ER_DBACCESS_DENIED_ERROR |
| 108 |
ALTER TABLE information_schema.collations RENAME db_datadict.collations; |
| 109 |
--error ER_DBACCESS_DENIED_ERROR |
| 110 |
ALTER TABLE information_schema.collations |
| 111 |
RENAME information_schema.xcollations; |
| 112 |
|
| 113 |
# Cleanup |
| 114 |
DROP DATABASE db_datadict; |
| 115 |
|