Skip to content
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

Merged
merged 4 commits into from
Oct 13, 2015
Merged

Conversation

shenli
Copy link
Member

@shenli shenli commented Oct 11, 2015

@@ -3437,6 +3437,11 @@ Statement:
| UnionStmt
| UpdateStmt
| UseStmt
| SubSelect
Copy link
Member

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.

Copy link
Member Author

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.

@siddontang
Copy link
Member

LGTM
But we must realize that select is not the same as sub select, maybe we will meet some pitfalls later. :-)

@@ -257,6 +257,14 @@ func trimSQL(sql string) string {
}
break
}
// Trim leading '('. For `(select 1);` is also a query.
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shenli added a commit that referenced this pull request Oct 13, 2015
*: SubSelect can be used as select statement
@shenli shenli merged commit 8fec2e4 into master Oct 13, 2015
@shenli shenli deleted the sheni/issue-320 branch October 13, 2015 02:33
iosmanthus pushed a commit to iosmanthus/tidb that referenced this pull request May 11, 2023
* 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]>
rleungx pushed a commit to rleungx/tidb that referenced this pull request Feb 26, 2024
new way disable ru
---------

Signed-off-by: zeminzhou <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants