Skip to content

Support AUTO_INCREMENT for MySQL and AUTOINCREMENT for SQLite #234

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

Merged
merged 9 commits into from
Jul 28, 2020

Conversation

miuy56dc
Copy link
Contributor

@miuy56dc miuy56dc commented Jul 22, 2020

In MySQL it's AUTO_INCREMENT
(see https://dev.mysql.com/doc/refman/8.0/en/create-table.html)
and in SQLite it's AUTOINCREMENT.

We use ColumnOption::DialectSpecific(Vec<Token>) to avoid adding a new variant for each vendor-specific column option.

@coveralls
Copy link

coveralls commented Jul 22, 2020

Pull Request Test Coverage Report for Build 186220604

  • 37 of 38 (97.37%) changed or added relevant lines in 5 files are covered.
  • 204 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.2%) to 91.827%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser.rs 1 2 50.0%
Files with Coverage Reduction New Missed Lines %
tests/sqlparser_common.rs 25 96.81%
src/ast/mod.rs 47 81.09%
src/parser.rs 132 88.91%
Totals Coverage Status
Change from base Build 175941714: 0.2%
Covered Lines: 4393
Relevant Lines: 4784

💛 - Coveralls

Copy link
Contributor

@maxcountryman maxcountryman left a comment

Choose a reason for hiding this comment

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

This looks good to me. 👍

@nickolay does this seem okay to you?

@nickolay
Copy link
Contributor

Yes, looks good to me too, but please add a note about this being MySQL-specific as a comment in the code (better in all of: AST, the parser and the tests), as:

Documenting the differences between dialects like this should be useful both for our users and for designing a better solution for the dialects problem.

AUTO_INCREMENT also seems to be a good case for trying ColumnOption::DialectSpecific(Vec<Token>), as suggested earlier, what do you think?

@miuy56dc miuy56dc closed this Jul 27, 2020
@miuy56dc miuy56dc reopened this Jul 27, 2020
@miuy56dc
Copy link
Contributor Author

Thank you for your suggestions. I find SQLite support AUTOINCREMENT, so add MySQLAutoIncremnt and SQLiteAutoIncrement to solve the problem.

@nickolay nickolay merged commit 09ca14f into apache:main Jul 28, 2020
Copy link
Contributor

@nickolay nickolay left a comment

Choose a reason for hiding this comment

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

Thanks!

@nickolay nickolay changed the title Support AUTO_INCREMENT for MySQL Support AUTO_INCREMENT for MySQL and AUTOINCREMENT for SQLite Aug 12, 2020
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.

5 participants