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

MySQL - Alter Table ... Add Index. Parsing as Command #3615

Closed
hubg398 opened this issue Jun 9, 2024 · 0 comments · Fixed by #3621
Closed

MySQL - Alter Table ... Add Index. Parsing as Command #3615

hubg398 opened this issue Jun 9, 2024 · 0 comments · Fixed by #3621
Assignees

Comments

@hubg398
Copy link

hubg398 commented Jun 9, 2024

Fully reproducible code snippet

ddl = """
ALTER TABLE
    `posts` ADD INDEX `posts_integer_column__index_key_index`(`integer_column__index_key`);
"""
ast = parse_one(ddl, dialect="mysql")

Official Documentation
https://dev.mysql.com/doc/refman/8.4/en/alter-table.html

Found this one today, not sure if I'm missing something. It works if we remove the index name.
Probably has few other related ones if it is indeed a bug:

  1. KEY
ALTER TABLE
    `posts` ADD KEY `posts_integer_column__index_key_index`(`integer_column__index_key`);
  1. UNIQUE
ALTER TABLE
    `posts` ADD UNIQUE `posts_integer_column__index_key_unique`(`integer_column__unique_key`);

Thanks

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 a pull request may close this issue.

2 participants