Skip to content

Add support for parsing MySQL ALTER TABLE statements with advanced options #2223

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 2 commits into from
Apr 9, 2025

Conversation

minleejae
Copy link
Contributor

Summary

This PR introduces support for parsing MySQL ALTER TABLE statements with the following new options:

ALTER TABLE tbl_name
    [alter_option [, alter_option] ...]

  | ALTER {CHECK | CONSTRAINT} symbol [NOT] ENFORCED
  | ALTER [COLUMN] col_name {
        SET DEFAULT {literal | (expr)}
      | SET {VISIBLE | INVISIBLE}
      | DROP DEFAULT
    }
  | ALTER INDEX index_name {VISIBLE | INVISIBLE}

Changes

  • Updated the parser to handle the new syntax for ALTER TABLE.
  • Added support for parsing column visibility, default value modifications, and constraint enforcement.
  • Enhanced the AlterExpression and related classes to accommodate the new options.

Testing

  • Added unit tests to verify the parsing of the new ALTER TABLE syntax.
  • Verified backward compatibility with existing ALTER TABLE statements.

Impact

This change enables the library to support advanced MySQL features, improving compatibility with modern MySQL versions.

@manticore-projects manticore-projects merged commit 9a36a48 into JSQLParser:master Apr 9, 2025
3 of 4 checks passed
@manticore-projects
Copy link
Contributor

Thanks!

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