Parse ALTER TABLE AUTO_INCREMENT operation for MySQL (#1748)

This commit is contained in:
Michael Victor Zink 2025-02-26 21:40:30 -08:00 committed by GitHub
parent 5b3500139a
commit c2914f82e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 36 additions and 0 deletions

View file

@ -2470,6 +2470,19 @@ fn parse_alter_table_with_algorithm() {
mysql_and_generic().verified_stmt("ALTER TABLE `users` ALGORITHM = COPY");
}
#[test]
fn parse_alter_table_auto_increment() {
let sql = "ALTER TABLE tab AUTO_INCREMENT = 42";
let expected_operation = AlterTableOperation::AutoIncrement {
equals: true,
value: number("42").with_empty_span(),
};
let operation = alter_table_op(mysql().verified_stmt(sql));
assert_eq!(expected_operation, operation);
mysql_and_generic().verified_stmt("ALTER TABLE `users` AUTO_INCREMENT 42");
}
#[test]
fn parse_alter_table_modify_column_with_column_position() {
let expected_name = ObjectName::from(vec![Ident::new("orders")]);