Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ayman-sigma committed Nov 24, 2024
1 parent c603785 commit 6a26aa4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8384,9 +8384,9 @@ impl<'a> Parser<'a> {
loop {
if self.dialect.supports_object_name_double_dot_notation()
&& idents.len() == 1
&& self.peek_token() == Token::Period
&& self.consume_token(&Token::Period)
{
self.next_token();
// Empty string here means default schema
idents.push(Ident::new(""));
}
idents.push(self.parse_identifier(in_table_clause)?);
Expand Down
17 changes: 10 additions & 7 deletions tests/sqlparser_snowflake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2869,21 +2869,21 @@ fn test_projection_with_nested_trailing_commas() {
fn test_sf_double_dot_notation() {
snowflake().verified_stmt("SELECT * FROM db_name..table_name");
snowflake().verified_stmt("SELECT * FROM x, y..z JOIN a..b AS b ON x.id = b.id");
}

#[test]
fn test_sf_double_dot_notation_wrong_position() {}

#[test]
fn test_parse_double_dot_notation_wrong_position() {
assert_eq!(
snowflake()
.parse_sql_statements("SELECT * FROM X.Y..")
.unwrap_err()
.to_string(),
"sql parser error: Expected: identifier, found: ."
);

assert_eq!(
snowflake()
.parse_sql_statements("SELECT * FROM X..Y..Z")
.unwrap_err()
.to_string(),
"sql parser error: Expected: identifier, found: ."
);
assert_eq!(
// Ensure we don't parse leading token
snowflake()
Expand All @@ -2893,3 +2893,6 @@ fn test_parse_double_dot_notation_wrong_position() {
"sql parser error: Expected: identifier, found: ."
);
}

#[test]
fn test_parse_double_dot_notation_wrong_position() {}

0 comments on commit 6a26aa4

Please sign in to comment.