Support ALTER INDEX {INDEX_NAME} RENAME TO {NEW_INDEX_NAME} (#767)

* test: add a case `rename_index`

* feat: add AlterIndex match arm

* fix: remove todo with self.expected

* chore: add comment to unreachable
This commit is contained in:
henry 2022-12-28 22:35:27 +09:00 committed by GitHub
parent f0870fd315
commit 61c661c234
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 229 additions and 164 deletions

View file

@ -2686,6 +2686,21 @@ fn parse_alter_table() {
}
}
#[test]
fn parse_alter_index() {
let rename_index = "ALTER INDEX idx RENAME TO new_idx";
match verified_stmt(rename_index) {
Statement::AlterIndex {
name,
operation: AlterIndexOperation::RenameIndex { index_name },
} => {
assert_eq!("idx", name.to_string());
assert_eq!("new_idx", index_name.to_string())
}
_ => unreachable!(),
};
}
#[test]
fn parse_alter_table_add_column() {
match verified_stmt("ALTER TABLE tab ADD foo TEXT") {