diff --git a/src/parser/mod.rs b/src/parser/mod.rs index d623e882d..01e516593 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -8193,16 +8193,10 @@ impl<'a> Parser<'a> { fn parse_view_column(&mut self) -> Result { let name = self.parse_identifier(false)?; let mut options = vec![]; - if dialect_of!(self is BigQueryDialect | GenericDialect) - && self.parse_keyword(Keyword::OPTIONS) - { - self.prev_token(); - if let Some(option) = self.parse_optional_column_option()? { - options.push(option); - } - }; - if dialect_of!(self is SnowflakeDialect | GenericDialect) - && self.parse_keyword(Keyword::COMMENT) + if (dialect_of!(self is BigQueryDialect | GenericDialect) + && self.parse_keyword(Keyword::OPTIONS)) + || (dialect_of!(self is SnowflakeDialect | GenericDialect) + && self.parse_keyword(Keyword::COMMENT)) { self.prev_token(); if let Some(option) = self.parse_optional_column_option()? { diff --git a/tests/sqlparser_snowflake.rs b/tests/sqlparser_snowflake.rs index 5b33fd80b..2cf0aee69 100644 --- a/tests/sqlparser_snowflake.rs +++ b/tests/sqlparser_snowflake.rs @@ -2403,8 +2403,13 @@ fn parse_use() { #[test] fn view_comment_option_should_be_after_column_list() { - snowflake_and_generic() - .verified_stmt("CREATE OR REPLACE VIEW v (a) COMMENT = 'Comment' AS SELECT a FROM t"); + for sql in [ + "CREATE OR REPLACE VIEW v (a) COMMENT = 'Comment' AS SELECT a FROM t", + "CREATE OR REPLACE VIEW v (a COMMENT 'a comment', b, c COMMENT 'c comment') COMMENT = 'Comment' AS SELECT a FROM t", + ] { + snowflake_and_generic() + .verified_stmt(sql); + } } #[test]