Skip to content

fix: keep PostgreSQL column constraint names and attributes together - #2698

Merged
manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:fix/ddl-column-constraints-20260925
Sep 25, 2026
Merged

manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:fix/ddl-column-constraints-20260925

Conversation

@minleejae

Copy link
Copy Markdown
Contributor

PostgreSQL column PRIMARY KEY and UNIQUE names and attributes were split between raw column tokens and the constraint node. Renaming a constraint or replacing its deferrability could therefore generate duplicate, invalid SQL. Named column REFERENCES clauses had the same ownership problem.

Keep names and attributes on their structured nodes through the shared CREATE TABLE / ALTER TABLE ADD COLUMN path, reusing the existing constraint-attribute parser. Also allow table CHECK attributes to surround NO INHERIT, while retaining the column CHECK ordering boundary.

Validation: full Gradle check, grammar ambiguity gate, AST rename/removal and attribute replacement tests, both printers and reparsing. PostgreSQL 18.6 accepted all 10 audited CHECK-order variants and the corrected column-constraint mutations; MySQL 9.7.2 and 26.7.0 CHECK mutation controls remain valid. DB comparisons include constraint names and catalog flags.

Signed-off-by: minleejae <mmj9808@gmail.com>
@manticore-projects
manticore-projects merged commit ac34c3f into JSQLParser:master Sep 25, 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