Skip to content

Add support for MySQL ALTER TABLE ... [DEFAULT] COLLATE [=] collation_name syntax #2204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2025

Conversation

minleejae
Copy link
Contributor

Description

This PR adds support for the following MySQL-compatible ALTER TABLE syntax:

ALTER TABLE tbl_name [DEFAULT] COLLATE [=] collation_name

Changes

  • Updated JavaCC grammar to recognize [DEFAULT] COLLATE [=] collation_name as a valid ALTER TABLE clause

  • Introduced a new AlterOperation.COLLATE operation to distinguish this clause from CONVERT TO CHARACTER SET ...

  • Added defaultCollateSpecified and hasEqualForCollate flags to AlterExpression to track optional parts of the syntax

  • Modified toString() in AlterExpression to deparse the new syntax correctly

@manticore-projects
Copy link
Contributor

Well done and thank you!

@manticore-projects manticore-projects merged commit 48d195b into JSQLParser:master Mar 25, 2025
3 of 4 checks passed
@minleejae minleejae deleted the fix/collate branch April 2, 2025 09:16
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