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

ALTER TABLE ADD UNIQUE (KEY) is not recognized as an alter option #610

Open
niconoe- opened this issue Jan 30, 2025 · 0 comments
Open

ALTER TABLE ADD UNIQUE (KEY) is not recognized as an alter option #610

niconoe- opened this issue Jan 30, 2025 · 0 comments
Labels

Comments

@niconoe-
Copy link
Contributor

When trying to parse some SQL like:

ALTER TABLE testtable 
ADD UNIQUE KEY name_of_the_unique_constraint (`UNIQUE_COLUMN`);

or

ALTER TABLE testtable 
ADD UNIQUE name_of_the_unique_constraint (`UNIQUE_COLUMN`);

the parser considers every token after the ADD keyword as "unknown", while adding indexes or constraint works well. This is due to the lack of the presence of the options "UNIQUE" and "UNIQUE KEY" in the AlterOperation::$TABLE_OPTIONS array.

I'll provide a PR about it, fixing also the unit tests about the parser expecting unknown tokens rather than well accepted options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants