-
-
Notifications
You must be signed in to change notification settings - Fork 652
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
MySQL: support remaining constraint parts of CREATE/ALTER TABLE #3827
MySQL: support remaining constraint parts of CREATE/ALTER TABLE #3827
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3827 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 179 179
Lines 13727 13727
=========================================
Hits 13727 13727
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Ref("BracketedColumnReferenceListGrammar"), | ||
AnySetOf( | ||
Sequence( | ||
"KEY_BLOCK_SIZE", |
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.
Why was this deleted? I don't see similar code in TableConstraintSegment
.
Ref("BracketedColumnReferenceListGrammar"), | ||
AnySetOf( | ||
Sequence( | ||
"KEY_BLOCK_SIZE", |
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.
Why was this deleted? I don't see similar code in TableConstraintSegment.
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.
Why was this deleted? I don't see similar code in TableConstraintSegment.
Deleted pattern was "[UNIQUE] [INDEX | KEY] ... [index_option] ...", and it is replaced by the combination of
"[CONSTRAINT] UNIQUE [INDEX | KEY] ... [index_option] ..." (around line 646) and "{INDEX | KEY} ... [index_option] ..." (around line 703) in TableConstraintSegment.
Deleted pattern also includes a pattern in which both UNIQUE and (INDEX or KEY) are absent, and it is not covered by TableConstraintSegment. I think there is no problem by ignoring it since it is a invalid query.
AnySetOf(...) represents "[index_option]..." and is covered by IndexOptionsSegment.
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.
With these changes, is it still possible to use KEY_BLOCK_SIZE
? (Strangely, there is no .sql
file using this.) Could you please add a test case for it to your PR?
You could use one of the examples from this page: https://dev.mysql.com/doc/refman/5.7/en/innodb-compression-usage.html
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.
With these changes, is it still possible to use KEY_BLOCK_SIZE? (Strangely, there is no .sql file using this.)
Yes.
Could you please add a test case for it to your PR?
Added in 2512947
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.
Thanks!
Brief summary of the change made
Continuing from #3826, I implemented all the parts related to constraints in CREATE TABLE and ALTER TABLE, including CHECK constraint support.
https://dev.mysql.com/doc/refman/8.0/en/create-table.html
https://dev.mysql.com/doc/refman/8.0/en/alter-table.html
Are there any other side effects of this change that we should be aware of?
Pull Request checklist
Please confirm you have completed any of the necessary steps below.
Included test cases to demonstrate any code changes, which may be one or more of the following:
.yml
rule test cases intest/fixtures/rules/std_rule_cases
..sql
/.yml
parser test cases intest/fixtures/dialects
(note YML files can be auto generated withtox -e generate-fixture-yml
).test/fixtures/linter/autofix
.Added appropriate documentation for the change.
Created GitHub issues for any relevant followup/future enhancements if appropriate.