mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
WL#4203 Reorganize and fix the data dictionary tests of
testsuite funcs_1
1. Fix the following bugs
Bug#30440 "datadict" tests (all engines) fail: Character sets depend on configuration
Solution: Test variants charset_collation_* adjusted to different builds
Bug#32603 "datadict" tests (all engines) fail in "community" tree: "PROFILING" table
Solution: Excluding "PROFILING" table from queries
Bug#33654 "slow log" is missing a line
Solution: Unify the content of the fields TABLES.TABLE_ROWS and
STATISTICS.CARDINALITY within result sets
Bug#34532 Some funcs_1 tests do not clean up at end of testing
Solution: DROP objects/reset global server variables modified during testing
+ let tests missing implementation end before loading of tables
Bug#31421 funcs_1: ndb__datadict fails, discrepancy between scripts and expected results
Solution: Cut <engine>__datadict tests into smaller tests + generate new results.
Bug#33599 INFORMATION_SCHEMA.STATISTICS got a new column INDEX_COMMENT: tests fail (2)
Generation of new results during post merge fix
Bug#33600 CHARACTER_OCTET_LENGTH is now CHARACTER_MAXIMUM_LENGTH * 4
Generation of new results during post merge fix
Bug#33631 Platform-specific replace of CHARACTER_MAXIMUM_LENGTH broken by 4-byte encoding
Generation of new results during post merge fix
+ removal of platform-specific replace routine (no more needed)
2. Restructure the tests
- Test not more than one INFORMATION_SCHEMA view per testscript
- Separate tests of I_S view layout+functionality from content related to the
all time existing databases "information_schema", "mysql" and "test"
- Avoid storage engine related variants of tests which are not sensible to
storage engines at all.
3. Reimplement or add some subtests + cleanup
There is a some probability that even the reviewed changeset
- does not fix all bugs from above or
- contains new bugs which show up on some platforms <> Linux or on one of
the various build types
4. The changeset contains fixes according to
- one code review
- minor bugs within testing code found after code review (accepted by reviewer)
- problems found during tests with 5.0.56 in build environment
This commit is contained in:
181
mysql-test/suite/funcs_1/r/is_schemata.result
Normal file
181
mysql-test/suite/funcs_1/r/is_schemata.result
Normal file
@@ -0,0 +1,181 @@
|
||||
SHOW TABLES FROM information_schema LIKE 'SCHEMATA';
|
||||
Tables_in_information_schema (SCHEMATA)
|
||||
SCHEMATA
|
||||
#######################################################################
|
||||
# Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT
|
||||
#######################################################################
|
||||
DROP VIEW IF EXISTS test.v1;
|
||||
DROP PROCEDURE IF EXISTS test.p1;
|
||||
DROP FUNCTION IF EXISTS test.f1;
|
||||
CREATE VIEW test.v1 AS SELECT * FROM information_schema.SCHEMATA;
|
||||
CREATE PROCEDURE test.p1() SELECT * FROM information_schema.SCHEMATA;
|
||||
CREATE FUNCTION test.f1() returns BIGINT
|
||||
BEGIN
|
||||
DECLARE counter BIGINT DEFAULT NULL;
|
||||
SELECT COUNT(*) INTO counter FROM information_schema.SCHEMATA;
|
||||
RETURN counter;
|
||||
END//
|
||||
# Attention: The printing of the next result sets is disabled.
|
||||
SELECT * FROM information_schema.SCHEMATA;
|
||||
SELECT * FROM test.v1;
|
||||
CALL test.p1;
|
||||
SELECT test.f1();
|
||||
DROP VIEW test.v1;
|
||||
DROP PROCEDURE test.p1;
|
||||
DROP FUNCTION test.f1;
|
||||
#########################################################################
|
||||
# Testcase 3.2.9.1: INFORMATION_SCHEMA.SCHEMATA layout;
|
||||
#########################################################################
|
||||
DESCRIBE information_schema.SCHEMATA;
|
||||
Field Type Null Key Default Extra
|
||||
CATALOG_NAME varchar(512) YES NULL
|
||||
SCHEMA_NAME varchar(64) NO
|
||||
DEFAULT_CHARACTER_SET_NAME varchar(64) NO
|
||||
DEFAULT_COLLATION_NAME varchar(64) NO
|
||||
SQL_PATH varchar(512) YES NULL
|
||||
SHOW CREATE TABLE information_schema.SCHEMATA;
|
||||
Table Create Table
|
||||
SCHEMATA CREATE TEMPORARY TABLE `SCHEMATA` (
|
||||
`CATALOG_NAME` varchar(512) default NULL,
|
||||
`SCHEMA_NAME` varchar(64) NOT NULL default '',
|
||||
`DEFAULT_CHARACTER_SET_NAME` varchar(64) NOT NULL default '',
|
||||
`DEFAULT_COLLATION_NAME` varchar(64) NOT NULL default '',
|
||||
`SQL_PATH` varchar(512) default NULL
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=utf8
|
||||
SHOW COLUMNS FROM information_schema.SCHEMATA;
|
||||
Field Type Null Key Default Extra
|
||||
CATALOG_NAME varchar(512) YES NULL
|
||||
SCHEMA_NAME varchar(64) NO
|
||||
DEFAULT_CHARACTER_SET_NAME varchar(64) NO
|
||||
DEFAULT_COLLATION_NAME varchar(64) NO
|
||||
SQL_PATH varchar(512) YES NULL
|
||||
SELECT catalog_name, schema_name, sql_path
|
||||
FROM information_schema.schemata
|
||||
WHERE catalog_name IS NOT NULL or sql_path IS NOT NULL;
|
||||
catalog_name schema_name sql_path
|
||||
###############################################################################
|
||||
# Testcases 3.2.9.2+3.2.9.3: INFORMATION_SCHEMA.SCHEMATA accessible information
|
||||
###############################################################################
|
||||
DROP DATABASE IF EXISTS db_datadict_1;
|
||||
DROP DATABASE IF EXISTS db_datadict_2;
|
||||
CREATE DATABASE db_datadict_1;
|
||||
CREATE DATABASE db_datadict_2;
|
||||
DROP USER 'testuser1'@'localhost';
|
||||
CREATE USER 'testuser1'@'localhost';
|
||||
DROP USER 'testuser2'@'localhost';
|
||||
CREATE USER 'testuser2'@'localhost';
|
||||
DROP USER 'testuser3'@'localhost';
|
||||
CREATE USER 'testuser3'@'localhost';
|
||||
GRANT SELECT ON db_datadict_1.* to 'testuser1'@'localhost';
|
||||
GRANT SELECT ON db_datadict_1.* to 'testuser2'@'localhost';
|
||||
GRANT SELECT ON db_datadict_2.* to 'testuser2'@'localhost';
|
||||
SELECT * FROM information_schema.schemata
|
||||
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
|
||||
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
|
||||
NULL db_datadict_1 latin1 latin1_swedish_ci NULL
|
||||
NULL db_datadict_2 latin1 latin1_swedish_ci NULL
|
||||
SHOW DATABASES LIKE 'db_datadict_%';
|
||||
Database (db_datadict_%)
|
||||
db_datadict_1
|
||||
db_datadict_2
|
||||
# Establish connection testuser1 (user=testuser1)
|
||||
SELECT * FROM information_schema.schemata
|
||||
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
|
||||
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
|
||||
NULL db_datadict_1 latin1 latin1_swedish_ci NULL
|
||||
SHOW DATABASES LIKE 'db_datadict_%';
|
||||
Database (db_datadict_%)
|
||||
db_datadict_1
|
||||
# Establish connection testuser2 (user=testuser2)
|
||||
SELECT * FROM information_schema.schemata
|
||||
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
|
||||
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
|
||||
NULL db_datadict_1 latin1 latin1_swedish_ci NULL
|
||||
NULL db_datadict_2 latin1 latin1_swedish_ci NULL
|
||||
SHOW DATABASES LIKE 'db_datadict_%';
|
||||
Database (db_datadict_%)
|
||||
db_datadict_1
|
||||
db_datadict_2
|
||||
# Establish connection testuser3 (user=testuser3)
|
||||
SELECT * FROM information_schema.schemata
|
||||
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
|
||||
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
|
||||
SHOW DATABASES LIKE 'db_datadict_%';
|
||||
Database (db_datadict_%)
|
||||
# Switch to connection default and close connections testuser1,testuser2,testuser3
|
||||
DROP USER 'testuser1'@'localhost';
|
||||
DROP USER 'testuser2'@'localhost';
|
||||
DROP USER 'testuser3'@'localhost';
|
||||
DROP DATABASE db_datadict_1;
|
||||
DROP DATABASE db_datadict_2;
|
||||
#################################################################################
|
||||
# Testcases 3.2.1.13+3.2.1.14+3.2.1.15: INFORMATION_SCHEMA.SCHEMATA modifications
|
||||
#################################################################################
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
SELECT * FROM information_schema.schemata WHERE schema_name = 'db_datadict';
|
||||
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
|
||||
CREATE DATABASE db_datadict CHARACTER SET 'latin1' COLLATE 'latin1_swedish_ci';
|
||||
SELECT * FROM information_schema.schemata WHERE schema_name = 'db_datadict';
|
||||
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
|
||||
NULL db_datadict latin1 latin1_swedish_ci NULL
|
||||
SELECT schema_name, default_character_set_name
|
||||
FROM information_schema.schemata WHERE schema_name = 'db_datadict';
|
||||
schema_name default_character_set_name
|
||||
db_datadict latin1
|
||||
ALTER SCHEMA db_datadict CHARACTER SET 'utf8';
|
||||
SELECT schema_name, default_character_set_name
|
||||
FROM information_schema.schemata WHERE schema_name = 'db_datadict';
|
||||
schema_name default_character_set_name
|
||||
db_datadict utf8
|
||||
ALTER SCHEMA db_datadict CHARACTER SET 'latin1';
|
||||
SELECT schema_name, default_collation_name FROM information_schema.schemata
|
||||
WHERE schema_name = 'db_datadict';
|
||||
schema_name default_collation_name
|
||||
db_datadict latin1_swedish_ci
|
||||
ALTER SCHEMA db_datadict COLLATE 'latin1_general_cs';
|
||||
SELECT schema_name, default_collation_name FROM information_schema.schemata
|
||||
WHERE schema_name = 'db_datadict';
|
||||
schema_name default_collation_name
|
||||
db_datadict latin1_general_cs
|
||||
SELECT schema_name
|
||||
FROM information_schema.schemata WHERE schema_name = 'db_datadict';
|
||||
schema_name
|
||||
db_datadict
|
||||
DROP DATABASE db_datadict;
|
||||
SELECT schema_name
|
||||
FROM information_schema.schemata WHERE schema_name = 'db_datadict';
|
||||
schema_name
|
||||
########################################################################
|
||||
# Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and
|
||||
# DDL on INFORMATION_SCHEMA tables are not supported
|
||||
########################################################################
|
||||
DROP DATABASE IF EXISTS db_datadict;
|
||||
CREATE DATABASE db_datadict CHARACTER SET 'latin1' COLLATE 'latin1_swedish_ci';
|
||||
INSERT INTO information_schema.schemata
|
||||
(catalog_name, schema_name, default_character_set_name, sql_path)
|
||||
VALUES (NULL, 'db1', 'latin1', NULL);
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
INSERT INTO information_schema.schemata
|
||||
SELECT * FROM information_schema.schemata;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
UPDATE information_schema.schemata
|
||||
SET default_character_set_name = 'utf8'
|
||||
WHERE schema_name = 'db_datadict';
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
UPDATE information_schema.schemata SET catalog_name = 't_4711';
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
DELETE FROM information_schema.schemata WHERE schema_name = 'db_datadict';
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
TRUNCATE information_schema.schemata;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
CREATE INDEX i1 ON information_schema.schemata(schema_name);
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
ALTER TABLE information_schema.schemata ADD f1 INT;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
DROP TABLE information_schema.schemata;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
ALTER TABLE information_schema.schemata RENAME db_datadict.schemata;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
ALTER TABLE information_schema.schemata RENAME information_schema.xschemata;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
DROP DATABASE db_datadict;
|
||||
Reference in New Issue
Block a user