GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Render single spaces in DROP PRIMARY KEY, RENAME TABLE and indexes by minleejae · Pull Request #2792 · JSQLParser/JSqlParser

Conversation

@minleejae

@minleejae minleejae commented Oct 13, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Purpose

Render DDL with single spaces between words. Today:

  • ALTER TABLE t DROP PRIMARY KEY ends with a space, and with a parameter renders DROP PRIMARY KEY CASCADE.
  • RENAME TABLE t TO t2 renders RENAME TABLE t TO t2.
  • ALTER TABLE t ADD INDEX i (a) renders ADD INDEX i (a).

The SQL still reparses, but the extra spaces differ from the input and from each other.

Current design (As-is)

  • The DROP PRIMARY KEY renderer appends a trailing space. The shared tail adds its own space before parameters.
  • RenameTableStatement appends " TABLE " and then " " or " IF EXISTS ".
  • Index prefixes 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)

  • Separate these words with exactly one space and add no leading or trailing space.
  • Rendered SQL is otherwise unchanged. The SQL renderer and StatementDeParser produce the same text.

Validation

  • New DeparseWhitespaceTest:
    • Compares toString() and StatementDeParser output exactly for DROP PRIMARY KEY (alone, with CASCADE, and followed by another action), RENAME (with and without TABLE, IF EXISTS, and several tables), ADD INDEX/ADD KEY, and an index inside CREATE TABLE.
    • Checks constructed Index declarations directly.
  • Three existing assertions that encoded ADD INDEX now expect a single space.
  • Java 17 offline Gradle spotlessApply check: 10,105 tests, 10,080 passed, 25 skipped, zero failures/errors.
  • Ran the rendered statements on MySQL 8.4, MySQL 8.0 and MariaDB 11.4 (19 cases), including MariaDB RENAME TABLE IF EXISTS. All succeed in original and rendered form.

Integration validation

Applied #2788, #2789, #2790, #2791 and #2792 together on master (166f0a27):

  • Every pair merges without conflicts, and the combined grammar is free of choice conflicts.
  • The integrated build passes Java 17 offline Gradle spotlessApply check: 10,150 tests, 10,125 passed, 25 skipped, zero failures/errors.
  • With the integrated build, the same server results hold on MySQL 8.4, MySQL 8.0, MariaDB 11.4 and PostgreSQL 18.3:
    • the 95 statement cases of these PRs;
    • the 11 default-mode drop cases;
    • 51 string literal comparisons, including 16 mixed-escape literals that need Lex MySQL backslash escapes consistently in string literals #2790 and Resolve backslash escapes in StringValue.getNotExcapedValue() #2791 together.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@minleejae
fix: render single spaces in DROP PRIMARY KEY, RENAME TABLE and indexes
6e1f4ea
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 <[email protected]>
This was referenced Oct 13, 2026
Parse MySQL CHECK, OPTIMIZE and REPAIR TABLE statements #2788
Merged
Accept named FOREIGN KEY and CHECK drops without a dialect #2789
Merged
Lex MySQL backslash escapes consistently in string literals #2790
Merged
Resolve backslash escapes in StringValue.getNotExcapedValue() #2791
Merged
@manticore-projects
manticore-projects merged commit 2c0359a into JSQLParser:master Oct 13, 2026
10 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@manticore-projects

manticore-projects commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Thank you!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@minleejae minleejae mentioned this pull request Oct 14, 2026
Render single spaces in ALTER visibility, FORCE and row level security actions #2819
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@minleejae @manticore-projects
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.