-
Notifications
You must be signed in to change notification settings - Fork 561
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
VACUUM
command for PostgreSQL
#1002
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.
Thank you for the contribution @mdashti -- I have a few requests prior to this being ready to merge
@@ -1832,6 +1833,11 @@ pub enum Statement { | |||
name: ObjectName, | |||
representation: UserDefinedTypeRepresentation, | |||
}, | |||
|
|||
Vacuum { |
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.
Can you please add a documentation string here and a link to the reference documentation? https://www.postgresql.org/docs/current/sql-vacuum.html
@@ -1832,6 +1833,11 @@ pub enum Statement { | |||
name: ObjectName, | |||
representation: UserDefinedTypeRepresentation, | |||
}, | |||
|
|||
Vacuum { | |||
options: Vec<(Keyword, Option<String>)>, |
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.
The pattern with the rest of the structs in this crate is to do the parsing into fields (so that downstream crates don't have to re-implement the string matching for different keywords)
So in this case this would mean something like the following
struct VacuumOptions {
full: Option<bool>,
freeze: Option<bool>,
...
}
@@ -34,6 +34,8 @@ impl Dialect for PostgreSqlDialect { | |||
fn parse_statement(&self, parser: &mut Parser) -> Option<Result<Statement, ParserError>> { | |||
if parser.parse_keyword(Keyword::COMMENT) { | |||
Some(parse_comment(parser)) | |||
} else if parser.parse_keyword(Keyword::VACUUM) { |
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.
Can you please also add Vacuum to the "GenericDialect" which is the superset of all the other dialects, when there is no conflict.
Also, I think it would be better to put the parsing code into parser.rs
rather than here so it is easier to find (though I realize you are following the model of parse_comment
Marking as draft as this is no longer waiting on comments |
Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days. |
This PR adds the
VACUUM
command parsing to cover PostgreSQL syntax. The implementation follows the PostgreSQL documentation: https://www.postgresql.org/docs/current/sql-vacuum.html