Skip to content

Commit c370f54

Browse files
kyleconroyclaude
andcommitted
Handle QueryParameter with alias in EXPLAIN output
When a QueryParameter (e.g., {param:Type}) has an alias (AS name), output it as: QueryParameter param:Type (alias name) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5b6ea17 commit c370f54

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

internal/explain/expressions.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,17 @@ func explainAliasedExpr(sb *strings.Builder, n *ast.AliasedExpr, depth int) {
808808
case *ast.ExistsExpr:
809809
// EXISTS expressions with alias
810810
explainExistsExprWithAlias(sb, e, n.Alias, indent, depth)
811+
case *ast.Parameter:
812+
// QueryParameter with alias
813+
if e.Name != "" {
814+
if e.Type != nil {
815+
fmt.Fprintf(sb, "%sQueryParameter %s:%s (alias %s)\n", indent, e.Name, FormatDataType(e.Type), escapeAlias(n.Alias))
816+
} else {
817+
fmt.Fprintf(sb, "%sQueryParameter %s (alias %s)\n", indent, e.Name, escapeAlias(n.Alias))
818+
}
819+
} else {
820+
fmt.Fprintf(sb, "%sQueryParameter (alias %s)\n", indent, escapeAlias(n.Alias))
821+
}
811822
default:
812823
// For other types, recursively explain and add alias info
813824
Node(sb, n.Expr, depth)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"explain_todo":{"stmt2":true}}
1+
{}

0 commit comments

Comments
 (0)