Skip to content

Support Informix trailing constraint names and share constraint rendering - #2570

Merged
manticore-projects merged 2 commits into
JSQLParser:masterfrom
minleejae:fix/informix-constraint-names
Sep 11, 2026
Merged

Support Informix trailing constraint names and share constraint rendering#2570
manticore-projects merged 2 commits into
JSQLParser:masterfrom
minleejae:fix/informix-constraint-names

Conversation

@minleejae

@minleejae minleejae commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Informix places an optional constraint name after its definition, for example:

ALTER TABLE child ADD CONSTRAINT FOREIGN KEY (id)
REFERENCES parent(id) CONSTRAINT fk_child;

Support this form for primary, unique, foreign and check constraints, including unnamed constraints, when explicitly selecting parser.withDialect(Dialect.INFORMIX). Other dialects retain the existing constraint interpretation.

The existing constraint models expose the name, columns, referenced table and CHECK expression; NamedConstraint.ConstraintNamePosition preserves the name's placement. Shared prefix/suffix rendering keeps model and deparser output consistent while preserving the existing leading-name API defaults.

Validation:

  • Full Gradle check and Maven verify.
  • Original primary/foreign/unique reproducers, quoted and omitted names, composite keys, mutable AST names, subsequent actions/statements, malformed input, and rejection of trailing names without the Informix dialect.
  • SQL round-trips, CHECK expression visitor customization, referenced-table traversal, and existing CREATE/ALTER regression tests.
  • Syntax checked against the Informix ADD CONSTRAINT documentation.

Fixes #271.

Comment thread src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
@manticore-projects
manticore-projects merged commit 329ee6b into JSQLParser:master Sep 11, 2026
6 of 7 checks passed
@manticore-projects

Copy link
Copy Markdown
Contributor

Thank you much!

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.

Parse errors for ALTER TABLE with Informix syntax

2 participants