Skip to content

Conversation

@MohamedAbdeen21
Copy link
Contributor

@MohamedAbdeen21 MohamedAbdeen21 commented Mar 30, 2025

As per MySQL docs both DEFAULT and = are optional for CHARACTER SET and COLLATE options.

Also, CHARSET is an alias for CHARACTER SET, so both should be parsed.

"CREATE TABLE foo (id INT(11)) CHARACTER SET utf8mb3 DEFAULT COLLATE utf8mb4_0900_ai_ci";
let expected =
"CREATE TABLE foo (id INT(11)) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb4_0900_ai_ci";
match mysql().one_statement_parses_to(sql, expected) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to switch this to use verified_stmt instead, we will need to replace both collate and charset fields in CreateTable with structs to capture the exact syntax used (was default keyword and/or assignment operator used? shorthand CHARSET instead of CHARACTER SET?).

@MohamedAbdeen21
Copy link
Contributor Author

Closed in favor of #1747

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.

1 participant