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

Allow primary keys with auto_increment columns to be dropped when an appropriate index exists #2316

Merged
merged 4 commits into from
Feb 7, 2024

Conversation

fulghum
Copy link
Contributor

@fulghum fulghum commented Feb 5, 2024

MySQL allows a primary key with an auto_increment column to be dropped as long as there is a secondary index that includes the auto_increment column as the first column in the index. (MySQL Reference)

This PR also enables dropping a primary key by referencing it by it's ID (PRIMARY), in order to match MySQL's behavior, e.g.

DROP INDEX `PRIMARY` ON t;

Related to dolthub/dolt#7456

@fulghum fulghum requested a review from zachmu February 5, 2024 22:47
Copy link
Member

@zachmu zachmu left a comment

Choose a reason for hiding this comment

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

LGTM!

enginetest/queries/alter_table_queries.go Outdated Show resolved Hide resolved
enginetest/queries/alter_table_queries.go Outdated Show resolved Hide resolved
@fulghum fulghum merged commit 0aaa10a into main Feb 7, 2024
6 of 7 checks passed
@fulghum fulghum deleted the fulghum/dolt-7456 branch February 7, 2024 00:19
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.

2 participants