Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7824,6 +7824,7 @@ pub enum ObjectType {
Stage,
Type,
User,
Stream,
}

impl fmt::Display for ObjectType {
Expand All @@ -7840,6 +7841,7 @@ impl fmt::Display for ObjectType {
ObjectType::Stage => "STAGE",
ObjectType::Type => "TYPE",
ObjectType::User => "USER",
ObjectType::Stream => "STREAM",
})
}
}
Expand Down
1 change: 1 addition & 0 deletions src/keywords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,7 @@ define_keywords!(
STORAGE_SERIALIZATION_POLICY,
STORED,
STRAIGHT_JOIN,
STREAM,
STRICT,
STRING,
STRUCT,
Expand Down
2 changes: 2 additions & 0 deletions src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6325,6 +6325,8 @@ impl<'a> Parser<'a> {
ObjectType::Type
} else if self.parse_keyword(Keyword::USER) {
ObjectType::User
} else if self.parse_keyword(Keyword::STREAM) {
ObjectType::Stream
} else if self.parse_keyword(Keyword::FUNCTION) {
return self.parse_drop_function();
} else if self.parse_keyword(Keyword::POLICY) {
Expand Down
18 changes: 18 additions & 0 deletions tests/sqlparser_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16357,3 +16357,21 @@ fn parse_create_user() {
_ => unreachable!(),
}
}

#[test]
fn parse_drop_stream() {
let sql = "DROP STREAM s1";
match verified_stmt(sql) {
Statement::Drop {
names, object_type, ..
} => {
assert_eq!(
vec!["s1"],
names.iter().map(ToString::to_string).collect::<Vec<_>>()
);
assert_eq!(ObjectType::Stream, object_type);
}
_ => unreachable!(),
}
verified_stmt("DROP STREAM IF EXISTS s1");
}
Loading