Skip to content

fix: reuse structured constraints for MySQL inline CHECK - #2688

Merged
manticore-projects merged 2 commits into
JSQLParser:masterfrom
minleejae:fix/mysql-inline-check-ast
Sep 24, 2026
Merged

manticore-projects merged 2 commits into
JSQLParser:masterfrom
minleejae:fix/mysql-inline-check-ast

Conversation

@minleejae

@minleejae minleejae commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

MySQL column CHECK clauses with ENFORCED or NOT ENFORCED are not handled consistently with table constraints. Route column checks through the existing CheckConstraintSpec production and CheckConstraint AST.

CREATE TABLE and ALTER ADD/MODIFY/CHANGE already share column option parsing; all now retain the constraint name, expression, and enforcement flag, including custom expression deparsing.

Validation:

  • Full Gradle check passed (Java 17), including grammar ambiguity, unit tests, coverage, formatting, Checkstyle, PMD, and SpotBugs.
  • MySQL 8.4.11 accepted negative values for NOT ENFORCED checks in all four CREATE/ALTER paths; original, toString, and deparser SQL behaved identically.
  • Added AST, mutation, and parse/deparse regression coverage.

Syntax reference: official documentation.

Additional version-boundary validation: the original, toString, and deparser SQL was executed on isolated MySQL 9.7.2 and 26.7.0 servers, including the focused behavioral cases. Also tested PostgreSQL 18.6 inline CHECK NOT ENFORCED with and without NO INHERIT, and added regressions. Reviewed the MySQL 9.7 and MySQL 26.7 grammar. Runtime version numbers above identify the tested binaries; this does not claim support for every statement in those DBMS versions.

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