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

Add support for release and rollback to savepoint syntax #1045

Merged
merged 3 commits into from
Nov 21, 2023

Conversation

CDThomas
Copy link
Contributor

@CDThomas CDThomas commented Nov 9, 2023

This PR adds support for:

  • RELEASE SAVEPOINT savepoint_name statements
  • TO SAVEPOINT savepoint_name in ROLLBACK statements.

Note that support for SAVEPOINT savepoint_name statements was already added in #438, so I didn't need to include that here.

Both ROLLBACK ... TO SAVEPOINT savepoint_name and RELEASE SAVEPOINT savepoint_name are part of the SQL grammar (see here and here). At least Postgres (see here and here), SQLite (see here), and MySQL (see here) support savepoints.

The SAVEPOINT keyword is optional when used in ROLLBACK and RELEASE statements in Postgres and SQLite; required in both statements in the SQL grammar; and optional in ROLLBACK, but required in RELEASE in MySQL. This PR makes the SAVEPOINT keyword optional while parsing, but includes it in the canonical format used when printing since all dialects that I've checked so far at least allow for including it.

@coveralls
Copy link

coveralls commented Nov 20, 2023

Pull Request Test Coverage Report for Build 6935596781

  • 37 of 37 (100.0%) changed or added relevant lines in 3 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.02%) to 87.707%

Files with Coverage Reduction New Missed Lines %
src/ast/mod.rs 1 79.01%
Totals Coverage Status
Change from base Build 6935126371: 0.02%
Covered Lines: 17894
Relevant Lines: 20402

💛 - Coveralls

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.

Looks great to me -- thank you @CDThomas and @tobyhede

@alamb
Copy link
Contributor

alamb commented Nov 20, 2023

I believe the docs CI test failure is real: https://github.com/sqlparser-rs/sqlparser-rs/actions/runs/6818722260/job/18864307303?pr=1045

The lint failure should be resolved with a merge up from main

The brackets here need to be escaped so that rustdoc doesn't try to
treat them as an intra doc link.
@CDThomas
Copy link
Contributor Author

Thank you @alamb and @tobyhede. I've merged in main and fixed up the CI issues.

@alamb
Copy link
Contributor

alamb commented Nov 21, 2023

Thanks again @CDThomas

@alamb alamb merged commit 5bdf2e6 into apache:main Nov 21, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants