Skip to content

Reuse PostgreSQL constraint attributes in ALTER CONSTRAINT - #2717

Merged
manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:feat/postgresql-constraint-attributes-20260925
Sep 27, 2026
Merged

manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:feat/postgresql-constraint-attributes-20260925

Conversation

@minleejae

Copy link
Copy Markdown
Contributor

PostgreSQL ALTER CONSTRAINT accepts deferrability, initial timing, and enforcement attributes, including combinations that the existing ALTER parser rejected. CREATE TABLE and ADD CONSTRAINT already had a structured representation for these attributes.

Reuse ConstraintAttributes in a dedicated ALTER CONSTRAINT node, retaining the existing constraint-name and enforcement accessors. Share attribute parsing with CREATE/ADD constraints and reject empty ALTER actions, duplicate attributes, and NOT VALID in this context.

Tests compare CREATE, ADD and ALTER representations, exercise attribute permutations and AST mutations, and retain the existing ENFORCED behavior. Relevant accepted cases were executed on PostgreSQL 18.6, with original and both rendered forms producing matching constraint catalog state. Constraint-type/catalog restrictions remain the database's responsibility.

Syntax reference: ALTER TABLE.

Validation: focused tests, JavaCC ambiguity checks, Checkstyle and Spotless on this independent branch. The combined implementation also passes the full Gradle check and Maven verify; the 1,304-input prior regression corpus has no previously successful input regressions.

Signed-off-by: minleejae <mmj9808@gmail.com>
@manticore-projects
manticore-projects merged commit f270c2e into JSQLParser:master Sep 27, 2026
10 checks passed
@manticore-projects

Copy link
Copy Markdown
Contributor

Thank you!

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