-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
parser: support 'CREATE TABLE ... SELECT' syntax (#4754) #6851
Conversation
Hi contributor, thanks for your PR. This patch needs to be approved by someone of admins. They should reply with "/ok-to-test" to accept this PR for running test automatically. |
/add-to-whitelist |
/run-all-tests |
@bb7133 Thanks to your contribution, I'll look into the failed test case. |
parser/parser.y
Outdated
@@ -600,6 +600,7 @@ import ( | |||
ConstraintKeywordOpt "Constraint Keyword or empty" | |||
CreateIndexStmtUnique "CREATE INDEX optional UNIQUE clause" | |||
CreateTableOptionListOpt "create table option list opt" | |||
CreateTableSelectOpt "Select/Union statement in CREATE TABLE ... 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.
Please keep the indent.
parser/parser.y
Outdated
@@ -653,6 +654,7 @@ import ( | |||
JoinType "join type" | |||
KillOrKillTiDB "Kill or Kill TiDB" | |||
LikeEscapeOpt "like escape option" | |||
LikeTableWithOrWithoutParen "LIKE table_name or ( LIKE table_name )" |
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.
ditto
} | ||
| "CREATE" "TABLE" IfNotExists TableName "LIKE" TableName | ||
| "CREATE" "TABLE" IfNotExists TableName LikeTableWithOrWithoutParen |
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.
Add some test to LikeTableWithOrWithoutParen?
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.
OK~
/run-integration-common-test -tidb-test=pr/553 |
/run-common-test -tidb-test=pr/553 |
The failed internal tidb test case was fixed by tidb-test/pr/553, please address comments. @bb7133 |
parser/parser.y
Outdated
@@ -1876,6 +1868,57 @@ PartDefStorageOpt: | |||
| "ENGINE" eq Identifier | |||
{} | |||
|
|||
OnDuplicateCreateTableOpt: |
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.
s/OnDuplicateCreateTableOpt/DuplicateOpt/g, MySQL name it opt_duplicate
here.
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.
OK, thanks!
| "AS" | ||
{} | ||
|
||
CreateTableSelectOpt: |
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.
Miss '(' SelectStmt ')'
?
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.
It is included in 'SubSelect', PTAL thanks
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.
reset LGTM
122b52e
to
a8033da
Compare
/run-all-tests -tidb-test=pr/553 |
1 similar comment
/run-all-tests -tidb-test=pr/553 |
1. added tests for 'create table ... (like ...)' syntax 2. added more other tests for 'create table ... select' syntax 3. fixed a bug on 'TableMustHaveColumn'(MySQL errcode 1113) error
a8033da
to
8f4d0d2
Compare
/run-all-tests -tidb-test=pr/553 |
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.
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
What have you changed? (mandatory)
This is the first part of PRs for issue #4754:
What are the type of the changes (mandatory)?
How has this PR been tested (mandatory)?
Some new SQL statements are added in the tests to verify the parsed result
Does this PR affect documentation (docs/docs-cn) update? (optional)
Nope
Refer to a related PR or issue link (optional)
Issue 4754: #4754
Benchmark result if necessary (optional)
Add a few positive/negative examples (optional)