Update information_schema.tables sql and docs

This commit is contained in:
slvrtrn 2023-09-18 22:30:27 +02:00
parent 9a0d07c682
commit ad7b707658
2 changed files with 29 additions and 27 deletions

View File

@ -153,12 +153,14 @@ Columns:
- `table_catalog` ([String](../../sql-reference/data-types/string.md)) — The name of the database in which the table is located.
- `table_schema` ([String](../../sql-reference/data-types/string.md)) — The name of the database in which the table is located.
- `table_name` ([String](../../sql-reference/data-types/string.md)) — Table name.
- `table_type` ([Enum8](../../sql-reference/data-types/enum.md)) — Table type. Possible values:
- `table_type` ([String](../../sql-reference/data-types/string.md)) — Table type. Possible values:
- `BASE TABLE`
- `VIEW`
- `FOREIGN TABLE`
- `LOCAL TEMPORARY`
- `SYSTEM VIEW`
- `table_comment` ([Nullable](../../sql-reference/data-types/nullable.md)([String](../../sql-reference/data-types/string.md))) — The comment used when creating the table.
- `table_collation` ([Nullable](../../sql-reference/data-types/nullable.md)([String](../../sql-reference/data-types/string.md))) — The table default collation. Always `utf8mb4`.
**Example**

View File

@ -1,28 +1,28 @@
ATTACH VIEW tables
(
`table_catalog` String,
`table_schema` String,
`table_name` String,
`table_type` String,
`table_comment` String,
`table_collation` String,
`TABLE_CATALOG` String ALIAS table_catalog,
`TABLE_SCHEMA` String ALIAS table_schema,
`TABLE_NAME` String ALIAS table_name,
`TABLE_TYPE` String ALIAS table_type,
`TABLE_COMMENT` String ALIAS table_comment,
`TABLE_COLLATION` String ALIAS table_collation
) AS
SELECT database AS `table_catalog`,
database AS `table_schema`,
name AS `table_name`,
comment AS `table_comment`,
multiIf(
is_temporary, 'LOCAL TEMPORARY',
engine LIKE '%View', 'VIEW',
engine LIKE 'System%', 'SYSTEM VIEW',
has_own_data = 0, 'FOREIGN TABLE',
'BASE TABLE'
) AS `table_type`,
'utf8mb4' AS `table_collation`
(
`table_catalog` String,
`table_schema` String,
`table_name` String,
`table_type` String,
`table_comment` Nullable(String),
`table_collation` Nullable(String),
`TABLE_CATALOG` String ALIAS table_catalog,
`TABLE_SCHEMA` String ALIAS table_schema,
`TABLE_NAME` String ALIAS table_name,
`TABLE_TYPE` String ALIAS table_type,
`TABLE_COMMENT` Nullable(String) ALIAS table_comment,
`TABLE_COLLATION` Nullable(String) ALIAS table_collation
) AS
SELECT
database AS table_catalog,
database AS table_schema,
name AS table_name,
comment AS table_comment,
multiIf(is_temporary, 'LOCAL TEMPORARY',
engine LIKE '%View', 'VIEW',
engine LIKE 'System%', 'SYSTEM VIEW',
has_own_data = 0, 'FOREIGN TABLE',
'BASE TABLE'
) AS table_type,
'utf8mb4' AS table_collation
FROM system.tables