Skip to content

feat: attach PostgreSQL constraints to existing indexes - #2676

Open
minleejae wants to merge 1 commit into
JSQLParser:masterfrom
minleejae:feat/postgresql-constraint-using-index
Open

minleejae wants to merge 1 commit into
JSQLParser:masterfrom
minleejae:feat/postgresql-constraint-using-index

Conversation

@minleejae

Copy link
Copy Markdown
Contributor

In POSTGRESQL mode, parse ALTER TABLE t ADD [CONSTRAINT name] UNIQUE|PRIMARY KEY USING INDEX index_name, including deferrability attributes and combined ALTER actions.

Expose this as ConstraintUsingIndex, with the new constraint name separated from getExistingIndexName(). Callers can inspect, edit or construct the reference; rendering is shared by toString() and the statement deparser. Metadata validation distinguishes the newly declared constraint from the existing index, and table discovery does not report the index as a table. Includes API usage documentation and regressions for ordinary constraints and Oracle's existing USING INDEX tail.

Validation: full Gradle check on Java 17; four fixtures executed in original and rendered form on PostgreSQL 18, checking pg_constraint for the resulting name, kind, attached index and deferrability.

Syntax reference: https://www.postgresql.org/docs/18/sql-altertable.html

Signed-off-by: minleejae <mmj9808@gmail.com>
@minleejae
minleejae force-pushed the feat/postgresql-constraint-using-index branch from f99acbe to d4b2845 Compare September 22, 2026 09:38

This branch has not been deployed

No deployments
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.

1 participant