Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions go/vt/sqlparser/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -1280,10 +1280,11 @@ func (node VindexParam) walkSubtree(visit Visit) error {

// Show represents a show statement.
type Show struct {
Type string
OnTable TableName
ShowTablesOpt *ShowTablesOpt
Scope string
Type string
OnTable TableName
ShowTablesOpt *ShowTablesOpt
Scope string
ShowCollationFilterOpt *Expr
}

// Format formats the node.
Expand All @@ -1308,6 +1309,9 @@ func (node *Show) Format(buf *TrackedBuffer) {
if node.HasOnTable() {
buf.Myprintf(" on %v", node.OnTable)
}
if node.Type == "collation" && node.ShowCollationFilterOpt != nil {
buf.Myprintf(" where %v", *node.ShowCollationFilterOpt)
}
}

// HasOnTable returns true if the show statement has an "on" clause
Expand Down
3 changes: 3 additions & 0 deletions go/vt/sqlparser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,9 @@ var (
}, {
input: "show collation",
output: "show collation",
}, {
input: "show collation where `Charset` = 'utf8' and `Collation` = 'utf8_bin'",
output: "show collation where `Charset` = 'utf8' and `Collation` = 'utf8_bin'",
}, {
input: "show create database d",
output: "show create database",
Expand Down
Loading