Repository navigation
Conversation
DROP PRIMARY KEY ended with a space, which doubled before CASCADE or RESTRICT. RENAME TABLE rendered two spaces before the first table, and an index without a type rendered a leading space, so ALTER TABLE ... ADD INDEX and named-only indexes came out with doubled spaces. Separate these words with exactly one space; the SQL is otherwise unchanged. 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
Render DDL with single spaces between words. Today:
ALTER TABLE t DROP PRIMARY KEYends with a space, and with a parameter rendersDROP PRIMARY KEY CASCADE.RENAME TABLE t TO t2rendersRENAME TABLE t TO t2.ALTER TABLE t ADD INDEX i (a)rendersADD INDEX i (a).The SQL still reparses, but the extra spaces differ from the input and from each other.
Current design (As-is)
DROP PRIMARY KEYrenderer appends a trailing space. The shared tail adds its own space before parameters.RenameTableStatementappends" TABLE "and then" "or" IF EXISTS ".Indexprefixes its keyword and name with a space even when no index type precedes them. An index with only a keyword or a name therefore renders a leading space.Target design (To-be)
StatementDeParserproduce the same text.Validation
DeparseWhitespaceTest:toString()andStatementDeParseroutput exactly forDROP PRIMARY KEY(alone, withCASCADE, and followed by another action),RENAME(with and withoutTABLE,IF EXISTS, and several tables),ADD INDEX/ADD KEY, and an index insideCREATE TABLE.Indexdeclarations directly.ADD INDEXnow expect a single space.spotlessApply check: 10,105 tests, 10,080 passed, 25 skipped, zero failures/errors.RENAME TABLE IF EXISTS. All succeed in original and rendered form.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.