From 2e6573252f7d5fdc59589e706d6b194cb0a96724 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 23 Dec 2025 18:31:21 +0000 Subject: [PATCH] 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 --- internal/explain/statements.go | 4 ++-- parser/testdata/02902_show_databases_limit/metadata.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/explain/statements.go b/internal/explain/statements.go index 9722a3ab2..441938005 100644 --- a/internal/explain/statements.go +++ b/internal/explain/statements.go @@ -318,8 +318,8 @@ func explainExplainQuery(sb *strings.Builder, n *ast.ExplainQuery, indent string func explainShowQuery(sb *strings.Builder, n *ast.ShowQuery, indent string) { // ClickHouse maps certain SHOW types to ShowTables in EXPLAIN AST showType := strings.Title(strings.ToLower(string(n.ShowType))) - // SHOW SETTINGS is displayed as ShowTables in ClickHouse - if showType == "Settings" { + // SHOW SETTINGS and SHOW DATABASES are displayed as ShowTables in ClickHouse + if showType == "Settings" || showType == "Databases" { showType = "Tables" } fmt.Fprintf(sb, "%sShow%s\n", indent, showType) diff --git a/parser/testdata/02902_show_databases_limit/metadata.json b/parser/testdata/02902_show_databases_limit/metadata.json index ef120d978..9e26dfeeb 100644 --- a/parser/testdata/02902_show_databases_limit/metadata.json +++ b/parser/testdata/02902_show_databases_limit/metadata.json @@ -1 +1 @@ -{"todo": true} +{} \ No newline at end of file