Skip to content

feat: support MySQL ALTER DATABASE options - #2700

Merged
manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:feat/mysql-alter-database
Sep 25, 2026
Merged

manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:feat/mysql-alter-database

Conversation

@minleejae

Copy link
Copy Markdown
Contributor

MySQL ALTER DATABASE options currently fall through to UnsupportedStatement, preventing callers from inspecting or changing database defaults through the AST.

Add a structured AlterDatabase statement and reuse the existing CREATE DATABASE / CREATE SCHEMA option model and parser for character set, collation and encryption. READ ONLY is parsed only in ALTER. Preserve optional database names, equals signs and the MySQL SCHEMA synonym, with visitor and deparser integration.

Validation: full Gradle check and grammar ambiguity gate; option mutation, visitor dispatch, unnamed database, statement boundaries and invalid READ ONLY values. The three audited option groups execute and retain their SHOW CREATE DATABASE results on both MySQL 9.7.2 and 26.7.0.

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

Copy link
Copy Markdown
Contributor

Thank you!

manticore-projects pushed a commit that referenced this pull request Oct 17, 2026
…#2811)

Since #2700, every PostgreSQL ALTER DATABASE fails to parse, while 5.4
returned an UnsupportedStatement. Model RENAME TO, OWNER TO, SET
TABLESPACE, REFRESH COLLATION VERSION, the [WITH] options and SET/RESET
of configuration parameters. Outside the MySQL dialect, other ALTER
DATABASE forms are unsupported statements again, and ALTER SCHEMA with
MySQL options no longer requires that dialect.

Extract the SET/RESET state of AlterRole into ConfigurationParameterChange,
which ALTER DATABASE shares; AlterRole keeps its accessors. Type each
PostgreSQL CREATE DATABASE option, accept the CHAR SET and CHARSET
spellings, keep CreateDatabase options in one list and drop the empty raw
option that added a trailing space.

Signed-off-by: minleejae <mmj9808@gmail.com>
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