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
|
# Drizzle's data dictionary.
CREATE SCHEMA data_dictionary;
use data_dictionary;
--replace_column 1 #
SELECT count(*) FROM columns;
--replace_column 1 #
SELECT count(*) FROM indexes;
--replace_column 1 #
SELECT count(*) FROM index_parts;
--replace_column 1 #
SELECT SCHEMA_NAME FROM schemas;
--replace_column 1 #
SELECT COLUMN_NAME FROM columns;
--replace_column 1 #
SELECT count(*) FROM REFERENTIAL_CONSTRAINTS;
--replace_column 1 #
SELECT count(*) FROM TABLE_CONSTRAINTS;
# Make sure we don't change the names of the columns
show create table COLUMNS ;
show create table INDEXES ;
show create table INDEX_PARTS ;
show create table LOCAL_TABLE_NAMES;
show create table REFERENTIAL_CONSTRAINTS ;
show create table SCHEMAS ;
show create table SCHEMA_NAMES;
show create table TABLES ;
show create table TABLE_CONSTRAINTS ;
# Test the behavior of LOCAL_TABLE_NAMES
select * from LOCAL_TABLE_NAMES;
# Test that the data dictionary is not leaking its tables to other schema
CREATE SCHEMA A;
use A;
create table A (a int);
SELECT COUNT(*) FROM data_dictionary.tables WHERE TABLE_NAME = "A";
# Test the behavior of LOCAL_TABLE_NAMES
select * from data_dictionary.LOCAL_TABLE_NAMES;
DROP SCHEMA A;
DROP SCHEMA data_dictionary;
|