Skip to content

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

Merged
manticore-projects merged 3 commits into
JSQLParser:masterfrom
minleejae:feat/index
Apr 30, 2025
Merged

manticore-projects merged 3 commits into
JSQLParser:masterfrom
minleejae:feat/index

Conversation

@minleejae

Copy link
Copy Markdown
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