-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow query options to appear in any order any number of times #283
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it an error in MySQL to include an option more than once? What about mutually exclusive options? Like what happens if you do ALL and DISTINCT in the same query in mysql?
go/vt/sqlparser/ast.go
Outdated
Comments Comments | ||
Distinct string | ||
Hints string | ||
QueryOpts []string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need each option as a separate field in the Select struct, but a string slice is too free form. You probably want to have a QueryOpts struct to hold these things during list construction with a .Merge()
method like we have with column type options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the changes
StraightJoinHint = "straight_join " | ||
DistinctStr = "distinct " | ||
AllStr = "all " | ||
StraightJoinHintStr = "straight_join " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you still need these consts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're used in the Format()
method, and some other parts of sql.y
still rely on DistinctStr
Allow statements like this to parse:
Fixes dolthub/dolt#6829
Companion PR: dolthub/go-mysql-server#2088