invm commented on code in PR #1734:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1734#discussion_r1966463262


##########
src/parser/mod.rs:
##########
@@ -5061,20 +5066,19 @@ impl<'a> Parser<'a> {
     }
 
     pub fn parse_trigger_period(&mut self) -> Result<TriggerPeriod, 
ParserError> {
-        Ok(
-            match self.expect_one_of_keywords(&[
-                Keyword::BEFORE,
-                Keyword::AFTER,
-                Keyword::INSTEAD,
-            ])? {
-                Keyword::BEFORE => TriggerPeriod::Before,
-                Keyword::AFTER => TriggerPeriod::After,
-                Keyword::INSTEAD => self
-                    .expect_keyword_is(Keyword::OF)
-                    .map(|_| TriggerPeriod::InsteadOf)?,
-                _ => unreachable!(),
-            },
-        )
+        let allowed_keywords = if dialect_of!(self is MySqlDialect) {
+            vec![Keyword::BEFORE, Keyword::AFTER]
+        } else {
+            vec![Keyword::BEFORE, Keyword::AFTER, Keyword::INSTEAD]
+        };

Review Comment:
   I understand what you mean, I reverted this part to the original 
implementation, just be aware that this parser will pass an invalid drop 
trigger statement for mysql, also remove this test:
   ```rust
   let sql_drop_trigger_invalid = "DROP TRIGGER emp_stamp on emp;";
   assert!(mysql()
       .parse_sql_statements(sql_drop_trigger_invalid)
       .is_err());
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to