Skip to content

Commit 06c6b35

Browse files
committed
Use existing loop to handle unordered parameters
1 parent 8e65a53 commit 06c6b35

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/dialect/snowflake.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -401,11 +401,6 @@ pub fn parse_create_table(
401401
let if_not_exists = parser.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]);
402402
let table_name = parser.parse_object_name(false)?;
403403

404-
// Snowflake allows `IF NOT EXIST` both before and after the table name so if we haven't
405-
// already seen that before the table name, try to parse it again.
406-
let if_not_exists =
407-
if_not_exists || parser.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]);
408-
409404
let mut builder = CreateTableBuilder::new(table_name)
410405
.or_replace(or_replace)
411406
.if_not_exists(if_not_exists)
@@ -565,6 +560,9 @@ pub fn parse_create_table(
565560
builder.storage_serialization_policy =
566561
Some(parse_storage_serialization_policy(parser)?);
567562
}
563+
Keyword::IF if parser.parse_keywords(&[Keyword::NOT, Keyword::EXISTS]) => {
564+
builder = builder.if_not_exists(true);
565+
}
568566
_ => {
569567
return parser.expected("end of statement", next_token);
570568
}

0 commit comments

Comments
 (0)