MohamedAbdeen21 commented on code in PR #2029: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2029#discussion_r2362384612
########## src/parser/mod.rs: ########## @@ -7061,19 +7061,22 @@ impl<'a> Parser<'a> { pub fn parse_create_index(&mut self, unique: bool) -> Result<Statement, ParserError> { let concurrently = self.parse_keyword(Keyword::CONCURRENTLY); let if_not_exists = self.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); + + let mut using = None; + let index_name = if if_not_exists || !self.parse_keyword(Keyword::ON) { let index_name = self.parse_object_name(false)?; + // MySQL allows `USING index_type` either before or after `ON table_name` + using = self.parse_optional_using_then_index_type()?; self.expect_keyword_is(Keyword::ON)?; Some(index_name) } else { None }; + let table_name = self.parse_object_name(false)?; - let using = if self.parse_keyword(Keyword::USING) { - Some(self.parse_index_type()?) - } else { - None - }; + + using = self.parse_optional_using_then_index_type()?.or(using); Review Comment: As Michael pointed out earlier, MySQL does allow having two "USING" clauses. In that case, the second one overwrites the first. -- 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