Skip to content

Support MySQL SELECT INTO user variables and share INTO rendering - #2583

Merged
manticore-projects merged 2 commits into
JSQLParser:masterfrom
minleejae:fix/mysql-select-into-variables
Sep 11, 2026
Merged

Support MySQL SELECT INTO user variables and share INTO rendering#2583
manticore-projects merged 2 commits into
JSQLParser:masterfrom
minleejae:fix/mysql-select-into-variables

Conversation

@minleejae

Copy link
Copy Markdown
Contributor

With Dialect.MYSQL or Dialect.MARIADB, SELECT COUNT(*) INTO @countTotal FROM employee now parses with a structured list of UserVariable targets. Variable INTO clauses preserve their position before FROM or at the end of the query, including multiple targets and quoted variable names.

Extend MySqlSelectIntoClause and share its rendering between toString and SelectDeParser, including custom expression visitors. SelectVisitorAdapter traverses the targets; table discovery excludes them, and statement feature analysis identifies a session assignment without a result set or schema change. Duplicate INTO clauses and system-variable targets are rejected.

Validation: original reproducer, dialect isolation, both clause positions, AST round-trips and mutation, visitor customization, statement boundaries and malformed inputs; full Gradle check and Maven verify.

Fixes #854.

@manticore-projects
manticore-projects merged commit 588bf07 into JSQLParser:master Sep 11, 2026
9 checks passed
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.

Cannot use MySQL user variables after INTO clause

2 participants