Skip to content

Commit

Permalink
parser: fix some parse error for parenthese subqueries (#1255)
Browse files Browse the repository at this point in the history
  • Loading branch information
lzmhhh123 authored Aug 16, 2021
1 parent f8bd71b commit b4bbfae
Show file tree
Hide file tree
Showing 4 changed files with 7,314 additions and 7,044 deletions.
7 changes: 7 additions & 0 deletions ast/dml.go
Original file line number Diff line number Diff line change
Expand Up @@ -1544,6 +1544,7 @@ func (s *SetOprType) String() string {
type SetOprStmt struct {
dmlNode

IsInBraces bool
SelectList *SetOprSelectList
OrderBy *OrderByClause
Limit *Limit
Expand All @@ -1563,6 +1564,12 @@ func (n *SetOprStmt) Restore(ctx *format.RestoreCtx) error {
return errors.Annotate(err, "An error occurred while restore UnionStmt.With")
}
}
if n.IsInBraces {
ctx.WritePlain("(")
defer func() {
ctx.WritePlain(")")
}()
}

if err := n.SelectList.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while restore SetOprStmt.SelectList")
Expand Down
Loading

0 comments on commit b4bbfae

Please sign in to comment.