Skip to content

Commit

Permalink
fix: parse table name object
Browse files Browse the repository at this point in the history
Co-authored-by: Yingwen <[email protected]>
  • Loading branch information
e1ijah1 and evenyag authored Dec 26, 2022
1 parent 530e599 commit 7867877
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/sql/src/parsers/alter_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,12 @@ impl<'a> ParserContext<'a> {
}
} else if parser.parse_keyword(Keyword::RENAME) {
let new_table_name_obj = parser.parse_object_name()?;
let new_table_name: String = match &new_table_name_obj.0[..] {
[table] => Ok(table.value.clone()),
[_schema, table] => Ok(table.value.clone()),
_ => Err(ParserError::ParserError(format!(
"expect table name to be <schema>.<table> or <table>, actual: {new_table_name_obj}"
let new_table_name = match &new_table_name_obj.0[..] {
[table] => table.value.clone(),
_ => return Err(ParserError::ParserError(format!(
"expect table name, actual: {new_table_name_obj}"
))),
}
.unwrap();
};
AlterTableOperation::RenameTable { new_table_name }
} else {
return Err(ParserError::ParserError(format!(
Expand Down

0 comments on commit 7867877

Please sign in to comment.