mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-04 14:28:22 +00:00
Support DROP DATABASE
(#1443)
This commit is contained in:
parent
2af981e4e6
commit
73dc8a352d
3 changed files with 42 additions and 1 deletions
|
@ -6734,6 +6734,43 @@ fn parse_create_database_ine() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_drop_database() {
|
||||
let sql = "DROP DATABASE mycatalog.mydb";
|
||||
match verified_stmt(sql) {
|
||||
Statement::Drop {
|
||||
names,
|
||||
object_type,
|
||||
if_exists,
|
||||
..
|
||||
} => {
|
||||
assert_eq!(
|
||||
vec!["mycatalog.mydb"],
|
||||
names.iter().map(ToString::to_string).collect::<Vec<_>>()
|
||||
);
|
||||
assert_eq!(ObjectType::Database, object_type);
|
||||
assert!(!if_exists);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_drop_database_if_exists() {
|
||||
let sql = "DROP DATABASE IF EXISTS mydb";
|
||||
match verified_stmt(sql) {
|
||||
Statement::Drop {
|
||||
object_type,
|
||||
if_exists,
|
||||
..
|
||||
} => {
|
||||
assert_eq!(ObjectType::Database, object_type);
|
||||
assert!(if_exists);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_create_view() {
|
||||
let sql = "CREATE VIEW myschema.myview AS SELECT foo FROM bar";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue