Repository navigation
Conversation
ALTER TABLE ... DROP FOREIGN KEY fk and DROP CHECK ck were only accepted with Dialect.MYSQL, so the default parser configuration rejected these common MySQL actions (JSQLParser#990, JSQLParser#1129). Accept them without a dialect as in MySQL, accept the named FOREIGN KEY form for MariaDB, which has no DROP CHECK, and keep rejecting them in other dialects. A parenthesized FOREIGN KEY column list keeps the legacy form. Signed-off-by: minleejae <mmj9808@gmail.com>
This was referenced Oct 13, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Parse
ALTER TABLE t DROP FOREIGN KEY fkandALTER TABLE t DROP CHECK ckwithout selecting a dialect. These common MySQL actions fail in the default configuration, as reported in #990 and #1129.Dialect.MYSQLhas accepted them since #2675.Current design (As-is)
The named form is selected only when the dialect is MYSQL:
DROP FOREIGN KEY (cols)form is accepted.Dialect.MARIADBalso rejectsDROP FOREIGN KEY fk, although MariaDB supports it.Target design (To-be)
Dialect.MYSQL.Dialect.MARIADB, accept the named FOREIGN KEY drop. MariaDB has noDROP CHECK, so that form stays rejected.DROP CONSTRAINT.DROP_FOREIGN_KEY/DROP_CHECKwithgetConstraintName().Validation
DROP FOREIGN KEY fk1, DROP CHECK c1;spotlessApply check: 10,102 tests, 10,077 passed, 25 skipped, zero failures/errors. The grammar choice conflict check passes.DROP FOREIGN KEY fk1succeeds;DROP CHECK c1is rejected by both the server and the parser in MariaDB mode.Integration validation
Applied #2788, #2789, #2790, #2791 and #2792 together on
master(166f0a27):spotlessApply check: 10,150 tests, 10,125 passed, 25 skipped, zero failures/errors.