SHOW INDEX: Make fields COMMENT and INDEX_COMMENT more compatible with MySQL

This commit is contained in:
Robert Schulze 2023-07-04 16:09:30 +00:00
parent 59928cb485
commit 047060f9a4
No known key found for this signature in database
GPG Key ID: 26703B55FB13728A
3 changed files with 53 additions and 53 deletions

View File

@ -205,7 +205,7 @@ The optional keyword `EXTENDED` currently has no effect, it only exists for MySQ
The optional keyword `FULL` causes the output to include the collation, comment and privilege columns.
`SHOW COLUMNS` produces a result table with the following structure:
The statement produces a result table with the following structure:
- field - The name of the column (String)
- type - The column data type (String)
- null - If the column data type is Nullable (UInt8)
@ -281,7 +281,7 @@ equivalent. If no database is specified, the query assumes the current database
The optional keyword `EXTENDED` currently has no effect, it only exists for MySQL compatibility.
`SHOW INDEX` produces a result table with the following structure:
The statement produces a result table with the following structure:
- table - The name of the table (String)
- non_unique - 0 if the index cannot contain duplicates, 1 otherwise (UInt8)
- key_name - The name of the index, `PRIMARY` if the index is a primary key index (String)
@ -293,8 +293,8 @@ The optional keyword `EXTENDED` currently has no effect, it only exists for MySQ
- packed - Currently unused
- null - Currently unused
- index_type - The index type, e.g. `primary`, `minmax`, `bloom_filter` etc. (String)
- comment - Currently unused
- index_comment - Currently unused
- comment - `` additional information about the index, currently always `` (empty string) (String)
- index_comment - `` (empty string) because indexes in ClickHouse cannot have a `COMMENT` field like in MySQL (String)
- visible - If the index is visible to the optimizer, always `YES` (String)
- expression - The index expression (String)
@ -310,11 +310,11 @@ Result:
``` text
┌─table─┬─non_unique─┬─key_name─┬─seq_in_index─┬─column_name─┬─collation─┬─cardinality─┬─sub_part─┬─packed─┬─null─┬─index_type───┬─comment─┬─index_comment─┬─visible─┬─expression─┐
│ tbl │ 0 │ blf_idx │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ bloom_filter │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ YES │ d, b │
│ tbl │ 0 │ mm1_idx │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ minmax │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ YES │ a, c, d │
│ tbl │ 0 │ mm2_idx │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ minmax │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ YES │ c, d, e │
│ tbl │ 0 │ PRIMARY │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ A │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ primary │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ YES │ c, a │
│ tbl │ 0 │ set_idx │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ set │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ YES │ e │
│ tbl │ 0 │ blf_idx │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ bloom_filter │ │ YES │ d, b │
│ tbl │ 0 │ mm1_idx │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ minmax │ │ YES │ a, c, d │
│ tbl │ 0 │ mm2_idx │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ minmax │ │ YES │ c, d, e │
│ tbl │ 0 │ PRIMARY │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ A │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ primary │ │ YES │ c, a │
│ tbl │ 0 │ set_idx │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ set │ │ YES │ e │
└───────┴────────────┴──────────┴──────────────┴─────────────┴───────────┴─────────────┴──────────┴────────┴──────┴──────────────┴─────────┴───────────────┴─────────┴────────────┘
```

View File

@ -50,8 +50,8 @@ FROM (
NULL AS packed,
NULL AS null,
'primary' AS index_type,
NULL AS comment,
NULL AS index_comment,
'' AS comment,
'' AS index_comment,
'YES' AS visible,
primary_key AS expression
FROM system.tables
@ -71,8 +71,8 @@ FROM (
NULL AS packed,
NULL AS null,
type AS index_type,
NULL AS comment,
NULL AS index_comment,
'' AS comment,
'' AS index_comment,
'YES' AS visible,
expr AS expression
FROM system.data_skipping_indices

View File

@ -1,47 +1,47 @@
--- Aliases of SHOW INDEX
tbl 0 blf_idx \N \N \N \N \N \N \N bloom_filter \N \N YES d, b
tbl 0 mm1_idx \N \N \N \N \N \N \N minmax \N \N YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N minmax \N \N YES c, d, e
tbl 0 PRIMARY \N \N A \N \N \N \N primary \N \N YES c, a
tbl 0 set_idx \N \N \N \N \N \N \N set \N \N YES e
tbl 0 blf_idx \N \N \N \N \N \N \N bloom_filter \N \N YES d, b
tbl 0 mm1_idx \N \N \N \N \N \N \N minmax \N \N YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N minmax \N \N YES c, d, e
tbl 0 PRIMARY \N \N A \N \N \N \N primary \N \N YES c, a
tbl 0 set_idx \N \N \N \N \N \N \N set \N \N YES e
tbl 0 blf_idx \N \N \N \N \N \N \N bloom_filter \N \N YES d, b
tbl 0 mm1_idx \N \N \N \N \N \N \N minmax \N \N YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N minmax \N \N YES c, d, e
tbl 0 PRIMARY \N \N A \N \N \N \N primary \N \N YES c, a
tbl 0 set_idx \N \N \N \N \N \N \N set \N \N YES e
tbl 0 blf_idx \N \N \N \N \N \N \N bloom_filter \N \N YES d, b
tbl 0 mm1_idx \N \N \N \N \N \N \N minmax \N \N YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N minmax \N \N YES c, d, e
tbl 0 PRIMARY \N \N A \N \N \N \N primary \N \N YES c, a
tbl 0 set_idx \N \N \N \N \N \N \N set \N \N YES e
tbl 0 blf_idx \N \N \N \N \N \N \N bloom_filter YES d, b
tbl 0 mm1_idx \N \N \N \N \N \N \N minmax YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N minmax YES c, d, e
tbl 0 PRIMARY \N \N A \N \N \N \N primary YES c, a
tbl 0 set_idx \N \N \N \N \N \N \N set YES e
tbl 0 blf_idx \N \N \N \N \N \N \N bloom_filter YES d, b
tbl 0 mm1_idx \N \N \N \N \N \N \N minmax YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N minmax YES c, d, e
tbl 0 PRIMARY \N \N A \N \N \N \N primary YES c, a
tbl 0 set_idx \N \N \N \N \N \N \N set YES e
tbl 0 blf_idx \N \N \N \N \N \N \N bloom_filter YES d, b
tbl 0 mm1_idx \N \N \N \N \N \N \N minmax YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N minmax YES c, d, e
tbl 0 PRIMARY \N \N A \N \N \N \N primary YES c, a
tbl 0 set_idx \N \N \N \N \N \N \N set YES e
tbl 0 blf_idx \N \N \N \N \N \N \N bloom_filter YES d, b
tbl 0 mm1_idx \N \N \N \N \N \N \N minmax YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N minmax YES c, d, e
tbl 0 PRIMARY \N \N A \N \N \N \N primary YES c, a
tbl 0 set_idx \N \N \N \N \N \N \N set YES e
--- EXTENDED
tbl 0 blf_idx \N \N \N \N \N \N \N bloom_filter \N \N YES d, b
tbl 0 mm1_idx \N \N \N \N \N \N \N minmax \N \N YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N minmax \N \N YES c, d, e
tbl 0 PRIMARY \N \N A \N \N \N \N primary \N \N YES c, a
tbl 0 set_idx \N \N \N \N \N \N \N set \N \N YES e
tbl 0 blf_idx \N \N \N \N \N \N \N bloom_filter YES d, b
tbl 0 mm1_idx \N \N \N \N \N \N \N minmax YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N minmax YES c, d, e
tbl 0 PRIMARY \N \N A \N \N \N \N primary YES c, a
tbl 0 set_idx \N \N \N \N \N \N \N set YES e
--- WHERE
tbl 0 mm1_idx \N \N \N \N \N \N \N minmax \N \N YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N minmax \N \N YES c, d, e
tbl 0 mm1_idx \N \N \N \N \N \N \N minmax YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N minmax YES c, d, e
--- Check with weird table names
$4@^7 0 PRIMARY \N \N A \N \N \N \N primary \N \N YES c
NULL 0 PRIMARY \N \N A \N \N \N \N primary \N \N YES c
\' 0 PRIMARY \N \N A \N \N \N \N primary \N \N YES c
\' 0 PRIMARY \N \N A \N \N \N \N primary \N \N YES c
$4@^7 0 PRIMARY \N \N A \N \N \N \N primary YES c
NULL 0 PRIMARY \N \N A \N \N \N \N primary YES c
\' 0 PRIMARY \N \N A \N \N \N \N primary YES c
\' 0 PRIMARY \N \N A \N \N \N \N primary YES c
--- Original table
tbl 0 blf_idx \N \N \N \N \N \N \N bloom_filter \N \N YES d, b
tbl 0 mm1_idx \N \N \N \N \N \N \N minmax \N \N YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N minmax \N \N YES c, d, e
tbl 0 PRIMARY \N \N A \N \N \N \N primary \N \N YES c, a
tbl 0 set_idx \N \N \N \N \N \N \N set \N \N YES e
tbl 0 blf_idx \N \N \N \N \N \N \N bloom_filter YES d, b
tbl 0 mm1_idx \N \N \N \N \N \N \N minmax YES a, c, d
tbl 0 mm2_idx \N \N \N \N \N \N \N minmax YES c, d, e
tbl 0 PRIMARY \N \N A \N \N \N \N primary YES c, a
tbl 0 set_idx \N \N \N \N \N \N \N set YES e
--- Equally named table in other database
tbl 0 mmi_idx \N \N \N \N \N \N \N minmax \N \N YES b
tbl 0 PRIMARY \N \N A \N \N \N \N primary \N \N YES a
tbl 0 mmi_idx \N \N \N \N \N \N \N minmax YES b
tbl 0 PRIMARY \N \N A \N \N \N \N primary YES a
--- Short form
tbl 0 mmi_idx \N \N \N \N \N \N \N minmax \N \N YES b
tbl 0 PRIMARY \N \N A \N \N \N \N primary \N \N YES a
tbl 0 mmi_idx \N \N \N \N \N \N \N minmax YES b
tbl 0 PRIMARY \N \N A \N \N \N \N primary YES a