mvzink commented on code in PR #2029:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2029#discussion_r2350269012
##########
src/parser/mod.rs:
##########
@@ -7061,19 +7061,27 @@ 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_using_index_type_clause()?;
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
- };
+
+ if let Some(second_using) = self.parse_using_index_type_clause()? {
+ if using.is_some() {
+ return Err(ParserError::ParserError("USING already
specified".into()));
Review Comment:
Neither was I until I accidentally tried it...
--
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]