Skip to content

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

Closed
@niconoe-

Description

@niconoe-

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions