MohamedAbdeen21 commented on code in PR #2029:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2029#discussion_r2373574805
##########
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:
Good point. Added a second test with two `USING` clauses. Force-pushed to
resolve conflicts and squashed the commits.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]