commit
ec394d06e6
@ -0,0 +1,8 @@
|
|||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# 基于编辑器的 HTTP 客户端请求
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile default="true" name="Default" enabled="true" />
|
||||||
|
<profile name="Maven default annotation processors profile" enabled="true">
|
||||||
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<module name="api" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
<bytecodeTargetLevel>
|
||||||
|
<module name="WarehouseManagerApi" target="1.8" />
|
||||||
|
</bytecodeTargetLevel>
|
||||||
|
</component>
|
||||||
|
<component name="JavacSettings">
|
||||||
|
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||||
|
<module name="api" options="-parameters" />
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
|
<data-source source="LOCAL" name="@localhost" uuid="c80a8019-ae91-4f45-9de5-d155d472a75d">
|
||||||
|
<driver-ref>mysql.8</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:mysql://localhost:3306</jdbc-url>
|
||||||
|
<jdbc-additional-properties>
|
||||||
|
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||||
|
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||||
|
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||||
|
</jdbc-additional-properties>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/IDEA/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/IDEA/src/main/resources" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Maven Central repository" />
|
||||||
|
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="jboss.community" />
|
||||||
|
<option name="name" value="JBoss Community repository" />
|
||||||
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
|
</remote-repository>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,13 @@
|
|||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/IDEA/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/RoundtableLogistics.iml" filepath="$PROJECT_DIR$/.idea/RoundtableLogistics.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="SqlDialectMappings">
|
||||||
|
<file url="file://$PROJECT_DIR$/IDEA/wmsadmin.sql" dialect="MySQL" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,35 @@
|
|||||||
|
HELP.md
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.DS_Store
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
@ -0,0 +1,13 @@
|
|||||||
|
create view information_schema.ADMINISTRABLE_ROLE_AUTHORIZATIONS as
|
||||||
|
select `information_schema`.`applicable_roles`.`USER` AS `USER`,
|
||||||
|
`information_schema`.`applicable_roles`.`HOST` AS `HOST`,
|
||||||
|
`information_schema`.`applicable_roles`.`GRANTEE` AS `GRANTEE`,
|
||||||
|
`information_schema`.`applicable_roles`.`GRANTEE_HOST` AS `GRANTEE_HOST`,
|
||||||
|
`information_schema`.`applicable_roles`.`ROLE_NAME` AS `ROLE_NAME`,
|
||||||
|
`information_schema`.`applicable_roles`.`ROLE_HOST` AS `ROLE_HOST`,
|
||||||
|
`information_schema`.`applicable_roles`.`IS_GRANTABLE` AS `IS_GRANTABLE`,
|
||||||
|
`information_schema`.`applicable_roles`.`IS_DEFAULT` AS `IS_DEFAULT`,
|
||||||
|
`information_schema`.`applicable_roles`.`IS_MANDATORY` AS `IS_MANDATORY`
|
||||||
|
from `information_schema`.`APPLICABLE_ROLES`
|
||||||
|
where (`information_schema`.`applicable_roles`.`IS_GRANTABLE` = 'YES');
|
||||||
|
|
@ -0,0 +1,80 @@
|
|||||||
|
create view information_schema.APPLICABLE_ROLES as
|
||||||
|
with recursive `role_graph` (`c_parent_user`, `c_parent_host`, `c_from_user`, `c_from_host`, `c_to_user`, `c_to_host`,
|
||||||
|
`role_path`, `c_with_admin`, `c_enabled`)
|
||||||
|
as (select internal_get_username() AS `INTERNAL_GET_USERNAME()`,
|
||||||
|
internal_get_hostname() AS `INTERNAL_GET_HOSTNAME()`,
|
||||||
|
internal_get_username() AS `INTERNAL_GET_USERNAME()`,
|
||||||
|
internal_get_hostname() AS `INTERNAL_GET_HOSTNAME()`,
|
||||||
|
cast('' as char(64) charset utf8mb4) AS `CAST('' as CHAR(64) CHARSET utf8mb4)`,
|
||||||
|
cast('' as char(255) charset utf8mb4) AS `CAST('' as CHAR(255) CHARSET utf8mb4)`,
|
||||||
|
cast(sha2(concat(quote(internal_get_username()), '@', quote(internal_get_hostname())),
|
||||||
|
256) as char(17000) charset utf8mb4) AS `CAST(SHA2(CONCAT(QUOTE(INTERNAL_GET_USERNAME()),'@', QUOTE(INTERNAL_GET_HOSTNAME())), 256) AS CHAR(17000) CHARSET utf8mb4)`,
|
||||||
|
cast('N' as char(1) charset utf8mb4) AS `CAST('N' as CHAR(1) CHARSET utf8mb4)`,
|
||||||
|
false AS `FALSE`
|
||||||
|
union
|
||||||
|
select internal_get_username() AS `INTERNAL_GET_USERNAME()`,
|
||||||
|
internal_get_hostname() AS `INTERNAL_GET_HOSTNAME()`,
|
||||||
|
`mandatory_roles`.`ROLE_NAME` AS `ROLE_NAME`,
|
||||||
|
`mandatory_roles`.`ROLE_HOST` AS `ROLE_HOST`,
|
||||||
|
internal_get_username() AS `INTERNAL_GET_USERNAME()`,
|
||||||
|
internal_get_hostname() AS `INTERNAL_GET_HOSTNAME()`,
|
||||||
|
cast(sha2(concat(quote(`mandatory_roles`.`ROLE_NAME`), '@',
|
||||||
|
convert(quote(`mandatory_roles`.`ROLE_HOST`) using utf8mb4)),
|
||||||
|
256) as char(17000) charset utf8mb4) AS `CAST(SHA2(CONCAT(QUOTE(ROLE_NAME),'@', CONVERT(QUOTE(ROLE_HOST) using utf8mb4)), 256) AS CHAR(17000) CHARSET utf8mb4)`,
|
||||||
|
cast('N' as char(1) charset utf8mb4) AS `CAST('N' as CHAR(1) CHARSET utf8mb4)`,
|
||||||
|
false AS `FALSE`
|
||||||
|
from json_table(internal_get_mandatory_roles_json(), '$[*]'
|
||||||
|
columns (`ROLE_NAME` varchar(255) character set utf8mb4 path '$.ROLE_NAME', `ROLE_HOST` varchar(255) character set utf8mb4 path '$.ROLE_HOST')) `mandatory_roles`
|
||||||
|
where concat(quote(`mandatory_roles`.`ROLE_NAME`), '@',
|
||||||
|
convert(quote(`mandatory_roles`.`ROLE_HOST`) using utf8mb4)) in
|
||||||
|
(select concat(convert(quote(`mysql`.`role_edges`.`FROM_USER`) using utf8mb4), '@',
|
||||||
|
convert(quote(`mysql`.`role_edges`.`FROM_HOST`) using utf8mb4))
|
||||||
|
from `mysql`.`role_edges`
|
||||||
|
where ((`mysql`.`role_edges`.`TO_USER` = internal_get_username()) and
|
||||||
|
(convert(`mysql`.`role_edges`.`TO_HOST` using utf8mb4) =
|
||||||
|
convert(internal_get_hostname() using utf8mb4)))) is false
|
||||||
|
union
|
||||||
|
select `role_graph`.`c_parent_user` AS `c_parent_user`,
|
||||||
|
`role_graph`.`c_parent_host` AS `c_parent_host`,
|
||||||
|
`mysql`.`role_edges`.`FROM_USER` AS `FROM_USER`,
|
||||||
|
`mysql`.`role_edges`.`FROM_HOST` AS `FROM_HOST`,
|
||||||
|
`mysql`.`role_edges`.`TO_USER` AS `TO_USER`,
|
||||||
|
`mysql`.`role_edges`.`TO_HOST` AS `TO_HOST`,
|
||||||
|
if((locate(sha2(concat(convert(quote(`mysql`.`role_edges`.`FROM_USER`) using utf8mb4),
|
||||||
|
'@',
|
||||||
|
convert(quote(`mysql`.`role_edges`.`FROM_HOST`) using utf8mb4)),
|
||||||
|
256), `role_graph`.`role_path`) = 0),
|
||||||
|
concat(`role_graph`.`role_path`, '->', convert(sha2(concat(
|
||||||
|
convert(quote(`mysql`.`role_edges`.`FROM_USER`) using utf8mb4),
|
||||||
|
'@',
|
||||||
|
convert(quote(`mysql`.`role_edges`.`FROM_HOST`) using utf8mb4)),
|
||||||
|
256) using utf8mb4)),
|
||||||
|
NULL) AS `IF(LOCATE(SHA2(CONCAT(QUOTE(FROM_USER),'@', CONVERT(QUOTE(FROM_HOST) using utf8mb4)), 256), role_path) = 0, CONCAT(role_path,'->', SHA2(CONCAT(QUOTE(FROM_USER),'@', CONVERT(QUOTE(FROM_HOST) using utf8`,
|
||||||
|
`mysql`.`role_edges`.`WITH_ADMIN_OPTION` AS `WITH_ADMIN_OPTION`,
|
||||||
|
if(((0 <> `role_graph`.`c_enabled`) or (0 <> internal_is_enabled_role(
|
||||||
|
`mysql`.`role_edges`.`FROM_USER`, `mysql`.`role_edges`.`FROM_HOST`))), true,
|
||||||
|
false) AS `IF(c_enabled OR INTERNAL_IS_ENABLED_ROLE(FROM_USER, FROM_HOST), TRUE, FALSE)`
|
||||||
|
from (`mysql`.`role_edges` join `role_graph`)
|
||||||
|
where ((`mysql`.`role_edges`.`TO_USER` = `role_graph`.`c_from_user`) and
|
||||||
|
(convert(`mysql`.`role_edges`.`TO_HOST` using utf8mb4) = `role_graph`.`c_from_host`) and
|
||||||
|
(`role_graph`.`role_path` is not null)))
|
||||||
|
select distinct `role_graph`.`c_parent_user` AS `USER`,
|
||||||
|
`role_graph`.`c_parent_host` AS `HOST`,
|
||||||
|
`role_graph`.`c_to_user` AS `GRANTEE`,
|
||||||
|
`role_graph`.`c_to_host` AS `GRANTEE_HOST`,
|
||||||
|
`role_graph`.`c_from_user` AS `ROLE_NAME`,
|
||||||
|
`role_graph`.`c_from_host` AS `ROLE_HOST`,
|
||||||
|
if((`role_graph`.`c_with_admin` = 'N'), 'NO', 'YES') AS `IS_GRANTABLE`,
|
||||||
|
(select if(count(0), 'YES', 'NO')
|
||||||
|
from `mysql`.`default_roles`
|
||||||
|
where ((`mysql`.`default_roles`.`DEFAULT_ROLE_USER` = `role_graph`.`c_from_user`) and
|
||||||
|
(convert(`mysql`.`default_roles`.`DEFAULT_ROLE_HOST` using utf8mb4) =
|
||||||
|
`role_graph`.`c_from_host`) and
|
||||||
|
(`mysql`.`default_roles`.`USER` = `role_graph`.`c_parent_user`) and
|
||||||
|
(convert(`mysql`.`default_roles`.`HOST` using utf8mb4) =
|
||||||
|
`role_graph`.`c_parent_host`))) AS `IS_DEFAULT`,
|
||||||
|
if(internal_is_mandatory_role(`role_graph`.`c_from_user`, `role_graph`.`c_from_host`), 'YES',
|
||||||
|
'NO') AS `IS_MANDATORY`
|
||||||
|
from `role_graph`
|
||||||
|
where (`role_graph`.`c_to_user` <> '');
|
||||||
|
|
@ -0,0 +1,7 @@
|
|||||||
|
create view information_schema.CHARACTER_SETS as
|
||||||
|
select `cs`.`name` AS `CHARACTER_SET_NAME`,
|
||||||
|
`col`.`name` AS `DEFAULT_COLLATE_NAME`,
|
||||||
|
`cs`.`comment` AS `DESCRIPTION`,
|
||||||
|
`cs`.`mb_max_length` AS `MAXLEN`
|
||||||
|
from (`mysql`.`character_sets` `cs` join `mysql`.`collations` `col` on ((`cs`.`default_collation_id` = `col`.`id`)));
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
create view information_schema.CHECK_CONSTRAINTS as
|
||||||
|
select (`cat`.`name` collate utf8mb3_tolower_ci) AS `CONSTRAINT_CATALOG`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `CONSTRAINT_SCHEMA`,
|
||||||
|
`cc`.`name` AS `CONSTRAINT_NAME`,
|
||||||
|
`cc`.`check_clause_utf8` AS `CHECK_CLAUSE`
|
||||||
|
from (((`mysql`.`check_constraints` `cc` join `mysql`.`tables` `tbl`
|
||||||
|
on ((`cc`.`table_id` = `tbl`.`id`))) join `mysql`.`schemata` `sch`
|
||||||
|
on ((`tbl`.`schema_id` = `sch`.`id`))) join `mysql`.`catalogs` `cat` on ((`cat`.`id` = `sch`.`catalog_id`)))
|
||||||
|
where ((0 <> can_access_table(`sch`.`name`, `tbl`.`name`)) and (0 <> is_visible_dd_object(`tbl`.`hidden`)));
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
create view information_schema.COLLATIONS as
|
||||||
|
select `col`.`name` AS `COLLATION_NAME`,
|
||||||
|
`cs`.`name` AS `CHARACTER_SET_NAME`,
|
||||||
|
`col`.`id` AS `ID`,
|
||||||
|
if(exists(select 1
|
||||||
|
from `mysql`.`character_sets`
|
||||||
|
where (`mysql`.`character_sets`.`default_collation_id` = `col`.`id`)), 'Yes', '') AS `IS_DEFAULT`,
|
||||||
|
if(`col`.`is_compiled`, 'Yes', '') AS `IS_COMPILED`,
|
||||||
|
`col`.`sort_length` AS `SORTLEN`,
|
||||||
|
`col`.`pad_attribute` AS `PAD_ATTRIBUTE`
|
||||||
|
from (`mysql`.`collations` `col` join `mysql`.`character_sets` `cs` on ((`col`.`character_set_id` = `cs`.`id`)));
|
||||||
|
|
@ -0,0 +1,4 @@
|
|||||||
|
create view information_schema.COLLATION_CHARACTER_SET_APPLICABILITY as
|
||||||
|
select `col`.`name` AS `COLLATION_NAME`, `cs`.`name` AS `CHARACTER_SET_NAME`
|
||||||
|
from (`mysql`.`character_sets` `cs` join `mysql`.`collations` `col` on ((`cs`.`id` = `col`.`character_set_id`)));
|
||||||
|
|
@ -0,0 +1,60 @@
|
|||||||
|
create view information_schema.COLUMNS as
|
||||||
|
select (`cat`.`name` collate utf8mb3_tolower_ci) AS `TABLE_CATALOG`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `TABLE_SCHEMA`,
|
||||||
|
(`tbl`.`name` collate utf8mb3_tolower_ci) AS `TABLE_NAME`,
|
||||||
|
(`col`.`name` collate utf8mb3_tolower_ci) AS `COLUMN_NAME`,
|
||||||
|
`col`.`ordinal_position` AS `ORDINAL_POSITION`,
|
||||||
|
`col`.`default_value_utf8` AS `COLUMN_DEFAULT`,
|
||||||
|
if((`col`.`is_nullable` = 1), 'YES', 'NO') AS `IS_NULLABLE`,
|
||||||
|
substring_index(substring_index(`col`.`column_type_utf8`, '(', 1), ' ',
|
||||||
|
1) AS `DATA_TYPE`,
|
||||||
|
internal_dd_char_length(`col`.`type`, `col`.`char_length`, `coll`.`name`,
|
||||||
|
0) AS `CHARACTER_MAXIMUM_LENGTH`,
|
||||||
|
internal_dd_char_length(`col`.`type`, `col`.`char_length`, `coll`.`name`,
|
||||||
|
1) AS `CHARACTER_OCTET_LENGTH`,
|
||||||
|
if((`col`.`numeric_precision` = 0), NULL, `col`.`numeric_precision`) AS `NUMERIC_PRECISION`,
|
||||||
|
if(((`col`.`numeric_scale` = 0) and (`col`.`numeric_precision` = 0)), NULL,
|
||||||
|
`col`.`numeric_scale`) AS `NUMERIC_SCALE`,
|
||||||
|
`col`.`datetime_precision` AS `DATETIME_PRECISION`,
|
||||||
|
(case `col`.`type`
|
||||||
|
when 'MYSQL_TYPE_STRING' then if((`cs`.`name` = 'binary'), NULL, `cs`.`name`)
|
||||||
|
when 'MYSQL_TYPE_VAR_STRING' then if((`cs`.`name` = 'binary'), NULL, `cs`.`name`)
|
||||||
|
when 'MYSQL_TYPE_VARCHAR' then if((`cs`.`name` = 'binary'), NULL, `cs`.`name`)
|
||||||
|
when 'MYSQL_TYPE_TINY_BLOB' then if((`cs`.`name` = 'binary'), NULL, `cs`.`name`)
|
||||||
|
when 'MYSQL_TYPE_MEDIUM_BLOB' then if((`cs`.`name` = 'binary'), NULL, `cs`.`name`)
|
||||||
|
when 'MYSQL_TYPE_BLOB' then if((`cs`.`name` = 'binary'), NULL, `cs`.`name`)
|
||||||
|
when 'MYSQL_TYPE_LONG_BLOB' then if((`cs`.`name` = 'binary'), NULL, `cs`.`name`)
|
||||||
|
when 'MYSQL_TYPE_ENUM' then if((`cs`.`name` = 'binary'), NULL, `cs`.`name`)
|
||||||
|
when 'MYSQL_TYPE_SET' then if((`cs`.`name` = 'binary'), NULL, `cs`.`name`)
|
||||||
|
else NULL end) AS `CHARACTER_SET_NAME`,
|
||||||
|
(case `col`.`type`
|
||||||
|
when 'MYSQL_TYPE_STRING' then if((`cs`.`name` = 'binary'), NULL, `coll`.`name`)
|
||||||
|
when 'MYSQL_TYPE_VAR_STRING' then if((`cs`.`name` = 'binary'), NULL, `coll`.`name`)
|
||||||
|
when 'MYSQL_TYPE_VARCHAR' then if((`cs`.`name` = 'binary'), NULL, `coll`.`name`)
|
||||||
|
when 'MYSQL_TYPE_TINY_BLOB' then if((`cs`.`name` = 'binary'), NULL, `coll`.`name`)
|
||||||
|
when 'MYSQL_TYPE_MEDIUM_BLOB' then if((`cs`.`name` = 'binary'), NULL, `coll`.`name`)
|
||||||
|
when 'MYSQL_TYPE_BLOB' then if((`cs`.`name` = 'binary'), NULL, `coll`.`name`)
|
||||||
|
when 'MYSQL_TYPE_LONG_BLOB' then if((`cs`.`name` = 'binary'), NULL, `coll`.`name`)
|
||||||
|
when 'MYSQL_TYPE_ENUM' then if((`cs`.`name` = 'binary'), NULL, `coll`.`name`)
|
||||||
|
when 'MYSQL_TYPE_SET' then if((`cs`.`name` = 'binary'), NULL, `coll`.`name`)
|
||||||
|
else NULL end) AS `COLLATION_NAME`,
|
||||||
|
`col`.`column_type_utf8` AS `COLUMN_TYPE`,
|
||||||
|
`col`.`column_key` AS `COLUMN_KEY`,
|
||||||
|
internal_get_dd_column_extra((`col`.`generation_expression_utf8` is null), `col`.`is_virtual`,
|
||||||
|
`col`.`is_auto_increment`, `col`.`update_option`,
|
||||||
|
if(length(`col`.`default_option`), true, false), `col`.`options`, `col`.`hidden`,
|
||||||
|
`tbl`.`type`) AS `EXTRA`,
|
||||||
|
get_dd_column_privileges(`sch`.`name`, `tbl`.`name`, `col`.`name`) AS `PRIVILEGES`,
|
||||||
|
ifnull(`col`.`comment`, '') AS `COLUMN_COMMENT`,
|
||||||
|
ifnull(`col`.`generation_expression_utf8`, '') AS `GENERATION_EXPRESSION`,
|
||||||
|
`col`.`srs_id` AS `SRS_ID`
|
||||||
|
from (((((`mysql`.`columns` `col` join `mysql`.`tables` `tbl`
|
||||||
|
on ((`col`.`table_id` = `tbl`.`id`))) join `mysql`.`schemata` `sch`
|
||||||
|
on ((`tbl`.`schema_id` = `sch`.`id`))) join `mysql`.`catalogs` `cat`
|
||||||
|
on ((`cat`.`id` = `sch`.`catalog_id`))) join `mysql`.`collations` `coll`
|
||||||
|
on ((`col`.`collation_id` = `coll`.`id`))) join `mysql`.`character_sets` `cs`
|
||||||
|
on ((`coll`.`character_set_id` = `cs`.`id`)))
|
||||||
|
where ((0 <> internal_get_view_warning_or_error(`sch`.`name`, `tbl`.`name`, `tbl`.`type`, `tbl`.`options`)) and
|
||||||
|
(0 <> can_access_column(`sch`.`name`, `tbl`.`name`, `col`.`name`)) and
|
||||||
|
(0 <> is_visible_dd_object(`tbl`.`hidden`, (`col`.`hidden` not in ('Visible', 'User')), `col`.`options`)));
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
create view information_schema.COLUMNS_EXTENSIONS as
|
||||||
|
select `cat`.`name` AS `TABLE_CATALOG`,
|
||||||
|
`sch`.`name` AS `TABLE_SCHEMA`,
|
||||||
|
`tbl`.`name` AS `TABLE_NAME`,
|
||||||
|
(`col`.`name` collate utf8mb3_tolower_ci) AS `COLUMN_NAME`,
|
||||||
|
`col`.`engine_attribute` AS `ENGINE_ATTRIBUTE`,
|
||||||
|
`col`.`secondary_engine_attribute` AS `SECONDARY_ENGINE_ATTRIBUTE`
|
||||||
|
from (((`mysql`.`columns` `col` join `mysql`.`tables` `tbl`
|
||||||
|
on ((`col`.`table_id` = `tbl`.`id`))) join `mysql`.`schemata` `sch`
|
||||||
|
on ((`tbl`.`schema_id` = `sch`.`id`))) join `mysql`.`catalogs` `cat` on ((`cat`.`id` = `sch`.`catalog_id`)))
|
||||||
|
where ((0 <> internal_get_view_warning_or_error(`sch`.`name`, `tbl`.`name`, `tbl`.`type`, `tbl`.`options`)) and
|
||||||
|
(0 <> can_access_column(`sch`.`name`, `tbl`.`name`, `col`.`name`)) and
|
||||||
|
(0 <> is_visible_dd_object(`tbl`.`hidden`, (`col`.`hidden` not in ('Visible', 'User')), `col`.`options`)));
|
||||||
|
|
@ -0,0 +1,8 @@
|
|||||||
|
create view information_schema.COLUMN_STATISTICS as
|
||||||
|
select `mysql`.`column_statistics`.`schema_name` AS `SCHEMA_NAME`,
|
||||||
|
`mysql`.`column_statistics`.`table_name` AS `TABLE_NAME`,
|
||||||
|
`mysql`.`column_statistics`.`column_name` AS `COLUMN_NAME`,
|
||||||
|
`mysql`.`column_statistics`.`histogram` AS `HISTOGRAM`
|
||||||
|
from `mysql`.`column_statistics`
|
||||||
|
where (0 <> can_access_table(`mysql`.`column_statistics`.`schema_name`, `mysql`.`column_statistics`.`table_name`));
|
||||||
|
|
@ -0,0 +1,16 @@
|
|||||||
|
create view information_schema.ENABLED_ROLES as
|
||||||
|
select `current_user_enabled_roles`.`ROLE_NAME` AS `ROLE_NAME`,
|
||||||
|
`current_user_enabled_roles`.`ROLE_HOST` AS `ROLE_HOST`,
|
||||||
|
(select if(count(0), 'YES', 'NO')
|
||||||
|
from `mysql`.`default_roles`
|
||||||
|
where ((`mysql`.`default_roles`.`DEFAULT_ROLE_USER` = `current_user_enabled_roles`.`ROLE_NAME`) and
|
||||||
|
(convert(`mysql`.`default_roles`.`DEFAULT_ROLE_HOST` using utf8mb4) =
|
||||||
|
`current_user_enabled_roles`.`ROLE_HOST`) and
|
||||||
|
(`mysql`.`default_roles`.`USER` = internal_get_username()) and
|
||||||
|
(convert(`mysql`.`default_roles`.`HOST` using utf8mb4) =
|
||||||
|
convert(internal_get_hostname() using utf8mb4)))) AS `IS_DEFAULT`,
|
||||||
|
if(internal_is_mandatory_role(`current_user_enabled_roles`.`ROLE_NAME`,
|
||||||
|
`current_user_enabled_roles`.`ROLE_HOST`), 'YES', 'NO') AS `IS_MANDATORY`
|
||||||
|
from json_table(internal_get_enabled_role_json(), '$[*]'
|
||||||
|
columns (`ROLE_NAME` varchar(255) character set utf8mb4 path '$.ROLE_NAME', `ROLE_HOST` varchar(255) character set utf8mb4 path '$.ROLE_HOST')) `current_user_enabled_roles`;
|
||||||
|
|
@ -0,0 +1,34 @@
|
|||||||
|
create view information_schema.EVENTS as
|
||||||
|
select (`cat`.`name` collate utf8mb3_tolower_ci) AS `EVENT_CATALOG`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `EVENT_SCHEMA`,
|
||||||
|
`evt`.`name` AS `EVENT_NAME`,
|
||||||
|
`evt`.`definer` AS `DEFINER`,
|
||||||
|
`evt`.`time_zone` AS `TIME_ZONE`,
|
||||||
|
'SQL' AS `EVENT_BODY`,
|
||||||
|
`evt`.`definition_utf8` AS `EVENT_DEFINITION`,
|
||||||
|
if((`evt`.`interval_value` is null), 'ONE TIME', 'RECURRING') AS `EVENT_TYPE`,
|
||||||
|
convert_tz(`evt`.`execute_at`, '+00:00', `evt`.`time_zone`) AS `EXECUTE_AT`,
|
||||||
|
convert_interval_to_user_interval(`evt`.`interval_value`, `evt`.`interval_field`) AS `INTERVAL_VALUE`,
|
||||||
|
`evt`.`interval_field` AS `INTERVAL_FIELD`,
|
||||||
|
`evt`.`sql_mode` AS `SQL_MODE`,
|
||||||
|
convert_tz(`evt`.`starts`, '+00:00', `evt`.`time_zone`) AS `STARTS`,
|
||||||
|
convert_tz(`evt`.`ends`, '+00:00', `evt`.`time_zone`) AS `ENDS`,
|
||||||
|
`evt`.`status` AS `STATUS`,
|
||||||
|
if((`evt`.`on_completion` = 'DROP'), 'NOT PRESERVE', 'PRESERVE') AS `ON_COMPLETION`,
|
||||||
|
`evt`.`created` AS `CREATED`,
|
||||||
|
`evt`.`last_altered` AS `LAST_ALTERED`,
|
||||||
|
convert_tz(`evt`.`last_executed`, '+00:00', `evt`.`time_zone`) AS `LAST_EXECUTED`,
|
||||||
|
`evt`.`comment` AS `EVENT_COMMENT`,
|
||||||
|
`evt`.`originator` AS `ORIGINATOR`,
|
||||||
|
`cs_client`.`name` AS `CHARACTER_SET_CLIENT`,
|
||||||
|
`coll_conn`.`name` AS `COLLATION_CONNECTION`,
|
||||||
|
`coll_db`.`name` AS `DATABASE_COLLATION`
|
||||||
|
from ((((((`mysql`.`events` `evt` join `mysql`.`schemata` `sch`
|
||||||
|
on ((`evt`.`schema_id` = `sch`.`id`))) join `mysql`.`catalogs` `cat`
|
||||||
|
on ((`cat`.`id` = `sch`.`catalog_id`))) join `mysql`.`collations` `coll_client`
|
||||||
|
on ((`coll_client`.`id` = `evt`.`client_collation_id`))) join `mysql`.`character_sets` `cs_client`
|
||||||
|
on ((`cs_client`.`id` = `coll_client`.`character_set_id`))) join `mysql`.`collations` `coll_conn`
|
||||||
|
on ((`coll_conn`.`id` = `evt`.`connection_collation_id`))) join `mysql`.`collations` `coll_db`
|
||||||
|
on ((`coll_db`.`id` = `evt`.`schema_collation_id`)))
|
||||||
|
where (0 <> can_access_event(`sch`.`name`));
|
||||||
|
|
@ -0,0 +1,57 @@
|
|||||||
|
create view information_schema.FILES as
|
||||||
|
select internal_tablespace_id(`ts`.`name`, `tsf`.`file_name`, `ts`.`engine`, `ts`.`se_private_data`) AS `FILE_ID`,
|
||||||
|
replace(if(((locate(left(`tsf`.`file_name`, 1), './') = 0) and (substr(`tsf`.`file_name`, 2, 1) <> ':')),
|
||||||
|
concat('./', `tsf`.`file_name`), `tsf`.`file_name`), '\\',
|
||||||
|
'/') AS `FILE_NAME`,
|
||||||
|
internal_tablespace_type(`ts`.`name`, `tsf`.`file_name`, `ts`.`engine`,
|
||||||
|
`ts`.`se_private_data`) AS `FILE_TYPE`,
|
||||||
|
`ts`.`name` AS `TABLESPACE_NAME`,
|
||||||
|
'' AS `TABLE_CATALOG`,
|
||||||
|
NULL AS `TABLE_SCHEMA`,
|
||||||
|
NULL AS `TABLE_NAME`,
|
||||||
|
internal_tablespace_logfile_group_name(`ts`.`name`, `tsf`.`file_name`, `ts`.`engine`,
|
||||||
|
`ts`.`se_private_data`) AS `LOGFILE_GROUP_NAME`,
|
||||||
|
internal_tablespace_logfile_group_number(`ts`.`name`, `tsf`.`file_name`, `ts`.`engine`,
|
||||||
|
`ts`.`se_private_data`) AS `LOGFILE_GROUP_NUMBER`,
|
||||||
|
`ts`.`engine` AS `ENGINE`,
|
||||||
|
NULL AS `FULLTEXT_KEYS`,
|
||||||
|
NULL AS `DELETED_ROWS`,
|
||||||
|
NULL AS `UPDATE_COUNT`,
|
||||||
|
internal_tablespace_free_extents(`ts`.`name`, `tsf`.`file_name`, `ts`.`engine`,
|
||||||
|
`ts`.`se_private_data`) AS `FREE_EXTENTS`,
|
||||||
|
internal_tablespace_total_extents(`ts`.`name`, `tsf`.`file_name`, `ts`.`engine`,
|
||||||
|
`ts`.`se_private_data`) AS `TOTAL_EXTENTS`,
|
||||||
|
internal_tablespace_extent_size(`ts`.`name`, `tsf`.`file_name`, `ts`.`engine`,
|
||||||
|
`ts`.`se_private_data`) AS `EXTENT_SIZE`,
|
||||||
|
internal_tablespace_initial_size(`ts`.`name`, `tsf`.`file_name`, `ts`.`engine`,
|
||||||
|
`ts`.`se_private_data`) AS `INITIAL_SIZE`,
|
||||||
|
internal_tablespace_maximum_size(`ts`.`name`, `tsf`.`file_name`, `ts`.`engine`,
|
||||||
|
`ts`.`se_private_data`) AS `MAXIMUM_SIZE`,
|
||||||
|
internal_tablespace_autoextend_size(`ts`.`name`, `tsf`.`file_name`, `ts`.`engine`,
|
||||||
|
`ts`.`se_private_data`) AS `AUTOEXTEND_SIZE`,
|
||||||
|
NULL AS `CREATION_TIME`,
|
||||||
|
NULL AS `LAST_UPDATE_TIME`,
|
||||||
|
NULL AS `LAST_ACCESS_TIME`,
|
||||||
|
NULL AS `RECOVER_TIME`,
|
||||||
|
NULL AS `TRANSACTION_COUNTER`,
|
||||||
|
internal_tablespace_version(`ts`.`name`, `tsf`.`file_name`, `ts`.`engine`,
|
||||||
|
`ts`.`se_private_data`) AS `VERSION`,
|
||||||
|
internal_tablespace_row_format(`ts`.`name`, `tsf`.`file_name`, `ts`.`engine`,
|
||||||
|
`ts`.`se_private_data`) AS `ROW_FORMAT`,
|
||||||
|
NULL AS `TABLE_ROWS`,
|
||||||
|
NULL AS `AVG_ROW_LENGTH`,
|
||||||
|
NULL AS `DATA_LENGTH`,
|
||||||
|
NULL AS `MAX_DATA_LENGTH`,
|
||||||
|
NULL AS `INDEX_LENGTH`,
|
||||||
|
internal_tablespace_data_free(`ts`.`name`, `tsf`.`file_name`, `ts`.`engine`,
|
||||||
|
`ts`.`se_private_data`) AS `DATA_FREE`,
|
||||||
|
NULL AS `CREATE_TIME`,
|
||||||
|
NULL AS `UPDATE_TIME`,
|
||||||
|
NULL AS `CHECK_TIME`,
|
||||||
|
NULL AS `CHECKSUM`,
|
||||||
|
internal_tablespace_status(`ts`.`name`, `tsf`.`file_name`, `ts`.`engine`,
|
||||||
|
`ts`.`se_private_data`) AS `STATUS`,
|
||||||
|
internal_tablespace_extra(`ts`.`name`, `tsf`.`file_name`, `ts`.`engine`,
|
||||||
|
`ts`.`se_private_data`) AS `EXTRA`
|
||||||
|
from (`mysql`.`tablespaces` `ts` join `mysql`.`tablespace_files` `tsf` on ((`ts`.`id` = `tsf`.`tablespace_id`)));
|
||||||
|
|
@ -0,0 +1,7 @@
|
|||||||
|
create view information_schema.INNODB_DATAFILES as
|
||||||
|
select get_dd_tablespace_private_data(`ts`.`se_private_data`, 'id') AS `SPACE`, `ts_files`.`file_name` AS `PATH`
|
||||||
|
from (`mysql`.`tablespace_files` `ts_files` join `mysql`.`tablespaces` `ts`
|
||||||
|
on ((`ts`.`id` = `ts_files`.`tablespace_id`)))
|
||||||
|
where ((`ts`.`se_private_data` is not null) and (`ts`.`engine` = 'InnoDB') and (`ts`.`name` <> 'mysql') and
|
||||||
|
(`ts`.`name` <> 'innodb_temporary'));
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
create view information_schema.INNODB_FIELDS as
|
||||||
|
select get_dd_index_private_data(`idx`.`se_private_data`, 'id') AS `INDEX_ID`,
|
||||||
|
`col`.`name` AS `NAME`,
|
||||||
|
(`fld`.`ordinal_position` - 1) AS `POS`
|
||||||
|
from (((`mysql`.`index_column_usage` `fld` join `mysql`.`columns` `col`
|
||||||
|
on ((`fld`.`column_id` = `col`.`id`))) join `mysql`.`indexes` `idx`
|
||||||
|
on ((`fld`.`index_id` = `idx`.`id`))) join `mysql`.`tables` `tbl` on ((`tbl`.`id` = `idx`.`table_id`)))
|
||||||
|
where ((`tbl`.`type` <> 'VIEW') and (`tbl`.`hidden` = 'Visible') and (0 = `fld`.`hidden`) and
|
||||||
|
(`tbl`.`se_private_id` is not null) and (`tbl`.`engine` = 'INNODB'));
|
||||||
|
|
@ -0,0 +1,16 @@
|
|||||||
|
create view information_schema.INNODB_FOREIGN as
|
||||||
|
select (concat(`sch`.`name`, '/', `fk`.`name`) collate utf8mb3_tolower_ci) AS `ID`,
|
||||||
|
concat(`sch`.`name`, '/', `tbl`.`name`) AS `FOR_NAME`,
|
||||||
|
concat(`fk`.`referenced_table_schema`, '/', `fk`.`referenced_table_name`) AS `REF_NAME`,
|
||||||
|
count(0) AS `N_COLS`,
|
||||||
|
(((((if((`fk`.`delete_rule` = 'CASCADE'), 1, 0) | if((`fk`.`delete_rule` = 'SET NULL'), 2, 0)) |
|
||||||
|
if((`fk`.`update_rule` = 'CASCADE'), 4, 0)) | if((`fk`.`update_rule` = 'SET NULL'), 8, 0)) |
|
||||||
|
if((`fk`.`delete_rule` = 'NO ACTION'), 16, 0)) | if((`fk`.`update_rule` = 'NO ACTION'), 32, 0)) AS `TYPE`
|
||||||
|
from (((`mysql`.`foreign_keys` `fk` join `mysql`.`tables` `tbl`
|
||||||
|
on ((`fk`.`table_id` = `tbl`.`id`))) join `mysql`.`schemata` `sch`
|
||||||
|
on ((`fk`.`schema_id` = `sch`.`id`))) join `mysql`.`foreign_key_column_usage` `col`
|
||||||
|
on ((`fk`.`id` = `col`.`foreign_key_id`)))
|
||||||
|
where ((`tbl`.`type` <> 'VIEW') and (`tbl`.`hidden` = 'Visible') and (`tbl`.`se_private_id` is not null) and
|
||||||
|
(`tbl`.`engine` = 'INNODB'))
|
||||||
|
group by `fk`.`id`;
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
create view information_schema.INNODB_FOREIGN_COLS as
|
||||||
|
select (concat(`sch`.`name`, '/', `fk`.`name`) collate utf8mb3_tolower_ci) AS `ID`,
|
||||||
|
`col`.`name` AS `FOR_COL_NAME`,
|
||||||
|
`fk_col`.`referenced_column_name` AS `REF_COL_NAME`,
|
||||||
|
`fk_col`.`ordinal_position` AS `POS`
|
||||||
|
from ((((`mysql`.`foreign_key_column_usage` `fk_col` join `mysql`.`foreign_keys` `fk`
|
||||||
|
on ((`fk`.`id` = `fk_col`.`foreign_key_id`))) join `mysql`.`tables` `tbl`
|
||||||
|
on ((`fk`.`table_id` = `tbl`.`id`))) join `mysql`.`schemata` `sch`
|
||||||
|
on ((`fk`.`schema_id` = `sch`.`id`))) join `mysql`.`columns` `col`
|
||||||
|
on (((`tbl`.`id` = `col`.`table_id`) and (`fk_col`.`column_id` = `col`.`id`))))
|
||||||
|
where ((`tbl`.`type` <> 'VIEW') and (`tbl`.`hidden` = 'Visible') and (`tbl`.`se_private_id` is not null) and
|
||||||
|
(`tbl`.`engine` = 'INNODB'));
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
create view information_schema.INNODB_TABLESPACES_BRIEF as
|
||||||
|
select get_dd_tablespace_private_data(`ts`.`se_private_data`, 'id') AS `SPACE`,
|
||||||
|
`ts`.`name` AS `NAME`,
|
||||||
|
`ts_files`.`file_name` AS `PATH`,
|
||||||
|
get_dd_tablespace_private_data(`ts`.`se_private_data`, 'flags') AS `FLAG`,
|
||||||
|
if((get_dd_tablespace_private_data(`ts`.`se_private_data`, 'id') = 0), 'System',
|
||||||
|
if((((get_dd_tablespace_private_data(`ts`.`se_private_data`, 'flags') & 2048) >> 11) <> 0), 'General',
|
||||||
|
'Single')) AS `SPACE_TYPE`
|
||||||
|
from (`mysql`.`tablespace_files` `ts_files` join `mysql`.`tablespaces` `ts`
|
||||||
|
on ((`ts`.`id` = `ts_files`.`tablespace_id`)))
|
||||||
|
where ((`ts`.`se_private_data` is not null) and (`ts`.`engine` = 'InnoDB') and (`ts`.`name` <> 'mysql') and
|
||||||
|
(`ts`.`name` <> 'innodb_temporary'));
|
||||||
|
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,45 @@
|
|||||||
|
create view information_schema.KEY_COLUMN_USAGE as
|
||||||
|
select (`cat`.`name` collate utf8mb3_tolower_ci) AS `CONSTRAINT_CATALOG`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `CONSTRAINT_SCHEMA`,
|
||||||
|
`constraints`.`CONSTRAINT_NAME` AS `CONSTRAINT_NAME`,
|
||||||
|
(`cat`.`name` collate utf8mb3_tolower_ci) AS `TABLE_CATALOG`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `TABLE_SCHEMA`,
|
||||||
|
(`tbl`.`name` collate utf8mb3_tolower_ci) AS `TABLE_NAME`,
|
||||||
|
(`col`.`name` collate utf8mb3_tolower_ci) AS `COLUMN_NAME`,
|
||||||
|
`constraints`.`ORDINAL_POSITION` AS `ORDINAL_POSITION`,
|
||||||
|
`constraints`.`POSITION_IN_UNIQUE_CONSTRAINT` AS `POSITION_IN_UNIQUE_CONSTRAINT`,
|
||||||
|
`constraints`.`REFERENCED_TABLE_SCHEMA` AS `REFERENCED_TABLE_SCHEMA`,
|
||||||
|
`constraints`.`REFERENCED_TABLE_NAME` AS `REFERENCED_TABLE_NAME`,
|
||||||
|
`constraints`.`REFERENCED_COLUMN_NAME` AS `REFERENCED_COLUMN_NAME`
|
||||||
|
from (((`mysql`.`tables` `tbl` join `mysql`.`schemata` `sch`
|
||||||
|
on ((`tbl`.`schema_id` = `sch`.`id`))) join `mysql`.`catalogs` `cat`
|
||||||
|
on ((`cat`.`id` = `sch`.`catalog_id`))) join (lateral (select `idx`.`name` AS `CONSTRAINT_NAME`,
|
||||||
|
`icu`.`ordinal_position` AS `ORDINAL_POSITION`,
|
||||||
|
NULL AS `POSITION_IN_UNIQUE_CONSTRAINT`,
|
||||||
|
NULL AS `REFERENCED_TABLE_SCHEMA`,
|
||||||
|
NULL AS `REFERENCED_TABLE_NAME`,
|
||||||
|
NULL AS `REFERENCED_COLUMN_NAME`,
|
||||||
|
`icu`.`column_id` AS `column_id`,
|
||||||
|
((0 <> `idx`.`hidden`) or (0 <> `icu`.`hidden`)) AS `HIDDEN`
|
||||||
|
from (`mysql`.`indexes` `idx` join `mysql`.`index_column_usage` `icu`
|
||||||
|
on ((`icu`.`index_id` = `idx`.`id`)))
|
||||||
|
where ((`idx`.`table_id` = `tbl`.`id`) and
|
||||||
|
(`idx`.`type` in ('PRIMARY', 'UNIQUE')))
|
||||||
|
union all
|
||||||
|
select (`fk`.`name` collate utf8mb3_tolower_ci) AS `CONSTRAINT_NAME`,
|
||||||
|
`fkcu`.`ordinal_position` AS `ORDINAL_POSITION`,
|
||||||
|
`fkcu`.`ordinal_position` AS `POSITION_IN_UNIQUE_CONSTRAINT`,
|
||||||
|
`fk`.`referenced_table_schema` AS `REFERENCED_TABLE_SCHEMA`,
|
||||||
|
`fk`.`referenced_table_name` AS `REFERENCED_TABLE_NAME`,
|
||||||
|
`fkcu`.`referenced_column_name` AS `REFERENCED_COLUMN_NAME`,
|
||||||
|
`fkcu`.`column_id` AS `column_id`,
|
||||||
|
false AS `HIDDEN`
|
||||||
|
from (`mysql`.`foreign_keys` `fk` join `mysql`.`foreign_key_column_usage` `fkcu`
|
||||||
|
on ((`fkcu`.`foreign_key_id` = `fk`.`id`)))
|
||||||
|
where (`fk`.`table_id` = `tbl`.`id`)) `constraints` join `mysql`.`columns` `col`
|
||||||
|
on ((`constraints`.`column_id` = `col`.`id`))))
|
||||||
|
where ((0 <> can_access_column(`sch`.`name`, `tbl`.`name`, `col`.`name`)) and (0 <> is_visible_dd_object(`tbl`.`hidden`,
|
||||||
|
((`col`.`hidden` not in ('Visible', 'User')) or
|
||||||
|
(0 <> `constraints`.`HIDDEN`)),
|
||||||
|
`col`.`options`)));
|
||||||
|
|
@ -0,0 +1,47 @@
|
|||||||
|
create view information_schema.PARAMETERS as
|
||||||
|
select (`cat`.`name` collate utf8mb3_tolower_ci) AS `SPECIFIC_CATALOG`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `SPECIFIC_SCHEMA`,
|
||||||
|
`rtn`.`name` AS `SPECIFIC_NAME`,
|
||||||
|
if((`rtn`.`type` = 'FUNCTION'), (`prm`.`ordinal_position` - 1), `prm`.`ordinal_position`) AS `ORDINAL_POSITION`,
|
||||||
|
if(((`rtn`.`type` = 'FUNCTION') and (`prm`.`ordinal_position` = 1)), NULL, `prm`.`mode`) AS `PARAMETER_MODE`,
|
||||||
|
if(((`rtn`.`type` = 'FUNCTION') and (`prm`.`ordinal_position` = 1)), NULL, `prm`.`name`) AS `PARAMETER_NAME`,
|
||||||
|
substring_index(substring_index(`prm`.`data_type_utf8`, '(', 1), ' ', 1) AS `DATA_TYPE`,
|
||||||
|
internal_dd_char_length(`prm`.`data_type`, `prm`.`char_length`, `col`.`name`,
|
||||||
|
0) AS `CHARACTER_MAXIMUM_LENGTH`,
|
||||||
|
internal_dd_char_length(`prm`.`data_type`, `prm`.`char_length`, `col`.`name`,
|
||||||
|
1) AS `CHARACTER_OCTET_LENGTH`,
|
||||||
|
`prm`.`numeric_precision` AS `NUMERIC_PRECISION`,
|
||||||
|
if((`prm`.`numeric_precision` is null), NULL, ifnull(`prm`.`numeric_scale`, 0)) AS `NUMERIC_SCALE`,
|
||||||
|
`prm`.`datetime_precision` AS `DATETIME_PRECISION`,
|
||||||
|
(case `prm`.`data_type`
|
||||||
|
when 'MYSQL_TYPE_STRING' then if((`cs`.`name` = 'binary'), NULL, `cs`.`name`)
|
||||||
|
when 'MYSQL_TYPE_VAR_STRING' then if((`cs`.`name` = 'binary'), NULL, `cs`.`name`)
|
||||||
|
when 'MYSQL_TYPE_VARCHAR' then if((`cs`.`name` = 'binary'), NULL, `cs`.`name`)
|
||||||
|
when 'MYSQL_TYPE_TINY_BLOB' then if((`cs`.`name` = 'binary'), NULL, `cs`.`name`)
|
||||||
|
when 'MYSQL_TYPE_MEDIUM_BLOB' then if((`cs`.`name` = 'binary'), NULL, `cs`.`name`)
|
||||||
|
when 'MYSQL_TYPE_BLOB' then if((`cs`.`name` = 'binary'), NULL, `cs`.`name`)
|
||||||
|
when 'MYSQL_TYPE_LONG_BLOB' then if((`cs`.`name` = 'binary'), NULL, `cs`.`name`)
|
||||||
|
when 'MYSQL_TYPE_ENUM' then if((`cs`.`name` = 'binary'), NULL, `cs`.`name`)
|
||||||
|
when 'MYSQL_TYPE_SET' then if((`cs`.`name` = 'binary'), NULL, `cs`.`name`)
|
||||||
|
else NULL end) AS `CHARACTER_SET_NAME`,
|
||||||
|
(case `prm`.`data_type`
|
||||||
|
when 'MYSQL_TYPE_STRING' then if((`cs`.`name` = 'binary'), NULL, `col`.`name`)
|
||||||
|
when 'MYSQL_TYPE_VAR_STRING' then if((`cs`.`name` = 'binary'), NULL, `col`.`name`)
|
||||||
|
when 'MYSQL_TYPE_VARCHAR' then if((`cs`.`name` = 'binary'), NULL, `col`.`name`)
|
||||||
|
when 'MYSQL_TYPE_TINY_BLOB' then if((`cs`.`name` = 'binary'), NULL, `col`.`name`)
|
||||||
|
when 'MYSQL_TYPE_MEDIUM_BLOB' then if((`cs`.`name` = 'binary'), NULL, `col`.`name`)
|
||||||
|
when 'MYSQL_TYPE_BLOB' then if((`cs`.`name` = 'binary'), NULL, `col`.`name`)
|
||||||
|
when 'MYSQL_TYPE_LONG_BLOB' then if((`cs`.`name` = 'binary'), NULL, `col`.`name`)
|
||||||
|
when 'MYSQL_TYPE_ENUM' then if((`cs`.`name` = 'binary'), NULL, `col`.`name`)
|
||||||
|
when 'MYSQL_TYPE_SET' then if((`cs`.`name` = 'binary'), NULL, `col`.`name`)
|
||||||
|
else NULL end) AS `COLLATION_NAME`,
|
||||||
|
`prm`.`data_type_utf8` AS `DTD_IDENTIFIER`,
|
||||||
|
`rtn`.`type` AS `ROUTINE_TYPE`
|
||||||
|
from (((((`mysql`.`parameters` `prm` join `mysql`.`routines` `rtn`
|
||||||
|
on ((`prm`.`routine_id` = `rtn`.`id`))) join `mysql`.`schemata` `sch`
|
||||||
|
on ((`rtn`.`schema_id` = `sch`.`id`))) join `mysql`.`catalogs` `cat`
|
||||||
|
on ((`cat`.`id` = `sch`.`catalog_id`))) join `mysql`.`collations` `col`
|
||||||
|
on ((`prm`.`collation_id` = `col`.`id`))) join `mysql`.`character_sets` `cs`
|
||||||
|
on ((`col`.`character_set_id` = `cs`.`id`)))
|
||||||
|
where (0 <> can_access_routine(`sch`.`name`, `rtn`.`name`, `rtn`.`type`, `rtn`.`definer`, false));
|
||||||
|
|
@ -0,0 +1,126 @@
|
|||||||
|
create view information_schema.PARTITIONS as
|
||||||
|
select (`cat`.`name` collate utf8mb3_tolower_ci) AS `TABLE_CATALOG`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `TABLE_SCHEMA`,
|
||||||
|
`tbl`.`name` AS `TABLE_NAME`,
|
||||||
|
`part`.`name` AS `PARTITION_NAME`,
|
||||||
|
`sub_part`.`name` AS `SUBPARTITION_NAME`,
|
||||||
|
(`part`.`number` + 1) AS `PARTITION_ORDINAL_POSITION`,
|
||||||
|
(`sub_part`.`number` + 1) AS `SUBPARTITION_ORDINAL_POSITION`,
|
||||||
|
(case `tbl`.`partition_type`
|
||||||
|
when 'HASH' then 'HASH'
|
||||||
|
when 'RANGE' then 'RANGE'
|
||||||
|
when 'LIST' then 'LIST'
|
||||||
|
when 'AUTO' then 'AUTO'
|
||||||
|
when 'KEY_51' then 'KEY'
|
||||||
|
when 'KEY_55' then 'KEY'
|
||||||
|
when 'LINEAR_KEY_51' then 'LINEAR KEY'
|
||||||
|
when 'LINEAR_KEY_55' then 'LINEAR KEY'
|
||||||
|
when 'LINEAR_HASH' then 'LINEAR HASH'
|
||||||
|
when 'RANGE_COLUMNS' then 'RANGE COLUMNS'
|
||||||
|
when 'LIST_COLUMNS' then 'LIST COLUMNS'
|
||||||
|
else NULL end) AS `PARTITION_METHOD`,
|
||||||
|
(case `tbl`.`subpartition_type`
|
||||||
|
when 'HASH' then 'HASH'
|
||||||
|
when 'RANGE' then 'RANGE'
|
||||||
|
when 'LIST' then 'LIST'
|
||||||
|
when 'AUTO' then 'AUTO'
|
||||||
|
when 'KEY_51' then 'KEY'
|
||||||
|
when 'KEY_55' then 'KEY'
|
||||||
|
when 'LINEAR_KEY_51' then 'LINEAR KEY'
|
||||||
|
when 'LINEAR_KEY_55' then 'LINEAR KEY'
|
||||||
|
when 'LINEAR_HASH' then 'LINEAR HASH'
|
||||||
|
when 'RANGE_COLUMNS' then 'RANGE COLUMNS'
|
||||||
|
when 'LIST_COLUMNS' then 'LIST COLUMNS'
|
||||||
|
else NULL end) AS `SUBPARTITION_METHOD`,
|
||||||
|
`tbl`.`partition_expression_utf8` AS `PARTITION_EXPRESSION`,
|
||||||
|
`tbl`.`subpartition_expression_utf8` AS `SUBPARTITION_EXPRESSION`,
|
||||||
|
`part`.`description_utf8` AS `PARTITION_DESCRIPTION`,
|
||||||
|
internal_table_rows(`sch`.`name`, `tbl`.`name`, if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`, (`tbl`.`hidden` <> 'Visible'), if((`sub_part`.`name` is null),
|
||||||
|
if((`part`.`name` is null),
|
||||||
|
`tbl`.`se_private_data`,
|
||||||
|
`part_ts`.`se_private_data`),
|
||||||
|
`sub_part_ts`.`se_private_data`), 0,
|
||||||
|
0,
|
||||||
|
ifnull(`sub_part`.`name`, `part`.`name`)) AS `TABLE_ROWS`,
|
||||||
|
internal_avg_row_length(`sch`.`name`, `tbl`.`name`, if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`, (`tbl`.`hidden` <> 'Visible'), if((`sub_part`.`name` is null),
|
||||||
|
if((`part`.`name` is null),
|
||||||
|
`tbl`.`se_private_data`,
|
||||||
|
`part_ts`.`se_private_data`),
|
||||||
|
`sub_part_ts`.`se_private_data`),
|
||||||
|
0, 0,
|
||||||
|
ifnull(`sub_part`.`name`, `part`.`name`)) AS `AVG_ROW_LENGTH`,
|
||||||
|
internal_data_length(`sch`.`name`, `tbl`.`name`, if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`, (`tbl`.`hidden` <> 'Visible'), if((`sub_part`.`name` is null),
|
||||||
|
if((`part`.`name` is null),
|
||||||
|
`tbl`.`se_private_data`,
|
||||||
|
`part_ts`.`se_private_data`),
|
||||||
|
`sub_part_ts`.`se_private_data`),
|
||||||
|
0, 0,
|
||||||
|
ifnull(`sub_part`.`name`, `part`.`name`)) AS `DATA_LENGTH`,
|
||||||
|
internal_max_data_length(`sch`.`name`, `tbl`.`name`, if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`, (`tbl`.`hidden` <> 'Visible'), if((`sub_part`.`name` is null),
|
||||||
|
if((`part`.`name` is null),
|
||||||
|
`tbl`.`se_private_data`,
|
||||||
|
`part_ts`.`se_private_data`),
|
||||||
|
`sub_part_ts`.`se_private_data`),
|
||||||
|
0, 0,
|
||||||
|
ifnull(`sub_part`.`name`, `part`.`name`)) AS `MAX_DATA_LENGTH`,
|
||||||
|
internal_index_length(`sch`.`name`, `tbl`.`name`, if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`, (`tbl`.`hidden` <> 'Visible'), if((`sub_part`.`name` is null),
|
||||||
|
if((`part`.`name` is null),
|
||||||
|
`tbl`.`se_private_data`,
|
||||||
|
`part_ts`.`se_private_data`),
|
||||||
|
`sub_part_ts`.`se_private_data`),
|
||||||
|
0, 0,
|
||||||
|
ifnull(`sub_part`.`name`, `part`.`name`)) AS `INDEX_LENGTH`,
|
||||||
|
internal_data_free(`sch`.`name`, `tbl`.`name`, if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`, (`tbl`.`hidden` <> 'Visible'), if((`sub_part`.`name` is null),
|
||||||
|
if((`part`.`name` is null),
|
||||||
|
`tbl`.`se_private_data`,
|
||||||
|
`part_ts`.`se_private_data`),
|
||||||
|
`sub_part_ts`.`se_private_data`), 0,
|
||||||
|
0,
|
||||||
|
ifnull(`sub_part`.`name`, `part`.`name`)) AS `DATA_FREE`,
|
||||||
|
`tbl`.`created` AS `CREATE_TIME`,
|
||||||
|
internal_update_time(`sch`.`name`, `tbl`.`name`, if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`, (`tbl`.`hidden` <> 'Visible'), if((`sub_part`.`name` is null),
|
||||||
|
if((`part`.`name` is null),
|
||||||
|
`tbl`.`se_private_data`,
|
||||||
|
`part_ts`.`se_private_data`),
|
||||||
|
`sub_part_ts`.`se_private_data`),
|
||||||
|
0, 0,
|
||||||
|
ifnull(`sub_part`.`name`, `part`.`name`)) AS `UPDATE_TIME`,
|
||||||
|
internal_check_time(`sch`.`name`, `tbl`.`name`, if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`, (`tbl`.`hidden` <> 'Visible'), if((`sub_part`.`name` is null),
|
||||||
|
if((`part`.`name` is null),
|
||||||
|
`tbl`.`se_private_data`,
|
||||||
|
`part_ts`.`se_private_data`),
|
||||||
|
`sub_part_ts`.`se_private_data`), 0,
|
||||||
|
0,
|
||||||
|
ifnull(`sub_part`.`name`, `part`.`name`)) AS `CHECK_TIME`,
|
||||||
|
internal_checksum(`sch`.`name`, `tbl`.`name`, if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`, (`tbl`.`hidden` <> 'Visible'), if((`sub_part`.`name` is null),
|
||||||
|
if((`part`.`name` is null),
|
||||||
|
`tbl`.`se_private_data`,
|
||||||
|
`part_ts`.`se_private_data`),
|
||||||
|
`sub_part_ts`.`se_private_data`), 0,
|
||||||
|
0,
|
||||||
|
ifnull(`sub_part`.`name`, `part`.`name`)) AS `CHECKSUM`,
|
||||||
|
if((`sub_part`.`name` is null), ifnull(`part`.`comment`, ''),
|
||||||
|
ifnull(`sub_part`.`comment`, '')) AS `PARTITION_COMMENT`,
|
||||||
|
if((`part`.`name` is null), '',
|
||||||
|
internal_get_partition_nodegroup(if((`sub_part`.`name` is null), `part`.`options`,
|
||||||
|
`sub_part`.`options`))) AS `NODEGROUP`,
|
||||||
|
ifnull(`sub_part_ts`.`name`, `part_ts`.`name`) AS `TABLESPACE_NAME`
|
||||||
|
from ((((((`mysql`.`tables` `tbl` join `mysql`.`schemata` `sch`
|
||||||
|
on ((`sch`.`id` = `tbl`.`schema_id`))) join `mysql`.`catalogs` `cat`
|
||||||
|
on ((`cat`.`id` = `sch`.`catalog_id`))) left join `mysql`.`table_partitions` `part`
|
||||||
|
on ((`part`.`table_id` = `tbl`.`id`))) left join `mysql`.`table_partitions` `sub_part`
|
||||||
|
on ((`sub_part`.`parent_partition_id` = `part`.`id`))) left join `mysql`.`tablespaces` `part_ts`
|
||||||
|
on ((`part_ts`.`id` = `part`.`tablespace_id`))) left join `mysql`.`tablespaces` `sub_part_ts`
|
||||||
|
on (((`sub_part`.`tablespace_id` is not null) and (`sub_part_ts`.`id` = `sub_part`.`tablespace_id`))))
|
||||||
|
where ((0 <> can_access_table(`sch`.`name`, `tbl`.`name`)) and (0 <> is_visible_dd_object(`tbl`.`hidden`)) and
|
||||||
|
(`part`.`parent_partition_id` is null));
|
||||||
|
|
@ -0,0 +1,17 @@
|
|||||||
|
create view information_schema.REFERENTIAL_CONSTRAINTS as
|
||||||
|
select `cat`.`name` AS `CONSTRAINT_CATALOG`,
|
||||||
|
`sch`.`name` AS `CONSTRAINT_SCHEMA`,
|
||||||
|
(`fk`.`name` collate utf8mb3_tolower_ci) AS `CONSTRAINT_NAME`,
|
||||||
|
`fk`.`referenced_table_catalog` AS `UNIQUE_CONSTRAINT_CATALOG`,
|
||||||
|
`fk`.`referenced_table_schema` AS `UNIQUE_CONSTRAINT_SCHEMA`,
|
||||||
|
`fk`.`unique_constraint_name` AS `UNIQUE_CONSTRAINT_NAME`,
|
||||||
|
`fk`.`match_option` AS `MATCH_OPTION`,
|
||||||
|
`fk`.`update_rule` AS `UPDATE_RULE`,
|
||||||
|
`fk`.`delete_rule` AS `DELETE_RULE`,
|
||||||
|
`tbl`.`name` AS `TABLE_NAME`,
|
||||||
|
`fk`.`referenced_table_name` AS `REFERENCED_TABLE_NAME`
|
||||||
|
from (((`mysql`.`foreign_keys` `fk` join `mysql`.`tables` `tbl`
|
||||||
|
on ((`fk`.`table_id` = `tbl`.`id`))) join `mysql`.`schemata` `sch`
|
||||||
|
on ((`fk`.`schema_id` = `sch`.`id`))) join `mysql`.`catalogs` `cat` on ((`cat`.`id` = `sch`.`catalog_id`)))
|
||||||
|
where ((0 <> can_access_table(`sch`.`name`, `tbl`.`name`)) and (0 <> is_visible_dd_object(`tbl`.`hidden`)));
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
create view information_schema.RESOURCE_GROUPS as
|
||||||
|
select `res`.`resource_group_name` AS `RESOURCE_GROUP_NAME`,
|
||||||
|
`res`.`resource_group_type` AS `RESOURCE_GROUP_TYPE`,
|
||||||
|
`res`.`resource_group_enabled` AS `RESOURCE_GROUP_ENABLED`,
|
||||||
|
convert_cpu_id_mask(`res`.`cpu_id_mask`) AS `VCPU_IDS`,
|
||||||
|
`res`.`thread_priority` AS `THREAD_PRIORITY`
|
||||||
|
from `mysql`.`resource_groups` `res`
|
||||||
|
where (0 <> can_access_resource_group(`res`.`resource_group_name`));
|
||||||
|
|
@ -0,0 +1,76 @@
|
|||||||
|
create view information_schema.ROLE_COLUMN_GRANTS as
|
||||||
|
with recursive `role_graph` (`c_parent_user`, `c_parent_host`, `c_from_user`, `c_from_host`, `c_to_user`, `c_to_host`,
|
||||||
|
`role_path`, `c_with_admin`, `c_enabled`)
|
||||||
|
as (select internal_get_username() AS `INTERNAL_GET_USERNAME()`,
|
||||||
|
internal_get_hostname() AS `INTERNAL_GET_HOSTNAME()`,
|
||||||
|
internal_get_username() AS `INTERNAL_GET_USERNAME()`,
|
||||||
|
internal_get_hostname() AS `INTERNAL_GET_HOSTNAME()`,
|
||||||
|
cast('' as char(64) charset utf8mb4) AS `CAST('' as CHAR(64) CHARSET utf8mb4)`,
|
||||||
|
cast('' as char(255) charset utf8mb4) AS `CAST('' as CHAR(255) CHARSET utf8mb4)`,
|
||||||
|
cast(sha2(concat(quote(internal_get_username()), '@', quote(internal_get_hostname())),
|
||||||
|
256) as char(17000) charset utf8mb4) AS `CAST(SHA2(CONCAT(QUOTE(INTERNAL_GET_USERNAME()),'@', QUOTE(INTERNAL_GET_HOSTNAME())), 256) AS CHAR(17000) CHARSET utf8mb4)`,
|
||||||
|
cast('N' as char(1) charset utf8mb4) AS `CAST('N' as CHAR(1) CHARSET utf8mb4)`,
|
||||||
|
false AS `FALSE`
|
||||||
|
union
|
||||||
|
select internal_get_username() AS `INTERNAL_GET_USERNAME()`,
|
||||||
|
internal_get_hostname() AS `INTERNAL_GET_HOSTNAME()`,
|
||||||
|
`mandatory_roles`.`ROLE_NAME` AS `ROLE_NAME`,
|
||||||
|
`mandatory_roles`.`ROLE_HOST` AS `ROLE_HOST`,
|
||||||
|
internal_get_username() AS `INTERNAL_GET_USERNAME()`,
|
||||||
|
internal_get_hostname() AS `INTERNAL_GET_HOSTNAME()`,
|
||||||
|
cast(sha2(concat(quote(`mandatory_roles`.`ROLE_NAME`), '@',
|
||||||
|
convert(quote(`mandatory_roles`.`ROLE_HOST`) using utf8mb4)),
|
||||||
|
256) as char(17000) charset utf8mb4) AS `CAST(SHA2(CONCAT(QUOTE(ROLE_NAME),'@', CONVERT(QUOTE(ROLE_HOST) using utf8mb4)), 256) AS CHAR(17000) CHARSET utf8mb4)`,
|
||||||
|
cast('N' as char(1) charset utf8mb4) AS `CAST('N' as CHAR(1) CHARSET utf8mb4)`,
|
||||||
|
false AS `FALSE`
|
||||||
|
from json_table(internal_get_mandatory_roles_json(), '$[*]'
|
||||||
|
columns (`ROLE_NAME` varchar(255) character set utf8mb4 path '$.ROLE_NAME', `ROLE_HOST` varchar(255) character set utf8mb4 path '$.ROLE_HOST')) `mandatory_roles`
|
||||||
|
where concat(quote(`mandatory_roles`.`ROLE_NAME`), '@',
|
||||||
|
convert(quote(`mandatory_roles`.`ROLE_HOST`) using utf8mb4)) in
|
||||||
|
(select concat(convert(quote(`mysql`.`role_edges`.`FROM_USER`) using utf8mb4), '@',
|
||||||
|
convert(quote(`mysql`.`role_edges`.`FROM_HOST`) using utf8mb4))
|
||||||
|
from `mysql`.`role_edges`
|
||||||
|
where ((`mysql`.`role_edges`.`TO_USER` = internal_get_username()) and
|
||||||
|
(convert(`mysql`.`role_edges`.`TO_HOST` using utf8mb4) =
|
||||||
|
convert(internal_get_hostname() using utf8mb4)))) is false
|
||||||
|
union
|
||||||
|
select `role_graph`.`c_parent_user` AS `c_parent_user`,
|
||||||
|
`role_graph`.`c_parent_host` AS `c_parent_host`,
|
||||||
|
`mysql`.`role_edges`.`FROM_USER` AS `FROM_USER`,
|
||||||
|
`mysql`.`role_edges`.`FROM_HOST` AS `FROM_HOST`,
|
||||||
|
`mysql`.`role_edges`.`TO_USER` AS `TO_USER`,
|
||||||
|
`mysql`.`role_edges`.`TO_HOST` AS `TO_HOST`,
|
||||||
|
if((locate(sha2(concat(convert(quote(`mysql`.`role_edges`.`FROM_USER`) using utf8mb4),
|
||||||
|
'@',
|
||||||
|
convert(quote(`mysql`.`role_edges`.`FROM_HOST`) using utf8mb4)),
|
||||||
|
256), `role_graph`.`role_path`) = 0),
|
||||||
|
concat(`role_graph`.`role_path`, '->', convert(sha2(concat(
|
||||||
|
convert(quote(`mysql`.`role_edges`.`FROM_USER`) using utf8mb4),
|
||||||
|
'@',
|
||||||
|
convert(quote(`mysql`.`role_edges`.`FROM_HOST`) using utf8mb4)),
|
||||||
|
256) using utf8mb4)),
|
||||||
|
NULL) AS `IF(LOCATE(SHA2(CONCAT(QUOTE(FROM_USER),'@', CONVERT(QUOTE(FROM_HOST) using utf8mb4)), 256), role_path) = 0, CONCAT(role_path,'->', SHA2(CONCAT(QUOTE(FROM_USER),'@', CONVERT(QUOTE(FROM_HOST) using utf8`,
|
||||||
|
`mysql`.`role_edges`.`WITH_ADMIN_OPTION` AS `WITH_ADMIN_OPTION`,
|
||||||
|
if(((0 <> `role_graph`.`c_enabled`) or (0 <> internal_is_enabled_role(
|
||||||
|
`mysql`.`role_edges`.`FROM_USER`, `mysql`.`role_edges`.`FROM_HOST`))), true,
|
||||||
|
false) AS `IF(c_enabled OR INTERNAL_IS_ENABLED_ROLE(FROM_USER, FROM_HOST), TRUE, FALSE)`
|
||||||
|
from (`mysql`.`role_edges` join `role_graph`)
|
||||||
|
where ((`mysql`.`role_edges`.`TO_USER` = `role_graph`.`c_from_user`) and
|
||||||
|
(convert(`mysql`.`role_edges`.`TO_HOST` using utf8mb4) = `role_graph`.`c_from_host`) and
|
||||||
|
(`role_graph`.`role_path` is not null)))
|
||||||
|
select distinct internal_get_username(`tp`.`Grantor`) AS `GRANTOR`,
|
||||||
|
internal_get_hostname(`tp`.`Grantor`) AS `GRANTOR_HOST`,
|
||||||
|
`cp`.`User` AS `GRANTEE`,
|
||||||
|
`cp`.`Host` AS `GRANTEE_HOST`,
|
||||||
|
'def' AS `TABLE_CATALOG`,
|
||||||
|
`cp`.`Db` AS `TABLE_SCHEMA`,
|
||||||
|
`cp`.`Table_name` AS `TABLE_NAME`,
|
||||||
|
`cp`.`Column_name` AS `COLUMN_NAME`,
|
||||||
|
`cp`.`Column_priv` AS `PRIVILEGE_TYPE`,
|
||||||
|
if((find_in_set('Grant', `tp`.`Table_priv`) > 0), 'YES', 'NO') AS `IS_GRANTABLE`
|
||||||
|
from ((`mysql`.`tables_priv` `tp` join `role_graph` `rg` on (((`tp`.`User` = `rg`.`c_from_user`) and
|
||||||
|
(convert(`tp`.`Host` using utf8mb4) = `rg`.`c_from_host`)))) join `mysql`.`columns_priv` `cp`
|
||||||
|
on (((convert(`tp`.`Host` using utf8mb4) = `cp`.`Host`) and (`cp`.`Db` = `tp`.`Db`) and
|
||||||
|
(`cp`.`User` = `tp`.`User`) and (`cp`.`Table_name` = `tp`.`Table_name`))))
|
||||||
|
where ((`cp`.`Column_priv` > 0) and (`rg`.`c_to_user` <> '') and (`rg`.`c_enabled` = true));
|
||||||
|
|
@ -0,0 +1,76 @@
|
|||||||
|
create view information_schema.ROLE_ROUTINE_GRANTS as
|
||||||
|
with recursive `role_graph` (`c_parent_user`, `c_parent_host`, `c_from_user`, `c_from_host`, `c_to_user`, `c_to_host`,
|
||||||
|
`role_path`, `c_with_admin`, `c_enabled`)
|
||||||
|
as (select internal_get_username() AS `INTERNAL_GET_USERNAME()`,
|
||||||
|
internal_get_hostname() AS `INTERNAL_GET_HOSTNAME()`,
|
||||||
|
internal_get_username() AS `INTERNAL_GET_USERNAME()`,
|
||||||
|
internal_get_hostname() AS `INTERNAL_GET_HOSTNAME()`,
|
||||||
|
cast('' as char(64) charset utf8mb4) AS `CAST('' as CHAR(64) CHARSET utf8mb4)`,
|
||||||
|
cast('' as char(255) charset utf8mb4) AS `CAST('' as CHAR(255) CHARSET utf8mb4)`,
|
||||||
|
cast(sha2(concat(quote(internal_get_username()), '@', quote(internal_get_hostname())),
|
||||||
|
256) as char(17000) charset utf8mb4) AS `CAST(SHA2(CONCAT(QUOTE(INTERNAL_GET_USERNAME()),'@', QUOTE(INTERNAL_GET_HOSTNAME())), 256) AS CHAR(17000) CHARSET utf8mb4)`,
|
||||||
|
cast('N' as char(1) charset utf8mb4) AS `CAST('N' as CHAR(1) CHARSET utf8mb4)`,
|
||||||
|
false AS `FALSE`
|
||||||
|
union
|
||||||
|
select internal_get_username() AS `INTERNAL_GET_USERNAME()`,
|
||||||
|
internal_get_hostname() AS `INTERNAL_GET_HOSTNAME()`,
|
||||||
|
`mandatory_roles`.`ROLE_NAME` AS `ROLE_NAME`,
|
||||||
|
`mandatory_roles`.`ROLE_HOST` AS `ROLE_HOST`,
|
||||||
|
internal_get_username() AS `INTERNAL_GET_USERNAME()`,
|
||||||
|
internal_get_hostname() AS `INTERNAL_GET_HOSTNAME()`,
|
||||||
|
cast(sha2(concat(quote(`mandatory_roles`.`ROLE_NAME`), '@',
|
||||||
|
convert(quote(`mandatory_roles`.`ROLE_HOST`) using utf8mb4)),
|
||||||
|
256) as char(17000) charset utf8mb4) AS `CAST(SHA2(CONCAT(QUOTE(ROLE_NAME),'@', CONVERT(QUOTE(ROLE_HOST) using utf8mb4)), 256) AS CHAR(17000) CHARSET utf8mb4)`,
|
||||||
|
cast('N' as char(1) charset utf8mb4) AS `CAST('N' as CHAR(1) CHARSET utf8mb4)`,
|
||||||
|
false AS `FALSE`
|
||||||
|
from json_table(internal_get_mandatory_roles_json(), '$[*]'
|
||||||
|
columns (`ROLE_NAME` varchar(255) character set utf8mb4 path '$.ROLE_NAME', `ROLE_HOST` varchar(255) character set utf8mb4 path '$.ROLE_HOST')) `mandatory_roles`
|
||||||
|
where concat(quote(`mandatory_roles`.`ROLE_NAME`), '@',
|
||||||
|
convert(quote(`mandatory_roles`.`ROLE_HOST`) using utf8mb4)) in
|
||||||
|
(select concat(convert(quote(`mysql`.`role_edges`.`FROM_USER`) using utf8mb4), '@',
|
||||||
|
convert(quote(`mysql`.`role_edges`.`FROM_HOST`) using utf8mb4))
|
||||||
|
from `mysql`.`role_edges`
|
||||||
|
where ((`mysql`.`role_edges`.`TO_USER` = internal_get_username()) and
|
||||||
|
(convert(`mysql`.`role_edges`.`TO_HOST` using utf8mb4) =
|
||||||
|
convert(internal_get_hostname() using utf8mb4)))) is false
|
||||||
|
union
|
||||||
|
select `role_graph`.`c_parent_user` AS `c_parent_user`,
|
||||||
|
`role_graph`.`c_parent_host` AS `c_parent_host`,
|
||||||
|
`mysql`.`role_edges`.`FROM_USER` AS `FROM_USER`,
|
||||||
|
`mysql`.`role_edges`.`FROM_HOST` AS `FROM_HOST`,
|
||||||
|
`mysql`.`role_edges`.`TO_USER` AS `TO_USER`,
|
||||||
|
`mysql`.`role_edges`.`TO_HOST` AS `TO_HOST`,
|
||||||
|
if((locate(sha2(concat(convert(quote(`mysql`.`role_edges`.`FROM_USER`) using utf8mb4),
|
||||||
|
'@',
|
||||||
|
convert(quote(`mysql`.`role_edges`.`FROM_HOST`) using utf8mb4)),
|
||||||
|
256), `role_graph`.`role_path`) = 0),
|
||||||
|
concat(`role_graph`.`role_path`, '->', convert(sha2(concat(
|
||||||
|
convert(quote(`mysql`.`role_edges`.`FROM_USER`) using utf8mb4),
|
||||||
|
'@',
|
||||||
|
convert(quote(`mysql`.`role_edges`.`FROM_HOST`) using utf8mb4)),
|
||||||
|
256) using utf8mb4)),
|
||||||
|
NULL) AS `IF(LOCATE(SHA2(CONCAT(QUOTE(FROM_USER),'@', CONVERT(QUOTE(FROM_HOST) using utf8mb4)), 256), role_path) = 0, CONCAT(role_path,'->', SHA2(CONCAT(QUOTE(FROM_USER),'@', CONVERT(QUOTE(FROM_HOST) using utf8`,
|
||||||
|
`mysql`.`role_edges`.`WITH_ADMIN_OPTION` AS `WITH_ADMIN_OPTION`,
|
||||||
|
if(((0 <> `role_graph`.`c_enabled`) or (0 <> internal_is_enabled_role(
|
||||||
|
`mysql`.`role_edges`.`FROM_USER`, `mysql`.`role_edges`.`FROM_HOST`))), true,
|
||||||
|
false) AS `IF(c_enabled OR INTERNAL_IS_ENABLED_ROLE(FROM_USER, FROM_HOST), TRUE, FALSE)`
|
||||||
|
from (`mysql`.`role_edges` join `role_graph`)
|
||||||
|
where ((`mysql`.`role_edges`.`TO_USER` = `role_graph`.`c_from_user`) and
|
||||||
|
(convert(`mysql`.`role_edges`.`TO_HOST` using utf8mb4) = `role_graph`.`c_from_host`) and
|
||||||
|
(`role_graph`.`role_path` is not null)))
|
||||||
|
select distinct internal_get_username(`pp`.`Grantor`) AS `GRANTOR`,
|
||||||
|
internal_get_hostname(`pp`.`Grantor`) AS `GRANTOR_HOST`,
|
||||||
|
`pp`.`User` AS `GRANTEE`,
|
||||||
|
`pp`.`Host` AS `GRANTEE_HOST`,
|
||||||
|
'def' AS `SPECIFIC_CATALOG`,
|
||||||
|
`pp`.`Db` AS `SPECIFIC_SCHEMA`,
|
||||||
|
`pp`.`Routine_name` AS `SPECIFIC_NAME`,
|
||||||
|
'def' AS `ROUTINE_CATALOG`,
|
||||||
|
`pp`.`Db` AS `ROUTINE_SCHEMA`,
|
||||||
|
`pp`.`Routine_name` AS `ROUTINE_NAME`,
|
||||||
|
`pp`.`Proc_priv` AS `PRIVILEGE_TYPE`,
|
||||||
|
if((find_in_set('Grant', `pp`.`Proc_priv`) > 0), 'YES', 'NO') AS `IS_GRANTABLE`
|
||||||
|
from (`mysql`.`procs_priv` `pp` join `role_graph` `rg`
|
||||||
|
on (((`pp`.`User` = `rg`.`c_from_user`) and (convert(`pp`.`Host` using utf8mb4) = `rg`.`c_from_host`))))
|
||||||
|
where ((`pp`.`Proc_priv` > 0) and (`rg`.`c_to_user` <> '') and (`rg`.`c_enabled` = true));
|
||||||
|
|
@ -0,0 +1,73 @@
|
|||||||
|
create view information_schema.ROLE_TABLE_GRANTS as
|
||||||
|
with recursive `role_graph` (`c_parent_user`, `c_parent_host`, `c_from_user`, `c_from_host`, `c_to_user`, `c_to_host`,
|
||||||
|
`role_path`, `c_with_admin`, `c_enabled`)
|
||||||
|
as (select internal_get_username() AS `INTERNAL_GET_USERNAME()`,
|
||||||
|
internal_get_hostname() AS `INTERNAL_GET_HOSTNAME()`,
|
||||||
|
internal_get_username() AS `INTERNAL_GET_USERNAME()`,
|
||||||
|
internal_get_hostname() AS `INTERNAL_GET_HOSTNAME()`,
|
||||||
|
cast('' as char(64) charset utf8mb4) AS `CAST('' as CHAR(64) CHARSET utf8mb4)`,
|
||||||
|
cast('' as char(255) charset utf8mb4) AS `CAST('' as CHAR(255) CHARSET utf8mb4)`,
|
||||||
|
cast(sha2(concat(quote(internal_get_username()), '@', quote(internal_get_hostname())),
|
||||||
|
256) as char(17000) charset utf8mb4) AS `CAST(SHA2(CONCAT(QUOTE(INTERNAL_GET_USERNAME()),'@', QUOTE(INTERNAL_GET_HOSTNAME())), 256) AS CHAR(17000) CHARSET utf8mb4)`,
|
||||||
|
cast('N' as char(1) charset utf8mb4) AS `CAST('N' as CHAR(1) CHARSET utf8mb4)`,
|
||||||
|
false AS `FALSE`
|
||||||
|
union
|
||||||
|
select internal_get_username() AS `INTERNAL_GET_USERNAME()`,
|
||||||
|
internal_get_hostname() AS `INTERNAL_GET_HOSTNAME()`,
|
||||||
|
`mandatory_roles`.`ROLE_NAME` AS `ROLE_NAME`,
|
||||||
|
`mandatory_roles`.`ROLE_HOST` AS `ROLE_HOST`,
|
||||||
|
internal_get_username() AS `INTERNAL_GET_USERNAME()`,
|
||||||
|
internal_get_hostname() AS `INTERNAL_GET_HOSTNAME()`,
|
||||||
|
cast(sha2(concat(quote(`mandatory_roles`.`ROLE_NAME`), '@',
|
||||||
|
convert(quote(`mandatory_roles`.`ROLE_HOST`) using utf8mb4)),
|
||||||
|
256) as char(17000) charset utf8mb4) AS `CAST(SHA2(CONCAT(QUOTE(ROLE_NAME),'@', CONVERT(QUOTE(ROLE_HOST) using utf8mb4)), 256) AS CHAR(17000) CHARSET utf8mb4)`,
|
||||||
|
cast('N' as char(1) charset utf8mb4) AS `CAST('N' as CHAR(1) CHARSET utf8mb4)`,
|
||||||
|
false AS `FALSE`
|
||||||
|
from json_table(internal_get_mandatory_roles_json(), '$[*]'
|
||||||
|
columns (`ROLE_NAME` varchar(255) character set utf8mb4 path '$.ROLE_NAME', `ROLE_HOST` varchar(255) character set utf8mb4 path '$.ROLE_HOST')) `mandatory_roles`
|
||||||
|
where concat(quote(`mandatory_roles`.`ROLE_NAME`), '@',
|
||||||
|
convert(quote(`mandatory_roles`.`ROLE_HOST`) using utf8mb4)) in
|
||||||
|
(select concat(convert(quote(`mysql`.`role_edges`.`FROM_USER`) using utf8mb4), '@',
|
||||||
|
convert(quote(`mysql`.`role_edges`.`FROM_HOST`) using utf8mb4))
|
||||||
|
from `mysql`.`role_edges`
|
||||||
|
where ((`mysql`.`role_edges`.`TO_USER` = internal_get_username()) and
|
||||||
|
(convert(`mysql`.`role_edges`.`TO_HOST` using utf8mb4) =
|
||||||
|
convert(internal_get_hostname() using utf8mb4)))) is false
|
||||||
|
union
|
||||||
|
select `role_graph`.`c_parent_user` AS `c_parent_user`,
|
||||||
|
`role_graph`.`c_parent_host` AS `c_parent_host`,
|
||||||
|
`mysql`.`role_edges`.`FROM_USER` AS `FROM_USER`,
|
||||||
|
`mysql`.`role_edges`.`FROM_HOST` AS `FROM_HOST`,
|
||||||
|
`mysql`.`role_edges`.`TO_USER` AS `TO_USER`,
|
||||||
|
`mysql`.`role_edges`.`TO_HOST` AS `TO_HOST`,
|
||||||
|
if((locate(sha2(concat(convert(quote(`mysql`.`role_edges`.`FROM_USER`) using utf8mb4),
|
||||||
|
'@',
|
||||||
|
convert(quote(`mysql`.`role_edges`.`FROM_HOST`) using utf8mb4)),
|
||||||
|
256), `role_graph`.`role_path`) = 0),
|
||||||
|
concat(`role_graph`.`role_path`, '->', convert(sha2(concat(
|
||||||
|
convert(quote(`mysql`.`role_edges`.`FROM_USER`) using utf8mb4),
|
||||||
|
'@',
|
||||||
|
convert(quote(`mysql`.`role_edges`.`FROM_HOST`) using utf8mb4)),
|
||||||
|
256) using utf8mb4)),
|
||||||
|
NULL) AS `IF(LOCATE(SHA2(CONCAT(QUOTE(FROM_USER),'@', CONVERT(QUOTE(FROM_HOST) using utf8mb4)), 256), role_path) = 0, CONCAT(role_path,'->', SHA2(CONCAT(QUOTE(FROM_USER),'@', CONVERT(QUOTE(FROM_HOST) using utf8`,
|
||||||
|
`mysql`.`role_edges`.`WITH_ADMIN_OPTION` AS `WITH_ADMIN_OPTION`,
|
||||||
|
if(((0 <> `role_graph`.`c_enabled`) or (0 <> internal_is_enabled_role(
|
||||||
|
`mysql`.`role_edges`.`FROM_USER`, `mysql`.`role_edges`.`FROM_HOST`))), true,
|
||||||
|
false) AS `IF(c_enabled OR INTERNAL_IS_ENABLED_ROLE(FROM_USER, FROM_HOST), TRUE, FALSE)`
|
||||||
|
from (`mysql`.`role_edges` join `role_graph`)
|
||||||
|
where ((`mysql`.`role_edges`.`TO_USER` = `role_graph`.`c_from_user`) and
|
||||||
|
(convert(`mysql`.`role_edges`.`TO_HOST` using utf8mb4) = `role_graph`.`c_from_host`) and
|
||||||
|
(`role_graph`.`role_path` is not null)))
|
||||||
|
select distinct internal_get_username(`tp`.`Grantor`) AS `GRANTOR`,
|
||||||
|
internal_get_hostname(`tp`.`Grantor`) AS `GRANTOR_HOST`,
|
||||||
|
`tp`.`User` AS `GRANTEE`,
|
||||||
|
`tp`.`Host` AS `GRANTEE_HOST`,
|
||||||
|
'def' AS `TABLE_CATALOG`,
|
||||||
|
`tp`.`Db` AS `TABLE_SCHEMA`,
|
||||||
|
`tp`.`Table_name` AS `TABLE_NAME`,
|
||||||
|
`tp`.`Table_priv` AS `PRIVILEGE_TYPE`,
|
||||||
|
if((find_in_set('Grant', `tp`.`Table_priv`) > 0), 'YES', 'NO') AS `IS_GRANTABLE`
|
||||||
|
from (`mysql`.`tables_priv` `tp` join `role_graph` `rg`
|
||||||
|
on (((`tp`.`User` = `rg`.`c_from_user`) and (convert(`tp`.`Host` using utf8mb4) = `rg`.`c_from_host`))))
|
||||||
|
where ((`tp`.`Table_priv` > 0) and (`rg`.`c_to_user` <> '') and (`rg`.`c_enabled` = true));
|
||||||
|
|
@ -0,0 +1,68 @@
|
|||||||
|
create view information_schema.ROUTINES as
|
||||||
|
select `rtn`.`name` AS `SPECIFIC_NAME`,
|
||||||
|
(`cat`.`name` collate utf8mb3_tolower_ci) AS `ROUTINE_CATALOG`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `ROUTINE_SCHEMA`,
|
||||||
|
`rtn`.`name` AS `ROUTINE_NAME`,
|
||||||
|
`rtn`.`type` AS `ROUTINE_TYPE`,
|
||||||
|
if((`rtn`.`type` = 'PROCEDURE'), '', substring_index(substring_index(`rtn`.`result_data_type_utf8`, '(', 1), ' ',
|
||||||
|
1)) AS `DATA_TYPE`,
|
||||||
|
internal_dd_char_length(`rtn`.`result_data_type`, `rtn`.`result_char_length`, `coll_result`.`name`,
|
||||||
|
0) AS `CHARACTER_MAXIMUM_LENGTH`,
|
||||||
|
internal_dd_char_length(`rtn`.`result_data_type`, `rtn`.`result_char_length`, `coll_result`.`name`,
|
||||||
|
1) AS `CHARACTER_OCTET_LENGTH`,
|
||||||
|
`rtn`.`result_numeric_precision` AS `NUMERIC_PRECISION`,
|
||||||
|
`rtn`.`result_numeric_scale` AS `NUMERIC_SCALE`,
|
||||||
|
`rtn`.`result_datetime_precision` AS `DATETIME_PRECISION`,
|
||||||
|
(case `rtn`.`result_data_type`
|
||||||
|
when 'MYSQL_TYPE_STRING' then if((`cs_result`.`name` = 'binary'), NULL, `cs_result`.`name`)
|
||||||
|
when 'MYSQL_TYPE_VAR_STRING' then if((`cs_result`.`name` = 'binary'), NULL, `cs_result`.`name`)
|
||||||
|
when 'MYSQL_TYPE_VARCHAR' then if((`cs_result`.`name` = 'binary'), NULL, `cs_result`.`name`)
|
||||||
|
when 'MYSQL_TYPE_TINY_BLOB' then if((`cs_result`.`name` = 'binary'), NULL, `cs_result`.`name`)
|
||||||
|
when 'MYSQL_TYPE_MEDIUM_BLOB' then if((`cs_result`.`name` = 'binary'), NULL, `cs_result`.`name`)
|
||||||
|
when 'MYSQL_TYPE_BLOB' then if((`cs_result`.`name` = 'binary'), NULL, `cs_result`.`name`)
|
||||||
|
when 'MYSQL_TYPE_LONG_BLOB' then if((`cs_result`.`name` = 'binary'), NULL, `cs_result`.`name`)
|
||||||
|
when 'MYSQL_TYPE_ENUM' then if((`cs_result`.`name` = 'binary'), NULL, `cs_result`.`name`)
|
||||||
|
when 'MYSQL_TYPE_SET' then if((`cs_result`.`name` = 'binary'), NULL, `cs_result`.`name`)
|
||||||
|
else NULL end) AS `CHARACTER_SET_NAME`,
|
||||||
|
(case `rtn`.`result_data_type`
|
||||||
|
when 'MYSQL_TYPE_STRING' then if((`cs_result`.`name` = 'binary'), NULL, `coll_result`.`name`)
|
||||||
|
when 'MYSQL_TYPE_VAR_STRING' then if((`cs_result`.`name` = 'binary'), NULL, `coll_result`.`name`)
|
||||||
|
when 'MYSQL_TYPE_VARCHAR' then if((`cs_result`.`name` = 'binary'), NULL, `coll_result`.`name`)
|
||||||
|
when 'MYSQL_TYPE_TINY_BLOB' then if((`cs_result`.`name` = 'binary'), NULL, `coll_result`.`name`)
|
||||||
|
when 'MYSQL_TYPE_MEDIUM_BLOB' then if((`cs_result`.`name` = 'binary'), NULL, `coll_result`.`name`)
|
||||||
|
when 'MYSQL_TYPE_BLOB' then if((`cs_result`.`name` = 'binary'), NULL, `coll_result`.`name`)
|
||||||
|
when 'MYSQL_TYPE_LONG_BLOB' then if((`cs_result`.`name` = 'binary'), NULL, `coll_result`.`name`)
|
||||||
|
when 'MYSQL_TYPE_ENUM' then if((`cs_result`.`name` = 'binary'), NULL, `coll_result`.`name`)
|
||||||
|
when 'MYSQL_TYPE_SET' then if((`cs_result`.`name` = 'binary'), NULL, `coll_result`.`name`)
|
||||||
|
else NULL end) AS `COLLATION_NAME`,
|
||||||
|
if((`rtn`.`type` = 'PROCEDURE'), NULL,
|
||||||
|
`rtn`.`result_data_type_utf8`) AS `DTD_IDENTIFIER`,
|
||||||
|
'SQL' AS `ROUTINE_BODY`,
|
||||||
|
if(can_access_routine(`sch`.`name`, `rtn`.`name`, `rtn`.`type`, `rtn`.`definer`, true), `rtn`.`definition_utf8`,
|
||||||
|
NULL) AS `ROUTINE_DEFINITION`,
|
||||||
|
NULL AS `EXTERNAL_NAME`,
|
||||||
|
`rtn`.`external_language` AS `EXTERNAL_LANGUAGE`,
|
||||||
|
'SQL' AS `PARAMETER_STYLE`,
|
||||||
|
if((`rtn`.`is_deterministic` = 0), 'NO', 'YES') AS `IS_DETERMINISTIC`,
|
||||||
|
`rtn`.`sql_data_access` AS `SQL_DATA_ACCESS`,
|
||||||
|
NULL AS `SQL_PATH`,
|
||||||
|
`rtn`.`security_type` AS `SECURITY_TYPE`,
|
||||||
|
`rtn`.`created` AS `CREATED`,
|
||||||
|
`rtn`.`last_altered` AS `LAST_ALTERED`,
|
||||||
|
`rtn`.`sql_mode` AS `SQL_MODE`,
|
||||||
|
`rtn`.`comment` AS `ROUTINE_COMMENT`,
|
||||||
|
`rtn`.`definer` AS `DEFINER`,
|
||||||
|
`cs_client`.`name` AS `CHARACTER_SET_CLIENT`,
|
||||||
|
`coll_conn`.`name` AS `COLLATION_CONNECTION`,
|
||||||
|
`coll_db`.`name` AS `DATABASE_COLLATION`
|
||||||
|
from ((((((((`mysql`.`routines` `rtn` join `mysql`.`schemata` `sch`
|
||||||
|
on ((`rtn`.`schema_id` = `sch`.`id`))) join `mysql`.`catalogs` `cat`
|
||||||
|
on ((`cat`.`id` = `sch`.`catalog_id`))) join `mysql`.`collations` `coll_client`
|
||||||
|
on ((`coll_client`.`id` = `rtn`.`client_collation_id`))) join `mysql`.`character_sets` `cs_client`
|
||||||
|
on ((`cs_client`.`id` = `coll_client`.`character_set_id`))) join `mysql`.`collations` `coll_conn`
|
||||||
|
on ((`coll_conn`.`id` = `rtn`.`connection_collation_id`))) join `mysql`.`collations` `coll_db`
|
||||||
|
on ((`coll_db`.`id` = `rtn`.`schema_collation_id`))) left join `mysql`.`collations` `coll_result`
|
||||||
|
on ((`coll_result`.`id` = `rtn`.`result_collation_id`))) left join `mysql`.`character_sets` `cs_result`
|
||||||
|
on ((`cs_result`.`id` = `coll_result`.`character_set_id`)))
|
||||||
|
where (0 <> can_access_routine(`sch`.`name`, `rtn`.`name`, `rtn`.`type`, `rtn`.`definer`, false));
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
create view information_schema.SCHEMATA as
|
||||||
|
select (`cat`.`name` collate utf8mb3_tolower_ci) AS `CATALOG_NAME`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `SCHEMA_NAME`,
|
||||||
|
`cs`.`name` AS `DEFAULT_CHARACTER_SET_NAME`,
|
||||||
|
`col`.`name` AS `DEFAULT_COLLATION_NAME`,
|
||||||
|
NULL AS `SQL_PATH`,
|
||||||
|
`sch`.`default_encryption` AS `DEFAULT_ENCRYPTION`
|
||||||
|
from (((`mysql`.`schemata` `sch` join `mysql`.`catalogs` `cat`
|
||||||
|
on ((`cat`.`id` = `sch`.`catalog_id`))) join `mysql`.`collations` `col`
|
||||||
|
on ((`sch`.`default_collation_id` = `col`.`id`))) join `mysql`.`character_sets` `cs`
|
||||||
|
on ((`col`.`character_set_id` = `cs`.`id`)))
|
||||||
|
where (0 <> can_access_database(`sch`.`name`));
|
||||||
|
|
@ -0,0 +1,7 @@
|
|||||||
|
create view information_schema.SCHEMATA_EXTENSIONS as
|
||||||
|
select (`cat`.`name` collate utf8mb3_tolower_ci) AS `CATALOG_NAME`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `SCHEMA_NAME`,
|
||||||
|
get_dd_schema_options(`sch`.`options`) AS `OPTIONS`
|
||||||
|
from (`mysql`.`schemata` `sch` join `mysql`.`catalogs` `cat` on ((`cat`.`id` = `sch`.`catalog_id`)))
|
||||||
|
where (0 <> can_access_database(`sch`.`name`));
|
||||||
|
|
@ -0,0 +1,44 @@
|
|||||||
|
create view information_schema.STATISTICS as
|
||||||
|
select (`cat`.`name` collate utf8mb3_tolower_ci) AS `TABLE_CATALOG`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `TABLE_SCHEMA`,
|
||||||
|
(`tbl`.`name` collate utf8mb3_tolower_ci) AS `TABLE_NAME`,
|
||||||
|
if(((`idx`.`type` = 'PRIMARY') or (`idx`.`type` = 'UNIQUE')), 0, 1) AS `NON_UNIQUE`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `INDEX_SCHEMA`,
|
||||||
|
(`idx`.`name` collate utf8mb3_tolower_ci) AS `INDEX_NAME`,
|
||||||
|
`icu`.`ordinal_position` AS `SEQ_IN_INDEX`,
|
||||||
|
if((`col`.`hidden` = 'SQL'), NULL,
|
||||||
|
(`col`.`name` collate utf8mb3_tolower_ci)) AS `COLUMN_NAME`,
|
||||||
|
(case when (`icu`.`order` = 'DESC') then 'D' when (`icu`.`order` = 'ASC') then 'A' else NULL end) AS `COLLATION`,
|
||||||
|
internal_index_column_cardinality(`sch`.`name`, `tbl`.`name`, `idx`.`name`, `col`.`name`,
|
||||||
|
`idx`.`ordinal_position`, `icu`.`ordinal_position`,
|
||||||
|
if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`,
|
||||||
|
((`tbl`.`hidden` <> 'Visible') or (0 <> `idx`.`hidden`) or
|
||||||
|
(0 <> `icu`.`hidden`)),
|
||||||
|
coalesce(`stat`.`cardinality`, cast(-(1) as unsigned)),
|
||||||
|
coalesce(cast(`stat`.`cached_time` as unsigned), 0)) AS `CARDINALITY`,
|
||||||
|
get_dd_index_sub_part_length(`icu`.`length`, `col`.`type`, `col`.`char_length`, `col`.`collation_id`,
|
||||||
|
`idx`.`type`) AS `SUB_PART`,
|
||||||
|
NULL AS `PACKED`,
|
||||||
|
if((`col`.`is_nullable` = 1), 'YES', '') AS `NULLABLE`,
|
||||||
|
(case
|
||||||
|
when (`idx`.`type` = 'SPATIAL') then 'SPATIAL'
|
||||||
|
when (`idx`.`algorithm` = 'SE_PRIVATE') then ''
|
||||||
|
else `idx`.`algorithm` end) AS `INDEX_TYPE`,
|
||||||
|
if(((`idx`.`type` = 'PRIMARY') or (`idx`.`type` = 'UNIQUE')), '',
|
||||||
|
if(internal_keys_disabled(`tbl`.`options`), 'disabled', '')) AS `COMMENT`,
|
||||||
|
`idx`.`comment` AS `INDEX_COMMENT`,
|
||||||
|
if(`idx`.`is_visible`, 'YES', 'NO') AS `IS_VISIBLE`,
|
||||||
|
if((`col`.`hidden` = 'SQL'), `col`.`generation_expression_utf8`, NULL) AS `EXPRESSION`
|
||||||
|
from (((((((`mysql`.`index_column_usage` `icu` join `mysql`.`indexes` `idx`
|
||||||
|
on ((`idx`.`id` = `icu`.`index_id`))) join `mysql`.`tables` `tbl`
|
||||||
|
on ((`idx`.`table_id` = `tbl`.`id`))) join `mysql`.`columns` `col`
|
||||||
|
on ((`icu`.`column_id` = `col`.`id`))) join `mysql`.`schemata` `sch`
|
||||||
|
on ((`tbl`.`schema_id` = `sch`.`id`))) join `mysql`.`catalogs` `cat`
|
||||||
|
on ((`cat`.`id` = `sch`.`catalog_id`))) join `mysql`.`collations` `coll`
|
||||||
|
on ((`tbl`.`collation_id` = `coll`.`id`))) left join `mysql`.`index_stats` `stat`
|
||||||
|
on (((`tbl`.`name` = `stat`.`table_name`) and (`sch`.`name` = `stat`.`schema_name`) and
|
||||||
|
(`idx`.`name` = `stat`.`index_name`) and (`col`.`name` = `stat`.`column_name`))))
|
||||||
|
where ((0 <> can_access_table(`sch`.`name`, `tbl`.`name`)) and
|
||||||
|
(0 <> is_visible_dd_object(`tbl`.`hidden`, ((0 <> `idx`.`hidden`) or (0 <> `icu`.`hidden`)), `idx`.`options`)));
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
create view information_schema.ST_GEOMETRY_COLUMNS as
|
||||||
|
select `information_schema`.`cols`.`TABLE_CATALOG` AS `TABLE_CATALOG`,
|
||||||
|
`information_schema`.`cols`.`TABLE_SCHEMA` AS `TABLE_SCHEMA`,
|
||||||
|
`information_schema`.`cols`.`TABLE_NAME` AS `TABLE_NAME`,
|
||||||
|
`information_schema`.`cols`.`COLUMN_NAME` AS `COLUMN_NAME`,
|
||||||
|
`information_schema`.`srs`.`SRS_NAME` AS `SRS_NAME`,
|
||||||
|
`information_schema`.`cols`.`SRS_ID` AS `SRS_ID`,
|
||||||
|
`information_schema`.`cols`.`DATA_TYPE` AS `GEOMETRY_TYPE_NAME`
|
||||||
|
from (`information_schema`.`COLUMNS` `cols` left join `information_schema`.`ST_SPATIAL_REFERENCE_SYSTEMS` `srs`
|
||||||
|
on ((`information_schema`.`cols`.`SRS_ID` = `information_schema`.`srs`.`SRS_ID`)))
|
||||||
|
where (`information_schema`.`cols`.`DATA_TYPE` in
|
||||||
|
('geometry', 'point', 'linestring', 'polygon', 'multipoint', 'multilinestring', 'multipolygon',
|
||||||
|
'geomcollection'));
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
create view information_schema.ST_SPATIAL_REFERENCE_SYSTEMS as
|
||||||
|
select `mysql`.`st_spatial_reference_systems`.`name` AS `SRS_NAME`,
|
||||||
|
`mysql`.`st_spatial_reference_systems`.`id` AS `SRS_ID`,
|
||||||
|
`mysql`.`st_spatial_reference_systems`.`organization` AS `ORGANIZATION`,
|
||||||
|
`mysql`.`st_spatial_reference_systems`.`organization_coordsys_id` AS `ORGANIZATION_COORDSYS_ID`,
|
||||||
|
`mysql`.`st_spatial_reference_systems`.`definition` AS `DEFINITION`,
|
||||||
|
`mysql`.`st_spatial_reference_systems`.`description` AS `DESCRIPTION`
|
||||||
|
from `mysql`.`st_spatial_reference_systems`;
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
create view information_schema.ST_UNITS_OF_MEASURE as
|
||||||
|
select `st_units_of_measure`.`UNIT_NAME` AS `UNIT_NAME`,
|
||||||
|
`st_units_of_measure`.`UNIT_TYPE` AS `UNIT_TYPE`,
|
||||||
|
`st_units_of_measure`.`CONVERSION_FACTOR` AS `CONVERSION_FACTOR`,
|
||||||
|
`st_units_of_measure`.`DESCRIPTION` AS `DESCRIPTION`
|
||||||
|
from json_table(
|
||||||
|
'[["metre","LINEAR","",1],["millimetre","LINEAR","",0.001],["centimetre","LINEAR","",0.01],["German legal metre","LINEAR","",1.0000135965],["foot","LINEAR","",0.3048],["US survey foot","LINEAR","",0.30480060960121924],["Clarke\'s yard","LINEAR","",0.9143917962],["Clarke\'s foot","LINEAR","",0.3047972654],["British link (Sears 1922 truncated)","LINEAR","",0.20116756],["nautical mile","LINEAR","",1852],["fathom","LINEAR","",1.8288],["US survey chain","LINEAR","",20.11684023368047],["US survey link","LINEAR","",0.2011684023368047],["US survey mile","LINEAR","",1609.3472186944375],["Indian yard","LINEAR","",0.9143985307444408],["kilometre","LINEAR","",1000],["Clarke\'s chain","LINEAR","",20.1166195164],["Clarke\'s link","LINEAR","",0.201166195164],["British yard (Benoit 1895 A)","LINEAR","",0.9143992],["British yard (Sears 1922)","LINEAR","",0.9143984146160287],["British foot (Sears 1922)","LINEAR","",0.3047994715386762],["Gold Coast foot","LINEAR","",0.3047997101815088],["British chain (Sears 1922)","LINEAR","",20.116765121552632],["yard","LINEAR","",0.9144],["British link (Sears 1922)","LINEAR","",0.2011676512155263],["British foot (Benoit 1895 A)","LINEAR","",0.3047997333333333],["Indian foot (1962)","LINEAR","",0.3047996],["British chain (Benoit 1895 A)","LINEAR","",20.1167824],["chain","LINEAR","",20.1168],["British link (Benoit 1895 A)","LINEAR","",0.201167824],["British yard (Benoit 1895 B)","LINEAR","",0.9143992042898124],["British foot (Benoit 1895 B)","LINEAR","",0.30479973476327077],["British chain (Benoit 1895 B)","LINEAR","",20.116782494375872],["British link (Benoit 1895 B)","LINEAR","",0.2011678249437587],["British foot (1865)","LINEAR","",0.30480083333333335],["Indian foot","LINEAR","",0.30479951024814694],["Indian foot (1937)","LINEAR","",0.30479841],["Indian foot (1975)","LINEAR","",0.3047995],["British foot (1936)","LINEAR","",0.3048007491],["Indian yard (1937)","LINEAR","",0.91439523],["Indian yard (1962)","LINEAR","",0.9143988],["Indian yard (1975)","LINEAR","",0.9143985],["Statute mile","LINEAR","",1609.344],["link","LINEAR","",0.201168],["British yard (Sears 1922 truncated)","LINEAR","",0.914398],["British foot (Sears 1922 truncated)","LINEAR","",0.30479933333333337],["British chain (Sears 1922 truncated)","LINEAR","",20.116756]]',
|
||||||
|
'$[*]'
|
||||||
|
columns (`UNIT_NAME` varchar(255) character set utf8mb4 path '$[0]', `UNIT_TYPE` varchar(7) character set utf8mb4 path '$[1]', `DESCRIPTION` varchar(255) character set utf8mb4 path '$[2]', `CONVERSION_FACTOR` double path '$[3]')) `st_units_of_measure`;
|
||||||
|
|
@ -0,0 +1,75 @@
|
|||||||
|
create view information_schema.TABLES as
|
||||||
|
select (`cat`.`name` collate utf8mb3_tolower_ci) AS `TABLE_CATALOG`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `TABLE_SCHEMA`,
|
||||||
|
(`tbl`.`name` collate utf8mb3_tolower_ci) AS `TABLE_NAME`,
|
||||||
|
`tbl`.`type` AS `TABLE_TYPE`,
|
||||||
|
if((`tbl`.`type` = 'BASE TABLE'), `tbl`.`engine`, NULL) AS `ENGINE`,
|
||||||
|
if((`tbl`.`type` = 'VIEW'), NULL, 10) AS `VERSION`,
|
||||||
|
`tbl`.`row_format` AS `ROW_FORMAT`,
|
||||||
|
if((`tbl`.`type` = 'VIEW'), NULL,
|
||||||
|
internal_table_rows(`sch`.`name`, `tbl`.`name`, if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`, (`tbl`.`hidden` <> 'Visible'), `ts`.`se_private_data`,
|
||||||
|
coalesce(`stat`.`table_rows`, 0),
|
||||||
|
coalesce(cast(`stat`.`cached_time` as unsigned), 0))) AS `TABLE_ROWS`,
|
||||||
|
if((`tbl`.`type` = 'VIEW'), NULL,
|
||||||
|
internal_avg_row_length(`sch`.`name`, `tbl`.`name`, if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`, (`tbl`.`hidden` <> 'Visible'), `ts`.`se_private_data`,
|
||||||
|
coalesce(`stat`.`avg_row_length`, 0),
|
||||||
|
coalesce(cast(`stat`.`cached_time` as unsigned), 0))) AS `AVG_ROW_LENGTH`,
|
||||||
|
if((`tbl`.`type` = 'VIEW'), NULL,
|
||||||
|
internal_data_length(`sch`.`name`, `tbl`.`name`, if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`, (`tbl`.`hidden` <> 'Visible'), `ts`.`se_private_data`,
|
||||||
|
coalesce(`stat`.`data_length`, 0),
|
||||||
|
coalesce(cast(`stat`.`cached_time` as unsigned), 0))) AS `DATA_LENGTH`,
|
||||||
|
if((`tbl`.`type` = 'VIEW'), NULL,
|
||||||
|
internal_max_data_length(`sch`.`name`, `tbl`.`name`, if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`, (`tbl`.`hidden` <> 'Visible'), `ts`.`se_private_data`,
|
||||||
|
coalesce(`stat`.`max_data_length`, 0),
|
||||||
|
coalesce(cast(`stat`.`cached_time` as unsigned), 0))) AS `MAX_DATA_LENGTH`,
|
||||||
|
if((`tbl`.`type` = 'VIEW'), NULL,
|
||||||
|
internal_index_length(`sch`.`name`, `tbl`.`name`, if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`, (`tbl`.`hidden` <> 'Visible'), `ts`.`se_private_data`,
|
||||||
|
coalesce(`stat`.`index_length`, 0),
|
||||||
|
coalesce(cast(`stat`.`cached_time` as unsigned), 0))) AS `INDEX_LENGTH`,
|
||||||
|
if((`tbl`.`type` = 'VIEW'), NULL,
|
||||||
|
internal_data_free(`sch`.`name`, `tbl`.`name`, if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`, (`tbl`.`hidden` <> 'Visible'), `ts`.`se_private_data`,
|
||||||
|
coalesce(`stat`.`data_free`, 0),
|
||||||
|
coalesce(cast(`stat`.`cached_time` as unsigned), 0))) AS `DATA_FREE`,
|
||||||
|
if((`tbl`.`type` = 'VIEW'), NULL,
|
||||||
|
internal_auto_increment(`sch`.`name`, `tbl`.`name`, if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`,
|
||||||
|
((0 <> is_visible_dd_object(`tbl`.`hidden`, false, `tbl`.`options`)) is false),
|
||||||
|
`ts`.`se_private_data`, coalesce(`stat`.`auto_increment`, 0),
|
||||||
|
coalesce(cast(`stat`.`cached_time` as unsigned), 0),
|
||||||
|
`tbl`.`se_private_data`)) AS `AUTO_INCREMENT`,
|
||||||
|
`tbl`.`created` AS `CREATE_TIME`,
|
||||||
|
if((`tbl`.`type` = 'VIEW'), NULL,
|
||||||
|
internal_update_time(`sch`.`name`, `tbl`.`name`, if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`, (`tbl`.`hidden` <> 'Visible'), `ts`.`se_private_data`,
|
||||||
|
coalesce(cast(`stat`.`update_time` as unsigned), 0),
|
||||||
|
coalesce(cast(`stat`.`cached_time` as unsigned), 0))) AS `UPDATE_TIME`,
|
||||||
|
if((`tbl`.`type` = 'VIEW'), NULL,
|
||||||
|
internal_check_time(`sch`.`name`, `tbl`.`name`, if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`, (`tbl`.`hidden` <> 'Visible'), `ts`.`se_private_data`,
|
||||||
|
coalesce(cast(`stat`.`check_time` as unsigned), 0),
|
||||||
|
coalesce(cast(`stat`.`cached_time` as unsigned), 0))) AS `CHECK_TIME`,
|
||||||
|
`col`.`name` AS `TABLE_COLLATION`,
|
||||||
|
if((`tbl`.`type` = 'VIEW'), NULL,
|
||||||
|
internal_checksum(`sch`.`name`, `tbl`.`name`, if((`tbl`.`partition_type` is null), `tbl`.`engine`, ''),
|
||||||
|
`tbl`.`se_private_id`, (`tbl`.`hidden` <> 'Visible'), `ts`.`se_private_data`,
|
||||||
|
coalesce(`stat`.`checksum`, 0),
|
||||||
|
coalesce(cast(`stat`.`cached_time` as unsigned), 0))) AS `CHECKSUM`,
|
||||||
|
if((`tbl`.`type` = 'VIEW'), NULL, get_dd_create_options(`tbl`.`options`, if(
|
||||||
|
(ifnull(`tbl`.`partition_expression`, 'NOT_PART_TBL') = 'NOT_PART_TBL'), 0, 1),
|
||||||
|
if((`sch`.`default_encryption` = 'YES'), 1, 0))) AS `CREATE_OPTIONS`,
|
||||||
|
internal_get_comment_or_error(`sch`.`name`, `tbl`.`name`, `tbl`.`type`, `tbl`.`options`,
|
||||||
|
`tbl`.`comment`) AS `TABLE_COMMENT`
|
||||||
|
from (((((`mysql`.`tables` `tbl` join `mysql`.`schemata` `sch`
|
||||||
|
on ((`tbl`.`schema_id` = `sch`.`id`))) join `mysql`.`catalogs` `cat`
|
||||||
|
on ((`cat`.`id` = `sch`.`catalog_id`))) left join `mysql`.`collations` `col`
|
||||||
|
on ((`tbl`.`collation_id` = `col`.`id`))) left join `mysql`.`tablespaces` `ts`
|
||||||
|
on ((`tbl`.`tablespace_id` = `ts`.`id`))) left join `mysql`.`table_stats` `stat`
|
||||||
|
on (((`tbl`.`name` = `stat`.`table_name`) and (`sch`.`name` = `stat`.`schema_name`))))
|
||||||
|
where ((0 <> can_access_table(`sch`.`name`, `tbl`.`name`)) and (0 <> is_visible_dd_object(`tbl`.`hidden`)));
|
||||||
|
|
@ -0,0 +1,4 @@
|
|||||||
|
create view information_schema.TABLESPACES_EXTENSIONS as
|
||||||
|
select `tsps`.`name` AS `TABLESPACE_NAME`, `tsps`.`engine_attribute` AS `ENGINE_ATTRIBUTE`
|
||||||
|
from `mysql`.`tablespaces` `tsps`;
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
create view information_schema.TABLES_EXTENSIONS as
|
||||||
|
select `cat`.`name` AS `TABLE_CATALOG`,
|
||||||
|
`sch`.`name` AS `TABLE_SCHEMA`,
|
||||||
|
`tbl`.`name` AS `TABLE_NAME`,
|
||||||
|
`tbl`.`engine_attribute` AS `ENGINE_ATTRIBUTE`,
|
||||||
|
`tbl`.`secondary_engine_attribute` AS `SECONDARY_ENGINE_ATTRIBUTE`
|
||||||
|
from ((`mysql`.`tables` `tbl` join `mysql`.`schemata` `sch`
|
||||||
|
on ((`tbl`.`schema_id` = `sch`.`id`))) join `mysql`.`catalogs` `cat` on ((`cat`.`id` = `sch`.`catalog_id`)))
|
||||||
|
where ((0 <> can_access_table(`sch`.`name`, `tbl`.`name`)) and (0 <> is_visible_dd_object(`tbl`.`hidden`)));
|
||||||
|
|
@ -0,0 +1,34 @@
|
|||||||
|
create view information_schema.TABLE_CONSTRAINTS as
|
||||||
|
select (`cat`.`name` collate utf8mb3_tolower_ci) AS `CONSTRAINT_CATALOG`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `CONSTRAINT_SCHEMA`,
|
||||||
|
`constraints`.`CONSTRAINT_NAME` AS `CONSTRAINT_NAME`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `TABLE_SCHEMA`,
|
||||||
|
(`tbl`.`name` collate utf8mb3_tolower_ci) AS `TABLE_NAME`,
|
||||||
|
`constraints`.`CONSTRAINT_TYPE` AS `CONSTRAINT_TYPE`,
|
||||||
|
`constraints`.`ENFORCED` AS `ENFORCED`
|
||||||
|
from (((`mysql`.`tables` `tbl` join `mysql`.`schemata` `sch`
|
||||||
|
on ((`tbl`.`schema_id` = `sch`.`id`))) join `mysql`.`catalogs` `cat`
|
||||||
|
on ((`cat`.`id` = `sch`.`catalog_id`))) join lateral (select `idx`.`name` AS `CONSTRAINT_NAME`,
|
||||||
|
if((`idx`.`type` = 'PRIMARY'), 'PRIMARY KEY', `idx`.`type`) AS `CONSTRAINT_TYPE`,
|
||||||
|
'YES' AS `ENFORCED`
|
||||||
|
from `mysql`.`indexes` `idx`
|
||||||
|
where ((`idx`.`table_id` = `tbl`.`id`) and
|
||||||
|
(`idx`.`type` in ('PRIMARY', 'UNIQUE')) and (0 <>
|
||||||
|
is_visible_dd_object(
|
||||||
|
`tbl`.`hidden`,
|
||||||
|
`idx`.`hidden`,
|
||||||
|
`idx`.`options`)))
|
||||||
|
union all
|
||||||
|
select (`fk`.`name` collate utf8mb3_tolower_ci) AS `CONSTRAINT_NAME`,
|
||||||
|
'FOREIGN KEY' AS `CONSTRAINT_TYPE`,
|
||||||
|
'YES' AS `ENFORCED`
|
||||||
|
from `mysql`.`foreign_keys` `fk`
|
||||||
|
where (`fk`.`table_id` = `tbl`.`id`)
|
||||||
|
union all
|
||||||
|
select `cc`.`name` AS `CONSTRAINT_NAME`,
|
||||||
|
'CHECK' AS `CONSTRAINT_TYPE`,
|
||||||
|
`cc`.`enforced` AS `ENFORCED`
|
||||||
|
from `mysql`.`check_constraints` `cc`
|
||||||
|
where (`cc`.`table_id` = `tbl`.`id`)) `constraints`)
|
||||||
|
where ((0 <> can_access_table(`sch`.`name`, `tbl`.`name`)) and (0 <> is_visible_dd_object(`tbl`.`hidden`)));
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
create view information_schema.TABLE_CONSTRAINTS_EXTENSIONS as
|
||||||
|
select `cat`.`name` AS `CONSTRAINT_CATALOG`,
|
||||||
|
`sch`.`name` AS `CONSTRAINT_SCHEMA`,
|
||||||
|
`idx`.`name` AS `CONSTRAINT_NAME`,
|
||||||
|
`tbl`.`name` AS `TABLE_NAME`,
|
||||||
|
`idx`.`engine_attribute` AS `ENGINE_ATTRIBUTE`,
|
||||||
|
`idx`.`secondary_engine_attribute` AS `SECONDARY_ENGINE_ATTRIBUTE`
|
||||||
|
from (((`mysql`.`indexes` `idx` join `mysql`.`tables` `tbl`
|
||||||
|
on ((`idx`.`table_id` = `tbl`.`id`))) join `mysql`.`schemata` `sch`
|
||||||
|
on ((`tbl`.`schema_id` = `sch`.`id`))) join `mysql`.`catalogs` `cat` on ((`cat`.`id` = `sch`.`catalog_id`)))
|
||||||
|
where ((0 <> can_access_table(`sch`.`name`, `tbl`.`name`)) and
|
||||||
|
(0 <> is_visible_dd_object(`tbl`.`hidden`, false, `idx`.`options`)));
|
||||||
|
|
@ -0,0 +1,34 @@
|
|||||||
|
create view information_schema.TRIGGERS as
|
||||||
|
select (`cat`.`name` collate utf8mb3_tolower_ci) AS `TRIGGER_CATALOG`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `TRIGGER_SCHEMA`,
|
||||||
|
`trg`.`name` AS `TRIGGER_NAME`,
|
||||||
|
`trg`.`event_type` AS `EVENT_MANIPULATION`,
|
||||||
|
(`cat`.`name` collate utf8mb3_tolower_ci) AS `EVENT_OBJECT_CATALOG`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `EVENT_OBJECT_SCHEMA`,
|
||||||
|
(`tbl`.`name` collate utf8mb3_tolower_ci) AS `EVENT_OBJECT_TABLE`,
|
||||||
|
`trg`.`action_order` AS `ACTION_ORDER`,
|
||||||
|
NULL AS `ACTION_CONDITION`,
|
||||||
|
`trg`.`action_statement_utf8` AS `ACTION_STATEMENT`,
|
||||||
|
'ROW' AS `ACTION_ORIENTATION`,
|
||||||
|
`trg`.`action_timing` AS `ACTION_TIMING`,
|
||||||
|
NULL AS `ACTION_REFERENCE_OLD_TABLE`,
|
||||||
|
NULL AS `ACTION_REFERENCE_NEW_TABLE`,
|
||||||
|
'OLD' AS `ACTION_REFERENCE_OLD_ROW`,
|
||||||
|
'NEW' AS `ACTION_REFERENCE_NEW_ROW`,
|
||||||
|
`trg`.`created` AS `CREATED`,
|
||||||
|
`trg`.`sql_mode` AS `SQL_MODE`,
|
||||||
|
`trg`.`definer` AS `DEFINER`,
|
||||||
|
`cs_client`.`name` AS `CHARACTER_SET_CLIENT`,
|
||||||
|
`coll_conn`.`name` AS `COLLATION_CONNECTION`,
|
||||||
|
`coll_db`.`name` AS `DATABASE_COLLATION`
|
||||||
|
from (((((((`mysql`.`triggers` `trg` join `mysql`.`tables` `tbl`
|
||||||
|
on ((`tbl`.`id` = `trg`.`table_id`))) join `mysql`.`schemata` `sch`
|
||||||
|
on ((`tbl`.`schema_id` = `sch`.`id`))) join `mysql`.`catalogs` `cat`
|
||||||
|
on ((`cat`.`id` = `sch`.`catalog_id`))) join `mysql`.`collations` `coll_client`
|
||||||
|
on ((`coll_client`.`id` = `trg`.`client_collation_id`))) join `mysql`.`character_sets` `cs_client`
|
||||||
|
on ((`cs_client`.`id` = `coll_client`.`character_set_id`))) join `mysql`.`collations` `coll_conn`
|
||||||
|
on ((`coll_conn`.`id` = `trg`.`connection_collation_id`))) join `mysql`.`collations` `coll_db`
|
||||||
|
on ((`coll_db`.`id` = `trg`.`schema_collation_id`)))
|
||||||
|
where ((`tbl`.`type` <> 'VIEW') and (0 <> can_access_trigger(`sch`.`name`, `tbl`.`name`)) and
|
||||||
|
(0 <> is_visible_dd_object(`tbl`.`hidden`)));
|
||||||
|
|
@ -0,0 +1,7 @@
|
|||||||
|
create view information_schema.USER_ATTRIBUTES as
|
||||||
|
select `mysql`.`user`.`User` AS `USER`,
|
||||||
|
`mysql`.`user`.`Host` AS `HOST`,
|
||||||
|
json_unquote(json_extract(`mysql`.`user`.`User_attributes`, '$.metadata')) AS `ATTRIBUTE`
|
||||||
|
from `mysql`.`user`
|
||||||
|
where (0 <> can_access_user(`mysql`.`user`.`User`, `mysql`.`user`.`Host`));
|
||||||
|
|
@ -0,0 +1,20 @@
|
|||||||
|
create view information_schema.VIEWS as
|
||||||
|
select (`cat`.`name` collate utf8mb3_tolower_ci) AS `TABLE_CATALOG`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `TABLE_SCHEMA`,
|
||||||
|
(`vw`.`name` collate utf8mb3_tolower_ci) AS `TABLE_NAME`,
|
||||||
|
if((can_access_view(`sch`.`name`, `vw`.`name`, `vw`.`view_definer`, `vw`.`options`) = true),
|
||||||
|
`vw`.`view_definition_utf8`, '') AS `VIEW_DEFINITION`,
|
||||||
|
`vw`.`view_check_option` AS `CHECK_OPTION`,
|
||||||
|
`vw`.`view_is_updatable` AS `IS_UPDATABLE`,
|
||||||
|
`vw`.`view_definer` AS `DEFINER`,
|
||||||
|
if((`vw`.`view_security_type` = 'DEFAULT'), 'DEFINER', `vw`.`view_security_type`) AS `SECURITY_TYPE`,
|
||||||
|
`cs`.`name` AS `CHARACTER_SET_CLIENT`,
|
||||||
|
`conn_coll`.`name` AS `COLLATION_CONNECTION`
|
||||||
|
from (((((`mysql`.`tables` `vw` join `mysql`.`schemata` `sch`
|
||||||
|
on ((`vw`.`schema_id` = `sch`.`id`))) join `mysql`.`catalogs` `cat`
|
||||||
|
on ((`cat`.`id` = `sch`.`catalog_id`))) join `mysql`.`collations` `conn_coll`
|
||||||
|
on ((`conn_coll`.`id` = `vw`.`view_connection_collation_id`))) join `mysql`.`collations` `client_coll`
|
||||||
|
on ((`client_coll`.`id` = `vw`.`view_client_collation_id`))) join `mysql`.`character_sets` `cs`
|
||||||
|
on ((`cs`.`id` = `client_coll`.`character_set_id`)))
|
||||||
|
where ((0 <> can_access_table(`sch`.`name`, `vw`.`name`)) and (`vw`.`type` = 'VIEW'));
|
||||||
|
|
@ -0,0 +1,17 @@
|
|||||||
|
create view information_schema.VIEW_ROUTINE_USAGE as
|
||||||
|
select (`cat`.`name` collate utf8mb3_tolower_ci) AS `TABLE_CATALOG`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `TABLE_SCHEMA`,
|
||||||
|
(`vw`.`name` collate utf8mb3_tolower_ci) AS `TABLE_NAME`,
|
||||||
|
(`vru`.`routine_catalog` collate utf8mb3_tolower_ci) AS `SPECIFIC_CATALOG`,
|
||||||
|
(`vru`.`routine_schema` collate utf8mb3_tolower_ci) AS `SPECIFIC_SCHEMA`,
|
||||||
|
`vru`.`routine_name` AS `SPECIFIC_NAME`
|
||||||
|
from ((((`mysql`.`tables` `vw` join `mysql`.`schemata` `sch`
|
||||||
|
on ((`vw`.`schema_id` = `sch`.`id`))) join `mysql`.`catalogs` `cat`
|
||||||
|
on ((`cat`.`id` = `sch`.`catalog_id`))) join `mysql`.`view_routine_usage` `vru`
|
||||||
|
on ((`vru`.`view_id` = `vw`.`id`))) join `mysql`.`routines` `rtn`
|
||||||
|
on (((`vru`.`routine_catalog` = `cat`.`name`) and (`vru`.`routine_schema` = `sch`.`name`) and
|
||||||
|
(`vru`.`routine_name` = `rtn`.`name`))))
|
||||||
|
where ((`vw`.`type` = 'VIEW') and
|
||||||
|
(0 <> can_access_routine(`vru`.`routine_schema`, `vru`.`routine_name`, `rtn`.`type`, `rtn`.`definer`, false)) and
|
||||||
|
(0 <> can_access_view(`sch`.`name`, `vw`.`name`, `vw`.`view_definer`, `vw`.`options`)));
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
create view information_schema.VIEW_TABLE_USAGE as
|
||||||
|
select (`cat`.`name` collate utf8mb3_tolower_ci) AS `VIEW_CATALOG`,
|
||||||
|
(`sch`.`name` collate utf8mb3_tolower_ci) AS `VIEW_SCHEMA`,
|
||||||
|
(`vw`.`name` collate utf8mb3_tolower_ci) AS `VIEW_NAME`,
|
||||||
|
(`vtu`.`table_catalog` collate utf8mb3_tolower_ci) AS `TABLE_CATALOG`,
|
||||||
|
(`vtu`.`table_schema` collate utf8mb3_tolower_ci) AS `TABLE_SCHEMA`,
|
||||||
|
(`vtu`.`table_name` collate utf8mb3_tolower_ci) AS `TABLE_NAME`
|
||||||
|
from (((`mysql`.`tables` `vw` join `mysql`.`schemata` `sch`
|
||||||
|
on ((`vw`.`schema_id` = `sch`.`id`))) join `mysql`.`catalogs` `cat`
|
||||||
|
on ((`cat`.`id` = `sch`.`catalog_id`))) join `mysql`.`view_table_usage` `vtu` on ((`vtu`.`view_id` = `vw`.`id`)))
|
||||||
|
where ((0 <> can_access_table(`vtu`.`table_schema`, `vtu`.`table_name`)) and (`vw`.`type` = 'VIEW') and
|
||||||
|
(0 <> can_access_view(`sch`.`name`, `vw`.`name`, `vw`.`view_definer`, `vw`.`options`)));
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
create table mysql.columns_priv
|
||||||
|
(
|
||||||
|
Host char(255) charset ascii default '' not null,
|
||||||
|
Db char(64) default '' not null,
|
||||||
|
User char(32) default '' not null,
|
||||||
|
Table_name char(64) default '' not null,
|
||||||
|
Column_name char(64) default '' not null,
|
||||||
|
Timestamp timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
|
||||||
|
Column_priv set ('Select', 'Insert', 'Update', 'References') charset utf8mb3 default '' not null,
|
||||||
|
primary key (Host, User, Db, Table_name, Column_name)
|
||||||
|
)
|
||||||
|
comment 'Column privileges' collate = utf8mb3_bin
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
create table mysql.component
|
||||||
|
(
|
||||||
|
component_id int unsigned auto_increment
|
||||||
|
primary key,
|
||||||
|
component_group_id int unsigned not null,
|
||||||
|
component_urn text not null
|
||||||
|
)
|
||||||
|
comment 'Components' charset = utf8mb3
|
||||||
|
row_format = DYNAMIC;
|
||||||
|
|
@ -0,0 +1,33 @@
|
|||||||
|
create table mysql.db
|
||||||
|
(
|
||||||
|
Host char(255) charset ascii default '' not null,
|
||||||
|
Db char(64) default '' not null,
|
||||||
|
User char(32) default '' not null,
|
||||||
|
Select_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Insert_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Update_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Delete_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Create_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Drop_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Grant_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
References_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Index_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Alter_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Create_tmp_table_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Lock_tables_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Create_view_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Show_view_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Create_routine_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Alter_routine_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Execute_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Event_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Trigger_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
primary key (Host, User, Db)
|
||||||
|
)
|
||||||
|
comment 'Database privileges' collate = utf8mb3_bin
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
||||||
|
create index User
|
||||||
|
on mysql.db (User);
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
create table mysql.default_roles
|
||||||
|
(
|
||||||
|
HOST char(255) charset ascii default '' not null,
|
||||||
|
USER char(32) default '' not null,
|
||||||
|
DEFAULT_ROLE_HOST char(255) charset ascii default '%' not null,
|
||||||
|
DEFAULT_ROLE_USER char(32) default '' not null,
|
||||||
|
primary key (HOST, USER, DEFAULT_ROLE_HOST, DEFAULT_ROLE_USER)
|
||||||
|
)
|
||||||
|
comment 'Default roles' collate = utf8mb3_bin
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,18 @@
|
|||||||
|
create table mysql.engine_cost
|
||||||
|
(
|
||||||
|
engine_name varchar(64) not null,
|
||||||
|
device_type int not null,
|
||||||
|
cost_name varchar(64) not null,
|
||||||
|
cost_value float null,
|
||||||
|
last_update timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
|
||||||
|
comment varchar(1024) null,
|
||||||
|
default_value float as ((case `cost_name`
|
||||||
|
when _utf8mb4'io_block_read_cost' then 1.0
|
||||||
|
when _utf8mb4'memory_block_read_cost' then 0.25
|
||||||
|
else NULL end)),
|
||||||
|
primary key (cost_name, engine_name, device_type)
|
||||||
|
)
|
||||||
|
charset = utf8mb3
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
create table mysql.func
|
||||||
|
(
|
||||||
|
name char(64) default '' not null
|
||||||
|
primary key,
|
||||||
|
ret tinyint default 0 not null,
|
||||||
|
dl char(128) default '' not null,
|
||||||
|
type enum ('function', 'aggregate') charset utf8mb3 not null
|
||||||
|
)
|
||||||
|
comment 'User defined functions' collate = utf8mb3_bin
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
create table mysql.general_log
|
||||||
|
(
|
||||||
|
event_time timestamp(6) default CURRENT_TIMESTAMP(6) not null on update CURRENT_TIMESTAMP(6),
|
||||||
|
user_host mediumtext not null,
|
||||||
|
thread_id bigint unsigned not null,
|
||||||
|
server_id int unsigned not null,
|
||||||
|
command_type varchar(64) not null,
|
||||||
|
argument mediumblob not null
|
||||||
|
)
|
||||||
|
comment 'General log' engine = CSV
|
||||||
|
charset = utf8mb3;
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
create table mysql.global_grants
|
||||||
|
(
|
||||||
|
USER char(32) default '' not null,
|
||||||
|
HOST char(255) charset ascii default '' not null,
|
||||||
|
PRIV char(32) charset utf8mb3 default '' not null,
|
||||||
|
WITH_GRANT_OPTION enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
primary key (USER, HOST, PRIV)
|
||||||
|
)
|
||||||
|
comment 'Extended global grants' collate = utf8mb3_bin
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
create table mysql.gtid_executed
|
||||||
|
(
|
||||||
|
source_uuid char(36) not null comment 'uuid of the source where the transaction was originally executed.',
|
||||||
|
interval_start bigint not null comment 'First number of interval.',
|
||||||
|
interval_end bigint not null comment 'Last number of interval.',
|
||||||
|
primary key (source_uuid, interval_start)
|
||||||
|
)
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
create table mysql.help_category
|
||||||
|
(
|
||||||
|
help_category_id smallint unsigned not null
|
||||||
|
primary key,
|
||||||
|
name char(64) not null,
|
||||||
|
parent_category_id smallint unsigned null,
|
||||||
|
url text not null,
|
||||||
|
constraint name
|
||||||
|
unique (name)
|
||||||
|
)
|
||||||
|
comment 'help categories' charset = utf8mb3
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
create table mysql.help_keyword
|
||||||
|
(
|
||||||
|
help_keyword_id int unsigned not null
|
||||||
|
primary key,
|
||||||
|
name char(64) not null,
|
||||||
|
constraint name
|
||||||
|
unique (name)
|
||||||
|
)
|
||||||
|
comment 'help keywords' charset = utf8mb3
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
create table mysql.help_relation
|
||||||
|
(
|
||||||
|
help_topic_id int unsigned not null,
|
||||||
|
help_keyword_id int unsigned not null,
|
||||||
|
primary key (help_keyword_id, help_topic_id)
|
||||||
|
)
|
||||||
|
comment 'keyword-topic relation' charset = utf8mb3
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,16 @@
|
|||||||
|
create table mysql.help_topic
|
||||||
|
(
|
||||||
|
help_topic_id int unsigned not null
|
||||||
|
primary key,
|
||||||
|
name char(64) not null,
|
||||||
|
help_category_id smallint unsigned not null,
|
||||||
|
description text not null,
|
||||||
|
example text not null,
|
||||||
|
url text not null,
|
||||||
|
constraint name
|
||||||
|
unique (name)
|
||||||
|
)
|
||||||
|
comment 'help topics' charset = utf8mb3
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,16 @@
|
|||||||
|
create table mysql.innodb_index_stats
|
||||||
|
(
|
||||||
|
database_name varchar(64) not null,
|
||||||
|
table_name varchar(199) not null,
|
||||||
|
index_name varchar(64) not null,
|
||||||
|
last_update timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
|
||||||
|
stat_name varchar(64) not null,
|
||||||
|
stat_value bigint unsigned not null,
|
||||||
|
sample_size bigint unsigned null,
|
||||||
|
stat_description varchar(1024) not null,
|
||||||
|
primary key (database_name, table_name, index_name, stat_name)
|
||||||
|
)
|
||||||
|
collate = utf8mb3_bin
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
create table mysql.innodb_table_stats
|
||||||
|
(
|
||||||
|
database_name varchar(64) not null,
|
||||||
|
table_name varchar(199) not null,
|
||||||
|
last_update timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
|
||||||
|
n_rows bigint unsigned not null,
|
||||||
|
clustered_index_size bigint unsigned not null,
|
||||||
|
sum_of_other_index_sizes bigint unsigned not null,
|
||||||
|
primary key (database_name, table_name)
|
||||||
|
)
|
||||||
|
collate = utf8mb3_bin
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,20 @@
|
|||||||
|
create table mysql.ndb_binlog_index
|
||||||
|
(
|
||||||
|
Position bigint unsigned not null,
|
||||||
|
File varchar(255) not null,
|
||||||
|
epoch bigint unsigned not null,
|
||||||
|
inserts int unsigned not null,
|
||||||
|
updates int unsigned not null,
|
||||||
|
deletes int unsigned not null,
|
||||||
|
schemaops int unsigned not null,
|
||||||
|
orig_server_id int unsigned not null,
|
||||||
|
orig_epoch bigint unsigned not null,
|
||||||
|
gci int unsigned not null,
|
||||||
|
next_position bigint unsigned not null,
|
||||||
|
next_file varchar(255) not null,
|
||||||
|
primary key (epoch, orig_server_id, orig_epoch)
|
||||||
|
)
|
||||||
|
charset = latin1
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
create table mysql.password_history
|
||||||
|
(
|
||||||
|
Host char(255) charset ascii default '' not null,
|
||||||
|
User char(32) default '' not null,
|
||||||
|
Password_timestamp timestamp(6) default CURRENT_TIMESTAMP(6) not null,
|
||||||
|
Password text null,
|
||||||
|
primary key (Host asc, User asc, Password_timestamp desc)
|
||||||
|
)
|
||||||
|
comment 'Password history for user accounts' collate = utf8mb3_bin
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
create table mysql.plugin
|
||||||
|
(
|
||||||
|
name varchar(64) default '' not null
|
||||||
|
primary key,
|
||||||
|
dl varchar(128) default '' not null
|
||||||
|
)
|
||||||
|
comment 'MySQL plugins' charset = utf8mb3
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,19 @@
|
|||||||
|
create table mysql.procs_priv
|
||||||
|
(
|
||||||
|
Host char(255) charset ascii default '' not null,
|
||||||
|
Db char(64) default '' not null,
|
||||||
|
User char(32) default '' not null,
|
||||||
|
Routine_name char(64) charset utf8mb3 default '' not null,
|
||||||
|
Routine_type enum ('FUNCTION', 'PROCEDURE') not null,
|
||||||
|
Grantor varchar(288) default '' not null,
|
||||||
|
Proc_priv set ('Execute', 'Alter Routine', 'Grant') charset utf8mb3 default '' not null,
|
||||||
|
Timestamp timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
|
||||||
|
primary key (Host, User, Db, Routine_name, Routine_type)
|
||||||
|
)
|
||||||
|
comment 'Procedure privileges' collate = utf8mb3_bin
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
||||||
|
create index Grantor
|
||||||
|
on mysql.procs_priv (Grantor);
|
||||||
|
|
@ -0,0 +1,18 @@
|
|||||||
|
create table mysql.proxies_priv
|
||||||
|
(
|
||||||
|
Host char(255) charset ascii default '' not null,
|
||||||
|
User char(32) default '' not null,
|
||||||
|
Proxied_host char(255) charset ascii default '' not null,
|
||||||
|
Proxied_user char(32) default '' not null,
|
||||||
|
With_grant tinyint(1) default 0 not null,
|
||||||
|
Grantor varchar(288) default '' not null,
|
||||||
|
Timestamp timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
|
||||||
|
primary key (Host, User, Proxied_host, Proxied_user)
|
||||||
|
)
|
||||||
|
comment 'User proxy privileges' collate = utf8mb3_bin
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
||||||
|
create index Grantor
|
||||||
|
on mysql.proxies_priv (Grantor);
|
||||||
|
|
@ -0,0 +1,17 @@
|
|||||||
|
create table mysql.replication_asynchronous_connection_failover
|
||||||
|
(
|
||||||
|
Channel_name char(64) not null comment 'The replication channel name that connects source and replica.',
|
||||||
|
Host char(255) charset ascii not null comment 'The source hostname that the replica will attempt to switch over the replication connection to in case of a failure.',
|
||||||
|
Port int unsigned not null comment 'The source port that the replica will attempt to switch over the replication connection to in case of a failure.',
|
||||||
|
Network_namespace char(64) not null comment 'The source network namespace that the replica will attempt to switch over the replication connection to in case of a failure. If its value is empty, connections use the default (global) namespace.',
|
||||||
|
Weight tinyint unsigned not null comment 'The order in which the replica shall try to switch the connection over to when there are failures. Weight can be set to a number between 1 and 100, where 100 is the highest weight and 1 the lowest.',
|
||||||
|
Managed_name char(64) default '' not null comment 'The name of the group which this server belongs to.',
|
||||||
|
primary key (Channel_name, Host, Port, Network_namespace, Managed_name)
|
||||||
|
)
|
||||||
|
comment 'The source configuration details' charset = utf8mb3
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
||||||
|
create index Channel_name
|
||||||
|
on mysql.replication_asynchronous_connection_failover (Channel_name, Managed_name);
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
create table mysql.replication_asynchronous_connection_failover_managed
|
||||||
|
(
|
||||||
|
Channel_name char(64) not null comment 'The replication channel name that connects source and replica.',
|
||||||
|
Managed_name char(64) default '' not null comment 'The name of the source which needs to be managed.',
|
||||||
|
Managed_type char(64) default '' not null comment 'Determines the managed type.',
|
||||||
|
Configuration json null comment 'The data to help manage group. For Managed_type = GroupReplication, Configuration value should contain {"Primary_weight": 80, "Secondary_weight": 60}, so that it assigns weight=80 to PRIMARY of the group, and weight=60 for rest of the members in mysql.replication_asynchronous_connection_failover table.',
|
||||||
|
primary key (Channel_name, Managed_name)
|
||||||
|
)
|
||||||
|
comment 'The managed source configuration details' charset = utf8mb3
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
create table mysql.replication_group_configuration_version
|
||||||
|
(
|
||||||
|
name char(255) charset ascii not null comment 'The configuration name.'
|
||||||
|
primary key,
|
||||||
|
version bigint unsigned not null comment 'The version of the configuration name.'
|
||||||
|
)
|
||||||
|
comment 'The group configuration version.' row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,16 @@
|
|||||||
|
create table mysql.replication_group_member_actions
|
||||||
|
(
|
||||||
|
name char(255) charset ascii not null comment 'The action name.',
|
||||||
|
event char(64) charset ascii not null comment 'The event that will trigger the action.',
|
||||||
|
enabled tinyint(1) not null comment 'Whether the action is enabled.',
|
||||||
|
type char(64) charset ascii not null comment 'The action type.',
|
||||||
|
priority tinyint unsigned not null comment 'The order on which the action will be run, value between 1 and 100, lower values first.',
|
||||||
|
error_handling char(64) charset ascii not null comment 'On errors during the action will be handled: IGNORE, CRITICAL.',
|
||||||
|
primary key (name, event)
|
||||||
|
)
|
||||||
|
comment 'The member actions configuration.' row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
||||||
|
create index event
|
||||||
|
on mysql.replication_group_member_actions (event);
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
create table mysql.role_edges
|
||||||
|
(
|
||||||
|
FROM_HOST char(255) charset ascii default '' not null,
|
||||||
|
FROM_USER char(32) default '' not null,
|
||||||
|
TO_HOST char(255) charset ascii default '' not null,
|
||||||
|
TO_USER char(32) default '' not null,
|
||||||
|
WITH_ADMIN_OPTION enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
primary key (FROM_HOST, FROM_USER, TO_HOST, TO_USER)
|
||||||
|
)
|
||||||
|
comment 'Role hierarchy and role grants' collate = utf8mb3_bin
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,20 @@
|
|||||||
|
create table mysql.server_cost
|
||||||
|
(
|
||||||
|
cost_name varchar(64) not null
|
||||||
|
primary key,
|
||||||
|
cost_value float null,
|
||||||
|
last_update timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
|
||||||
|
comment varchar(1024) null,
|
||||||
|
default_value float as ((case `cost_name`
|
||||||
|
when _utf8mb4'disk_temptable_create_cost' then 20.0
|
||||||
|
when _utf8mb4'disk_temptable_row_cost' then 0.5
|
||||||
|
when _utf8mb4'key_compare_cost' then 0.05
|
||||||
|
when _utf8mb4'memory_temptable_create_cost' then 1.0
|
||||||
|
when _utf8mb4'memory_temptable_row_cost' then 0.1
|
||||||
|
when _utf8mb4'row_evaluate_cost' then 0.1
|
||||||
|
else NULL end))
|
||||||
|
)
|
||||||
|
charset = utf8mb3
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,17 @@
|
|||||||
|
create table mysql.servers
|
||||||
|
(
|
||||||
|
Server_name char(64) default '' not null
|
||||||
|
primary key,
|
||||||
|
Host char(255) charset ascii default '' not null,
|
||||||
|
Db char(64) default '' not null,
|
||||||
|
Username char(64) default '' not null,
|
||||||
|
Password char(64) default '' not null,
|
||||||
|
Port int default 0 not null,
|
||||||
|
Socket char(64) default '' not null,
|
||||||
|
Wrapper char(64) default '' not null,
|
||||||
|
Owner char(64) default '' not null
|
||||||
|
)
|
||||||
|
comment 'MySQL Foreign Servers table' charset = utf8mb3
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
create table mysql.slave_master_info
|
||||||
|
(
|
||||||
|
Number_of_lines int unsigned not null comment 'Number of lines in the file.',
|
||||||
|
Master_log_name text collate utf8mb3_bin not null comment 'The name of the master binary log currently being read from the master.',
|
||||||
|
Master_log_pos bigint unsigned not null comment 'The master log position of the last read event.',
|
||||||
|
Host varchar(255) charset ascii null comment 'The host name of the source.',
|
||||||
|
User_name text collate utf8mb3_bin null comment 'The user name used to connect to the master.',
|
||||||
|
User_password text collate utf8mb3_bin null comment 'The password used to connect to the master.',
|
||||||
|
Port int unsigned not null comment 'The network port used to connect to the master.',
|
||||||
|
Connect_retry int unsigned not null comment 'The period (in seconds) that the slave will wait before trying to reconnect to the master.',
|
||||||
|
Enabled_ssl tinyint(1) not null comment 'Indicates whether the server supports SSL connections.',
|
||||||
|
Ssl_ca text collate utf8mb3_bin null comment 'The file used for the Certificate Authority (CA) certificate.',
|
||||||
|
Ssl_capath text collate utf8mb3_bin null comment 'The path to the Certificate Authority (CA) certificates.',
|
||||||
|
Ssl_cert text collate utf8mb3_bin null comment 'The name of the SSL certificate file.',
|
||||||
|
Ssl_cipher text collate utf8mb3_bin null comment 'The name of the cipher in use for the SSL connection.',
|
||||||
|
Ssl_key text collate utf8mb3_bin null comment 'The name of the SSL key file.',
|
||||||
|
Ssl_verify_server_cert tinyint(1) not null comment 'Whether to verify the server certificate.',
|
||||||
|
Heartbeat float not null,
|
||||||
|
Bind text collate utf8mb3_bin null comment 'Displays which interface is employed when connecting to the MySQL server',
|
||||||
|
Ignored_server_ids text collate utf8mb3_bin null comment 'The number of server IDs to be ignored, followed by the actual server IDs',
|
||||||
|
Uuid text collate utf8mb3_bin null comment 'The master server uuid.',
|
||||||
|
Retry_count bigint unsigned not null comment 'Number of reconnect attempts, to the master, before giving up.',
|
||||||
|
Ssl_crl text collate utf8mb3_bin null comment 'The file used for the Certificate Revocation List (CRL)',
|
||||||
|
Ssl_crlpath text collate utf8mb3_bin null comment 'The path used for Certificate Revocation List (CRL) files',
|
||||||
|
Enabled_auto_position tinyint(1) not null comment 'Indicates whether GTIDs will be used to retrieve events from the master.',
|
||||||
|
Channel_name varchar(64) not null comment 'The channel on which the replica is connected to a source. Used in Multisource Replication'
|
||||||
|
primary key,
|
||||||
|
Tls_version text collate utf8mb3_bin null comment 'Tls version',
|
||||||
|
Public_key_path text collate utf8mb3_bin null comment 'The file containing public key of master server.',
|
||||||
|
Get_public_key tinyint(1) not null comment 'Preference to get public key from master.',
|
||||||
|
Network_namespace text collate utf8mb3_bin null comment 'Network namespace used for communication with the master server.',
|
||||||
|
Master_compression_algorithm varchar(64) collate utf8mb3_bin not null comment 'Compression algorithm supported for data transfer between source and replica.',
|
||||||
|
Master_zstd_compression_level int unsigned not null comment 'Compression level associated with zstd compression algorithm.',
|
||||||
|
Tls_ciphersuites text collate utf8mb3_bin null comment 'Ciphersuites used for TLS 1.3 communication with the master server.',
|
||||||
|
Source_connection_auto_failover tinyint(1) default 0 not null comment 'Indicates whether the channel connection failover is enabled.',
|
||||||
|
Gtid_only tinyint(1) default 0 not null comment 'Indicates if this channel only uses GTIDs and does not persist positions.'
|
||||||
|
)
|
||||||
|
comment 'Master Information' charset = utf8mb3
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,23 @@
|
|||||||
|
create table mysql.slave_relay_log_info
|
||||||
|
(
|
||||||
|
Number_of_lines int unsigned not null comment 'Number of lines in the file or rows in the table. Used to version table definitions.',
|
||||||
|
Relay_log_name text collate utf8mb3_bin null comment 'The name of the current relay log file.',
|
||||||
|
Relay_log_pos bigint unsigned null comment 'The relay log position of the last executed event.',
|
||||||
|
Master_log_name text collate utf8mb3_bin null comment 'The name of the master binary log file from which the events in the relay log file were read.',
|
||||||
|
Master_log_pos bigint unsigned null comment 'The master log position of the last executed event.',
|
||||||
|
Sql_delay int null comment 'The number of seconds that the slave must lag behind the master.',
|
||||||
|
Number_of_workers int unsigned null,
|
||||||
|
Id int unsigned null comment 'Internal Id that uniquely identifies this record.',
|
||||||
|
Channel_name varchar(64) not null comment 'The channel on which the replica is connected to a source. Used in Multisource Replication'
|
||||||
|
primary key,
|
||||||
|
Privilege_checks_username varchar(32) collate utf8mb3_bin null comment 'Username part of PRIVILEGE_CHECKS_USER.',
|
||||||
|
Privilege_checks_hostname varchar(255) charset ascii null comment 'Hostname part of PRIVILEGE_CHECKS_USER.',
|
||||||
|
Require_row_format tinyint(1) not null comment 'Indicates whether the channel shall only accept row based events.',
|
||||||
|
Require_table_primary_key_check enum ('STREAM', 'ON', 'OFF', 'GENERATE') default 'STREAM' not null comment 'Indicates what is the channel policy regarding tables without primary keys on create and alter table queries',
|
||||||
|
Assign_gtids_to_anonymous_transactions_type enum ('OFF', 'LOCAL', 'UUID') default 'OFF' not null comment 'Indicates whether the channel will generate a new GTID for anonymous transactions. OFF means that anonymous transactions will remain anonymous. LOCAL means that anonymous transactions will be assigned a newly generated GTID based on server_uuid. UUID indicates that anonymous transactions will be assigned a newly generated GTID based on Assign_gtids_to_anonymous_transactions_value',
|
||||||
|
Assign_gtids_to_anonymous_transactions_value text collate utf8mb3_bin null comment 'Indicates the UUID used while generating GTIDs for anonymous transactions'
|
||||||
|
)
|
||||||
|
comment 'Relay Log Information' charset = utf8mb3
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,21 @@
|
|||||||
|
create table mysql.slave_worker_info
|
||||||
|
(
|
||||||
|
Id int unsigned not null,
|
||||||
|
Relay_log_name text collate utf8mb3_bin not null,
|
||||||
|
Relay_log_pos bigint unsigned not null,
|
||||||
|
Master_log_name text collate utf8mb3_bin not null,
|
||||||
|
Master_log_pos bigint unsigned not null,
|
||||||
|
Checkpoint_relay_log_name text collate utf8mb3_bin not null,
|
||||||
|
Checkpoint_relay_log_pos bigint unsigned not null,
|
||||||
|
Checkpoint_master_log_name text collate utf8mb3_bin not null,
|
||||||
|
Checkpoint_master_log_pos bigint unsigned not null,
|
||||||
|
Checkpoint_seqno int unsigned not null,
|
||||||
|
Checkpoint_group_size int unsigned not null,
|
||||||
|
Checkpoint_group_bitmap blob not null,
|
||||||
|
Channel_name varchar(64) not null comment 'The channel on which the replica is connected to a source. Used in Multisource Replication',
|
||||||
|
primary key (Channel_name, Id)
|
||||||
|
)
|
||||||
|
comment 'Worker Information' charset = utf8mb3
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,18 @@
|
|||||||
|
create table mysql.slow_log
|
||||||
|
(
|
||||||
|
start_time timestamp(6) default CURRENT_TIMESTAMP(6) not null on update CURRENT_TIMESTAMP(6),
|
||||||
|
user_host mediumtext not null,
|
||||||
|
query_time time(6) not null,
|
||||||
|
lock_time time(6) not null,
|
||||||
|
rows_sent int not null,
|
||||||
|
rows_examined int not null,
|
||||||
|
db varchar(512) not null,
|
||||||
|
last_insert_id int not null,
|
||||||
|
insert_id int not null,
|
||||||
|
server_id int unsigned not null,
|
||||||
|
sql_text mediumblob not null,
|
||||||
|
thread_id bigint unsigned not null
|
||||||
|
)
|
||||||
|
comment 'Slow log' engine = CSV
|
||||||
|
charset = utf8mb3;
|
||||||
|
|
@ -0,0 +1,19 @@
|
|||||||
|
create table mysql.tables_priv
|
||||||
|
(
|
||||||
|
Host char(255) charset ascii default '' not null,
|
||||||
|
Db char(64) default '' not null,
|
||||||
|
User char(32) default '' not null,
|
||||||
|
Table_name char(64) default '' not null,
|
||||||
|
Grantor varchar(288) default '' not null,
|
||||||
|
Timestamp timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
|
||||||
|
Table_priv set ('Select', 'Insert', 'Update', 'Delete', 'Create', 'Drop', 'Grant', 'References', 'Index', 'Alter', 'Create View', 'Show view', 'Trigger') charset utf8mb3 default '' not null,
|
||||||
|
Column_priv set ('Select', 'Insert', 'Update', 'References') charset utf8mb3 default '' not null,
|
||||||
|
primary key (Host, User, Db, Table_name)
|
||||||
|
)
|
||||||
|
comment 'Table privileges' collate = utf8mb3_bin
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
||||||
|
create index Grantor
|
||||||
|
on mysql.tables_priv (Grantor);
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
create table mysql.time_zone
|
||||||
|
(
|
||||||
|
Time_zone_id int unsigned auto_increment
|
||||||
|
primary key,
|
||||||
|
Use_leap_seconds enum ('Y', 'N') default 'N' not null
|
||||||
|
)
|
||||||
|
comment 'Time zones' charset = utf8mb3
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
create table mysql.time_zone_leap_second
|
||||||
|
(
|
||||||
|
Transition_time bigint not null
|
||||||
|
primary key,
|
||||||
|
Correction int not null
|
||||||
|
)
|
||||||
|
comment 'Leap seconds information for time zones' charset = utf8mb3
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
create table mysql.time_zone_name
|
||||||
|
(
|
||||||
|
Name char(64) not null
|
||||||
|
primary key,
|
||||||
|
Time_zone_id int unsigned not null
|
||||||
|
)
|
||||||
|
comment 'Time zone names' charset = utf8mb3
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
create table mysql.time_zone_transition
|
||||||
|
(
|
||||||
|
Time_zone_id int unsigned not null,
|
||||||
|
Transition_time bigint not null,
|
||||||
|
Transition_type_id int unsigned not null,
|
||||||
|
primary key (Time_zone_id, Transition_time)
|
||||||
|
)
|
||||||
|
comment 'Time zone transitions' charset = utf8mb3
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
create table mysql.time_zone_transition_type
|
||||||
|
(
|
||||||
|
Time_zone_id int unsigned not null,
|
||||||
|
Transition_type_id int unsigned not null,
|
||||||
|
Offset int default 0 not null,
|
||||||
|
Is_DST tinyint unsigned default '0' not null,
|
||||||
|
Abbreviation char(8) default '' not null,
|
||||||
|
primary key (Time_zone_id, Transition_type_id)
|
||||||
|
)
|
||||||
|
comment 'Time zone transition types' charset = utf8mb3
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
@ -0,0 +1,61 @@
|
|||||||
|
create table mysql.user
|
||||||
|
(
|
||||||
|
Host char(255) charset ascii default '' not null,
|
||||||
|
User char(32) default '' not null,
|
||||||
|
Select_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Insert_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Update_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Delete_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Create_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Drop_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Reload_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Shutdown_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Process_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
File_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Grant_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
References_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Index_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Alter_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Show_db_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Super_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Create_tmp_table_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Lock_tables_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Execute_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Repl_slave_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Repl_client_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Create_view_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Show_view_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Create_routine_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Alter_routine_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Create_user_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Event_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Trigger_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Create_tablespace_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
ssl_type enum ('', 'ANY', 'X509', 'SPECIFIED') charset utf8mb3 default '' not null,
|
||||||
|
ssl_cipher blob not null,
|
||||||
|
x509_issuer blob not null,
|
||||||
|
x509_subject blob not null,
|
||||||
|
max_questions int unsigned default '0' not null,
|
||||||
|
max_updates int unsigned default '0' not null,
|
||||||
|
max_connections int unsigned default '0' not null,
|
||||||
|
max_user_connections int unsigned default '0' not null,
|
||||||
|
plugin char(64) default 'caching_sha2_password' not null,
|
||||||
|
authentication_string text null,
|
||||||
|
password_expired enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
password_last_changed timestamp null,
|
||||||
|
password_lifetime smallint unsigned null,
|
||||||
|
account_locked enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Create_role_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Drop_role_priv enum ('N', 'Y') charset utf8mb3 default 'N' not null,
|
||||||
|
Password_reuse_history smallint unsigned null,
|
||||||
|
Password_reuse_time smallint unsigned null,
|
||||||
|
Password_require_current enum ('N', 'Y') charset utf8mb3 null,
|
||||||
|
User_attributes json null,
|
||||||
|
primary key (Host, User)
|
||||||
|
)
|
||||||
|
comment 'Users and global privileges' collate = utf8mb3_bin
|
||||||
|
row_format = DYNAMIC
|
||||||
|
stats_persistent = 0;
|
||||||
|
|
||||||
|
grant select on table mysql.user to 'mysql.session'@localhost;
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
create table performance_schema.accounts
|
||||||
|
(
|
||||||
|
USER char(32) collate utf8mb4_bin null,
|
||||||
|
HOST char(255) charset ascii null,
|
||||||
|
CURRENT_CONNECTIONS bigint not null,
|
||||||
|
TOTAL_CONNECTIONS bigint not null,
|
||||||
|
MAX_SESSION_CONTROLLED_MEMORY bigint unsigned not null,
|
||||||
|
MAX_SESSION_TOTAL_MEMORY bigint unsigned not null,
|
||||||
|
constraint ACCOUNT
|
||||||
|
unique (USER, HOST) using hash
|
||||||
|
)
|
||||||
|
engine = PERFORMANCE_SCHEMA;
|
||||||
|
|
@ -0,0 +1,19 @@
|
|||||||
|
create table performance_schema.binary_log_transaction_compression_stats
|
||||||
|
(
|
||||||
|
LOG_TYPE enum ('BINARY', 'RELAY') not null comment 'The log type to which the transactions were written.',
|
||||||
|
COMPRESSION_TYPE varchar(64) not null comment 'The transaction compression algorithm used.',
|
||||||
|
TRANSACTION_COUNTER bigint unsigned not null comment 'Number of transactions written to the log',
|
||||||
|
COMPRESSED_BYTES_COUNTER bigint unsigned not null comment 'The total number of bytes compressed.',
|
||||||
|
UNCOMPRESSED_BYTES_COUNTER bigint unsigned not null comment 'The total number of bytes uncompressed.',
|
||||||
|
COMPRESSION_PERCENTAGE smallint not null comment 'The compression ratio as a percentage.',
|
||||||
|
FIRST_TRANSACTION_ID text null comment 'The first transaction written.',
|
||||||
|
FIRST_TRANSACTION_COMPRESSED_BYTES bigint unsigned not null comment 'First transaction written compressed bytes.',
|
||||||
|
FIRST_TRANSACTION_UNCOMPRESSED_BYTES bigint unsigned not null comment 'First transaction written uncompressed bytes.',
|
||||||
|
FIRST_TRANSACTION_TIMESTAMP timestamp(6) null comment 'When the first transaction was written.',
|
||||||
|
LAST_TRANSACTION_ID text null comment 'The last transaction written.',
|
||||||
|
LAST_TRANSACTION_COMPRESSED_BYTES bigint unsigned not null comment 'Last transaction written compressed bytes.',
|
||||||
|
LAST_TRANSACTION_UNCOMPRESSED_BYTES bigint unsigned not null comment 'Last transaction written uncompressed bytes.',
|
||||||
|
LAST_TRANSACTION_TIMESTAMP timestamp(6) null comment 'When the last transaction was written.'
|
||||||
|
)
|
||||||
|
engine = PERFORMANCE_SCHEMA;
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
create table performance_schema.cond_instances
|
||||||
|
(
|
||||||
|
NAME varchar(128) not null,
|
||||||
|
OBJECT_INSTANCE_BEGIN bigint unsigned not null
|
||||||
|
primary key using hash
|
||||||
|
)
|
||||||
|
engine = PERFORMANCE_SCHEMA;
|
||||||
|
|
||||||
|
create index NAME
|
||||||
|
on performance_schema.cond_instances (NAME)
|
||||||
|
using hash;
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
create table performance_schema.data_lock_waits
|
||||||
|
(
|
||||||
|
ENGINE varchar(32) not null,
|
||||||
|
REQUESTING_ENGINE_LOCK_ID varchar(128) not null,
|
||||||
|
REQUESTING_ENGINE_TRANSACTION_ID bigint unsigned null,
|
||||||
|
REQUESTING_THREAD_ID bigint unsigned null,
|
||||||
|
REQUESTING_EVENT_ID bigint unsigned null,
|
||||||
|
REQUESTING_OBJECT_INSTANCE_BEGIN bigint unsigned not null,
|
||||||
|
BLOCKING_ENGINE_LOCK_ID varchar(128) not null,
|
||||||
|
BLOCKING_ENGINE_TRANSACTION_ID bigint unsigned null,
|
||||||
|
BLOCKING_THREAD_ID bigint unsigned null,
|
||||||
|
BLOCKING_EVENT_ID bigint unsigned null,
|
||||||
|
BLOCKING_OBJECT_INSTANCE_BEGIN bigint unsigned not null,
|
||||||
|
primary key (REQUESTING_ENGINE_LOCK_ID, BLOCKING_ENGINE_LOCK_ID, ENGINE) using hash
|
||||||
|
)
|
||||||
|
engine = PERFORMANCE_SCHEMA;
|
||||||
|
|
||||||
|
create index BLOCKING_ENGINE_LOCK_ID
|
||||||
|
on performance_schema.data_lock_waits (BLOCKING_ENGINE_LOCK_ID, ENGINE)
|
||||||
|
using hash;
|
||||||
|
|
||||||
|
create index BLOCKING_ENGINE_TRANSACTION_ID
|
||||||
|
on performance_schema.data_lock_waits (BLOCKING_ENGINE_TRANSACTION_ID, ENGINE)
|
||||||
|
using hash;
|
||||||
|
|
||||||
|
create index BLOCKING_THREAD_ID
|
||||||
|
on performance_schema.data_lock_waits (BLOCKING_THREAD_ID, BLOCKING_EVENT_ID)
|
||||||
|
using hash;
|
||||||
|
|
||||||
|
create index REQUESTING_ENGINE_LOCK_ID
|
||||||
|
on performance_schema.data_lock_waits (REQUESTING_ENGINE_LOCK_ID, ENGINE)
|
||||||
|
using hash;
|
||||||
|
|
||||||
|
create index REQUESTING_ENGINE_TRANSACTION_ID
|
||||||
|
on performance_schema.data_lock_waits (REQUESTING_ENGINE_TRANSACTION_ID, ENGINE)
|
||||||
|
using hash;
|
||||||
|
|
||||||
|
create index REQUESTING_THREAD_ID
|
||||||
|
on performance_schema.data_lock_waits (REQUESTING_THREAD_ID, REQUESTING_EVENT_ID)
|
||||||
|
using hash;
|
||||||
|
|
@ -0,0 +1,33 @@
|
|||||||
|
create table performance_schema.data_locks
|
||||||
|
(
|
||||||
|
ENGINE varchar(32) not null,
|
||||||
|
ENGINE_LOCK_ID varchar(128) not null,
|
||||||
|
ENGINE_TRANSACTION_ID bigint unsigned null,
|
||||||
|
THREAD_ID bigint unsigned null,
|
||||||
|
EVENT_ID bigint unsigned null,
|
||||||
|
OBJECT_SCHEMA varchar(64) null,
|
||||||
|
OBJECT_NAME varchar(64) null,
|
||||||
|
PARTITION_NAME varchar(64) null,
|
||||||
|
SUBPARTITION_NAME varchar(64) null,
|
||||||
|
INDEX_NAME varchar(64) null,
|
||||||
|
OBJECT_INSTANCE_BEGIN bigint unsigned not null,
|
||||||
|
LOCK_TYPE varchar(32) not null,
|
||||||
|
LOCK_MODE varchar(32) not null,
|
||||||
|
LOCK_STATUS varchar(32) not null,
|
||||||
|
LOCK_DATA varchar(8192) null,
|
||||||
|
primary key (ENGINE_LOCK_ID, ENGINE) using hash
|
||||||
|
)
|
||||||
|
engine = PERFORMANCE_SCHEMA;
|
||||||
|
|
||||||
|
create index ENGINE_TRANSACTION_ID
|
||||||
|
on performance_schema.data_locks (ENGINE_TRANSACTION_ID, ENGINE)
|
||||||
|
using hash;
|
||||||
|
|
||||||
|
create index OBJECT_SCHEMA
|
||||||
|
on performance_schema.data_locks (OBJECT_SCHEMA, OBJECT_NAME, PARTITION_NAME, SUBPARTITION_NAME)
|
||||||
|
using hash;
|
||||||
|
|
||||||
|
create index THREAD_ID
|
||||||
|
on performance_schema.data_locks (THREAD_ID, EVENT_ID)
|
||||||
|
using hash;
|
||||||
|
|
@ -0,0 +1,28 @@
|
|||||||
|
create table performance_schema.error_log
|
||||||
|
(
|
||||||
|
LOGGED timestamp(6) not null
|
||||||
|
primary key using hash,
|
||||||
|
THREAD_ID bigint unsigned null,
|
||||||
|
PRIO enum ('System', 'Error', 'Warning', 'Note') not null,
|
||||||
|
ERROR_CODE varchar(10) null,
|
||||||
|
SUBSYSTEM varchar(7) null,
|
||||||
|
DATA text not null
|
||||||
|
)
|
||||||
|
engine = PERFORMANCE_SCHEMA;
|
||||||
|
|
||||||
|
create index ERROR_CODE
|
||||||
|
on performance_schema.error_log (ERROR_CODE)
|
||||||
|
using hash;
|
||||||
|
|
||||||
|
create index PRIO
|
||||||
|
on performance_schema.error_log (PRIO)
|
||||||
|
using hash;
|
||||||
|
|
||||||
|
create index SUBSYSTEM
|
||||||
|
on performance_schema.error_log (SUBSYSTEM)
|
||||||
|
using hash;
|
||||||
|
|
||||||
|
create index THREAD_ID
|
||||||
|
on performance_schema.error_log (THREAD_ID)
|
||||||
|
using hash;
|
||||||
|
|
@ -0,0 +1,16 @@
|
|||||||
|
create table performance_schema.events_errors_summary_by_account_by_error
|
||||||
|
(
|
||||||
|
USER char(32) collate utf8mb4_bin null,
|
||||||
|
HOST char(255) charset ascii null,
|
||||||
|
ERROR_NUMBER int null,
|
||||||
|
ERROR_NAME varchar(64) null,
|
||||||
|
SQL_STATE varchar(5) null,
|
||||||
|
SUM_ERROR_RAISED bigint unsigned not null,
|
||||||
|
SUM_ERROR_HANDLED bigint unsigned not null,
|
||||||
|
FIRST_SEEN timestamp null,
|
||||||
|
LAST_SEEN timestamp null,
|
||||||
|
constraint ACCOUNT
|
||||||
|
unique (USER, HOST, ERROR_NUMBER) using hash
|
||||||
|
)
|
||||||
|
engine = PERFORMANCE_SCHEMA;
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
create table performance_schema.events_errors_summary_by_host_by_error
|
||||||
|
(
|
||||||
|
HOST char(255) charset ascii null,
|
||||||
|
ERROR_NUMBER int null,
|
||||||
|
ERROR_NAME varchar(64) null,
|
||||||
|
SQL_STATE varchar(5) null,
|
||||||
|
SUM_ERROR_RAISED bigint unsigned not null,
|
||||||
|
SUM_ERROR_HANDLED bigint unsigned not null,
|
||||||
|
FIRST_SEEN timestamp null,
|
||||||
|
LAST_SEEN timestamp null,
|
||||||
|
constraint HOST
|
||||||
|
unique (HOST, ERROR_NUMBER) using hash
|
||||||
|
)
|
||||||
|
engine = PERFORMANCE_SCHEMA;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue