-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
The parser fails with an error when parsing a COUNT(DISTINCT ...) expression. It seems that the AST cannot represent this expression.
Example:
package main
import (
"bytes"
"log"
"github.com/akito0107/xsqlparser"
"github.com/akito0107/xsqlparser/dialect"
)
func main() {
sql := "SELECT COUNT(DISTINCT id) FROM foo"
parser, _ := xsqlparser.NewParser(bytes.NewBufferString(sql), &dialect.MySQLDialect{})
_, err := parser.ParseStatement()
if err != nil {
log.Fatalln(err)
}
}Error:
2022/06/10 15:31:33 parseQueryBody failed: parseSelect failed: parseSelectList failed: ParseExpr failed: parsePrefix failed: parseFunction failed: expected RParen but &{Kind:SQLKeyword Value:id From:{Line:1 Col:23} To:{Line:1 Col:25}}
exit status 1
Metadata
Metadata
Assignees
Labels
No labels