New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support ALTER INDEX {INDEX_NAME} RENAME TO {NEW_INDEX_NAME}
#767
Conversation
operation, | ||
}) | ||
} | ||
_ => unreachable!(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How should we handle this unreachable? 🤔
Is there a way to get fit enum of keywords that i only need (TABLE, INDEX)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ok and a consequence of using expect_one_of_keywords
Perhaps a comment
_ => unreachable!(), | |
// unreachable because expect_one_of_keywords used above | |
_ => unreachable!(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @devgony -- this looks good to me.
let if_not_exists = | ||
self.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); | ||
if self.parse_keyword(Keyword::PARTITION) { | ||
let object_type = self.expect_one_of_keywords(&[Keyword::TABLE, Keyword::INDEX])?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewing with https://github.com/sqlparser-rs/sqlparser-rs/pull/767/files?w=1 ignoring whitespace made the changes much easier for me to see
let using = if is_postgresql && self.parse_keyword(Keyword::USING) { | ||
Some(self.parse_expr()?) | ||
Keyword::INDEX => { | ||
let _ = self.parse_keyword(Keyword::ONLY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ignoring the error -- it should be something like
let _ = self.parse_keyword(Keyword::ONLY); | |
self.parse_keyword(Keyword::ONLY)?; |
However, it isn't clear to me why it is trying to parse an ONLY
as part of an alter index statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this is the same in some statements above. I'll clean it up in a follow on PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in #773
operation, | ||
}) | ||
} | ||
_ => unreachable!(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ok and a consequence of using expect_one_of_keywords
Perhaps a comment
_ => unreachable!(), | |
// unreachable because expect_one_of_keywords used above | |
_ => unreachable!(), |
Pull Request Test Coverage Report for Build 3794320019
💛 - Coveralls |
Thanks again @devgony |
Goal
To resolve #714, this PR starts with
ALTER INDEX .. RENAME ..
to implemet ALTER INDEX baseTodo
Parser.expected