Skip to content

feat: enhance ALTER TABLE support with UNIQUE KEY and INVISIBLE index #2234

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

Merged
merged 3 commits into from
Apr 30, 2025

Conversation

minleejae
Copy link
Contributor

Description

This PR adds support for two MySQL DDL statements:

ALTER TABLE ADD CONSTRAINT UNIQUE KEY syntax
ALTER TABLE ALTER INDEX INVISIBLE syntax

Problem Solved

Previously, JSqlParser couldn't properly parse the following SQL statements:

ALTER TABLE sbtest1 ADD CONSTRAINT UNIQUE KEY ux_c3 (c3);
ALTER TABLE sbtest1 ALTER INDEX c4 INVISIBLE;

These are valid MySQL syntax for adding a unique constraint with a custom name and for making an index invisible to the query optimizer while keeping it maintained.

Related Issue

#2076

@minleejae
Copy link
Contributor Author

Hi, @manticore-projects

Could you please let me know when the JSqlParser 5.2 release is scheduled?
I'd like to reference this for planning purposes in my project.

Thanks!

@manticore-projects
Copy link
Contributor

Could you please let me know when the JSqlParser 5.2 release is scheduled?

Unfortunately this is not on me, but I will ask @wumpz immediately and with some luck, he will get this done in May.
Would this work for you?

@manticore-projects
Copy link
Contributor

Please fix formatting exceptions.

@minleejae
Copy link
Contributor Author

@manticore-projects
Thanks for the reply!

I'm currently working on a project that depends on JSqlParser, and I'm considering switching to the official release version rather than using a custom build.
There's no urgency at all — I just wanted to get a rough idea of the possible timeline.
Appreciate your help, thank you!

@manticore-projects
Copy link
Contributor

Thank you for your work and effort! Cheers!

@manticore-projects manticore-projects merged commit 78318bb into JSQLParser:master Apr 30, 2025
2 of 3 checks passed
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