Skip to content

MySQL: Parse USING index type before PRIMARY KEY and UNIQUE columns - #2739

Merged
LucaCappelletti94 merged 2 commits into
mainfrom
upstream/mysql-primary-key-using-before-columns
Oct 28, 2026
Merged

LucaCappelletti94 merged 2 commits into
mainfrom
upstream/mysql-primary-key-using-before-columns

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

CREATE TABLE t (id INT, PRIMARY KEY USING BTREE (id)) failed with Expected: a list of columns in parentheses, found: BTREE, and so did UNIQUE USING BTREE (id) and UNIQUE KEY USING BTREE (id). MySQL allows the index type before the key parts without an index name (https://dev.mysql.com/doc/refman/8.4/en/create-table.html), but the PRIMARY and UNIQUE arms of parse_optional_table_constraint took USING as the index name.

The INDEX/KEY arm already skipped the name when the next word is USING. That check now sits in one private helper that all three arms call.

@LucaCappelletti94 LucaCappelletti94 added the enhancement New feature or request label Oct 27, 2026
@github-actions github-actions Bot added the MySQL label Oct 27, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.50000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.31%. Comparing base (23e9e88) to head (7498533).

Files with missing lines Patch % Lines
src/parser/mod.rs 62.50% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2739      +/-   ##
==========================================
+ Coverage   82.30%   82.31%   +0.01%     
==========================================
  Files          42       42              
  Lines       35294    35297       +3     
  Branches    35294    35297       +3     
==========================================
+ Hits        29047    29054       +7     
  Misses       2690     2690              
+ Partials     3557     3553       -4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LucaCappelletti94

Copy link
Copy Markdown
Contributor Author

Thanks @sabir-akhadov-localstack for the review, I will be merging this now.

cc @alamb

@LucaCappelletti94
LucaCappelletti94 added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit e567c21 Oct 28, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request MySQL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants