-
Notifications
You must be signed in to change notification settings - Fork 612
Add create index and drop index support #167
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
Conversation
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.
Thanks for the PR, and sorry it took me so long to get back to you!
I see from the tests this supports CREATE UNIQUE INDEX IF NOT EXISTS idx_name ON test(name)
and DROP INDEX idx_name
. This agrees with Postgres' syntax and has an intersection with MSSQL's syntax, which is good.
However the code in parse_index_column()
is more complex than what's required to support the above, and I don't understand what specifically it tries to implement. A simple self.parse_comma_separated(Parser::parse_identifier)?
should be able to parse the above example. self.parse_comma_separated(Parser::parse_order_by_expr)
seems like it would support all but the most exotic syntax.
Did you intend to support trailing comma? (let's make it explicit if so, and I would prefer introducing a helper akin to parse_comma_separated
instead of duplicating code from parse_columns
)
Why do you parse an individual item of an index definition as a sequence of identifiers, delimited by whitespace only, and store it as an ObjectName
(which represents a dot-delimited name like foo.bar.baz
)? This seems wrong and wouldn't round-trip when serialized back to string...
A few minor quibbles below, which I would've fixed myself if it weren't for the above questions.
@nickolay Thanks for the comment. And yes I should use |
Alright, supporting In this case, there's no reason to have |
f0052fc
to
5aacc5e
Compare
Hi @nickolay, thanks for the advice, I have moved |
Excellent, thanks so much for bearing with me and for taking it to the finish line! I just realized this can now use |
This PR adds support for: