Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Conversation

mdashti
Copy link

@mdashti mdashti commented Oct 13, 2023

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

Copy link
Contributor

@alamb alamb left a 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 {
Copy link
Contributor

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>)>,
Copy link
Contributor

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) {
Copy link
Contributor

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

@alamb alamb marked this pull request as draft October 23, 2023 22:10
@alamb
Copy link
Contributor

alamb commented Oct 23, 2023

Marking as draft as this is no longer waiting on comments

Copy link

github-actions bot commented Jul 9, 2024

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.

@github-actions github-actions bot added the Stale label Jul 9, 2024
@alamb alamb closed this Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants