Skip to content

Commit 2e65732

Browse files
committed
Fix SHOW DATABASES EXPLAIN AST output to match ClickHouse
ClickHouse maps SHOW DATABASES to ShowTables in EXPLAIN AST output, similar to SHOW SETTINGS. Update explainShowQuery to handle this case. Enables test: 02902_show_databases_limit
1 parent 1d571bb commit 2e65732

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

internal/explain/statements.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ func explainExplainQuery(sb *strings.Builder, n *ast.ExplainQuery, indent string
318318
func explainShowQuery(sb *strings.Builder, n *ast.ShowQuery, indent string) {
319319
// ClickHouse maps certain SHOW types to ShowTables in EXPLAIN AST
320320
showType := strings.Title(strings.ToLower(string(n.ShowType)))
321-
// SHOW SETTINGS is displayed as ShowTables in ClickHouse
322-
if showType == "Settings" {
321+
// SHOW SETTINGS and SHOW DATABASES are displayed as ShowTables in ClickHouse
322+
if showType == "Settings" || showType == "Databases" {
323323
showType = "Tables"
324324
}
325325
fmt.Fprintf(sb, "%sShow%s\n", indent, showType)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"todo": true}
1+
{}

0 commit comments

Comments
 (0)