Skip to content

fix: share SET assignment parsing and support MySQL character set selection - #2661

Merged
manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:fix/mysql-set-assignment-structure
Sep 21, 2026
Merged

manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:fix/mysql-set-assignment-structure

Conversation

@minleejae

Copy link
Copy Markdown
Contributor

SET @a := 1 fails, while subsequent user-variable assignments are stored inside the first assignment's value list: SET @a=1, @b=2 reports only one entry. SET CHARACTER SET utf8mb4 is also unsupported.

Share one assignment production between the first and subsequent entries, and represent punctuation with AssignmentOperator (NONE, EQUALS, COLON_EQUALS). Each top-level assignment can now be inspected and modified independently. Existing boolean useEqual methods retain their equals/no-equals behavior; the new accessors preserve :=. Nested assignments remain inside their value expression, and PostgreSQL comma-separated setting values remain a single entry.

Add CHARACTER SET/CHARSET selection with quoted names and DEFAULT, including valid combinations such as SET CHARSET DEFAULT, @a=1. Statement punctuation continues to be shared with expression deparsers. Existing SQL Server option groups and PostgreSQL settings have regression coverage.

References: MySQL SET assignments, SET CHARACTER SET.

Validation:

  • Full Gradle check passed on Java 17, including grammar ambiguity, formatting, static analysis, coverage and the full test suite. JUnit XML totals: 7831 tests, 0 failures/errors, 25 skipped.
  • MySQL 8.4.11: 19 cases (14 valid, 5 invalid). For all 14 valid cases, the original SQL, toString output and StatementDeParser output executed with identical results.

…ection

Signed-off-by: minleejae <mmj9808@gmail.com>
@manticore-projects
manticore-projects merged commit f54a22a into JSQLParser:master Sep 21, 2026
10 checks passed
@manticore-projects

Copy link
Copy Markdown
Contributor

Nice refactoring, 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