Skip to content

Commit

Permalink
Use node.Name only if set
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
  • Loading branch information
timvaillancourt committed Jun 19, 2024
1 parent 20ee454 commit cb6e9ad
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 6 additions & 1 deletion go/vt/sqlparser/ast_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -2656,7 +2656,12 @@ func (node *Count) Format(buf *TrackedBuffer) {
}

func (node *CountStar) Format(buf *TrackedBuffer) {
buf.astPrintf(node, "%s(*)", node.Name)
if node.Name != "" {
buf.astPrintf(node, "%s(*)", node.Name)
} else {
buf.astPrintf(node, "%s(", node.AggrName())
buf.WriteString("*)")
}
}

func (node *Avg) Format(buf *TrackedBuffer) {
Expand Down
10 changes: 8 additions & 2 deletions go/vt/sqlparser/ast_format_fast.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cb6e9ad

Please sign in to comment.