Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
7phs committed Sep 30, 2024
1 parent c705e40 commit 85d09b5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
14 changes: 4 additions & 10 deletions src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8193,16 +8193,10 @@ impl<'a> Parser<'a> {
fn parse_view_column(&mut self) -> Result<ViewColumnDef, ParserError> {
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()? {
Expand Down
9 changes: 7 additions & 2 deletions tests/sqlparser_snowflake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 85d09b5

Please sign in to comment.