Skip to content

Commit 619c89d

Browse files
kyleconroyclaude
andcommitted
Always output CASE expression alias in EXPLAIN output
Remove the condition that skipped quoted aliases in CASE expressions. ClickHouse EXPLAIN AST shows the alias regardless of whether it was quoted in the original SQL. Fixes test: 02244_casewithexpression_return_type/stmt1 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9261423 commit 619c89d

2 files changed

Lines changed: 2 additions & 11 deletions

File tree

internal/explain/functions.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,12 +1536,7 @@ func explainIsNullExpr(sb *strings.Builder, n *ast.IsNullExpr, indent string, de
15361536
}
15371537

15381538
func explainCaseExpr(sb *strings.Builder, n *ast.CaseExpr, indent string, depth int) {
1539-
// Only output alias if it's unquoted (ClickHouse doesn't show quoted aliases)
1540-
alias := ""
1541-
if n.Alias != "" && !n.QuotedAlias {
1542-
alias = n.Alias
1543-
}
1544-
explainCaseExprWithAlias(sb, n, alias, indent, depth)
1539+
explainCaseExprWithAlias(sb, n, n.Alias, indent, depth)
15451540
}
15461541

15471542
func explainCaseExprWithAlias(sb *strings.Builder, n *ast.CaseExpr, alias string, indent string, depth int) {
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt1": true
4-
}
5-
}
1+
{}

0 commit comments

Comments
 (0)