mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-07 17:04:59 +00:00
Add DROP TRIGGER
support for SQL Server (#1813)
This commit is contained in:
parent
896c088153
commit
6566c47593
2 changed files with 16 additions and 1 deletions
|
@ -5177,7 +5177,7 @@ impl<'a> Parser<'a> {
|
|||
/// DROP TRIGGER [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ]
|
||||
/// ```
|
||||
pub fn parse_drop_trigger(&mut self) -> Result<Statement, ParserError> {
|
||||
if !dialect_of!(self is PostgreSqlDialect | GenericDialect | MySqlDialect) {
|
||||
if !dialect_of!(self is PostgreSqlDialect | GenericDialect | MySqlDialect | MsSqlDialect) {
|
||||
self.prev_token();
|
||||
return self.expected("an object type after DROP", self.peek_token());
|
||||
}
|
||||
|
|
|
@ -2038,3 +2038,18 @@ fn parse_mssql_merge_with_output() {
|
|||
OUTPUT $action, deleted.ProductID INTO dsi.temp_products";
|
||||
ms_and_generic().verified_stmt(stmt);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_drop_trigger() {
|
||||
let sql_drop_trigger = "DROP TRIGGER emp_stamp;";
|
||||
let drop_stmt = ms().one_statement_parses_to(sql_drop_trigger, "");
|
||||
assert_eq!(
|
||||
drop_stmt,
|
||||
Statement::DropTrigger {
|
||||
if_exists: false,
|
||||
trigger_name: ObjectName::from(vec![Ident::new("emp_stamp")]),
|
||||
table_name: None,
|
||||
option: None,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue