-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
*: SubSelect can be used as select statement #350
Conversation
@@ -3437,6 +3437,11 @@ Statement: | |||
| UnionStmt | |||
| UpdateStmt | |||
| UseStmt | |||
| SubSelect |
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.
I think here may be `'(' SelectStmt ')', not SubSelect, in MySQL, SubSelect is not the same as select.
And you can see the MySQL parser that it uses select too, not sub select.
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.
I tried to add '(' SelectStmt ')' into SelectStmt rule, but I got unresolveable confliction.
Conflicts: parser/parser_test.go
LGTM |
@@ -257,6 +257,14 @@ func trimSQL(sql string) string { | |||
} | |||
break | |||
} | |||
// Trim leading '('. For `(select 1);` is also a query. |
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.
If trim '(', any need to trim ')' suffix?
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.
No, We judge if the statement is a query only by the prefix
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.
Then sql will be select 1);
Seems like an invalid sql?
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.
This is only used to check if sql is query in interpreter. And the trimed sql text will not be used outside this function.
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.
PTAL @qiuyesuifeng
*: SubSelect can be used as select statement
* Revert "disable resource group sql interface (pingcap#309)" This reverts commit 1582986. * new way to disable resource group Signed-off-by: zeminzhou <[email protected]> --------- Signed-off-by: zeminzhou <[email protected]>
new way disable ru --------- Signed-off-by: zeminzhou <[email protected]>
Fix #320
@siddontang