Add support for release and rollback to savepoint syntax #1045
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for:
RELEASE SAVEPOINT savepoint_name
statementsTO SAVEPOINT savepoint_name
inROLLBACK
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
andRELEASE 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 inROLLBACK
andRELEASE
statements in Postgres and SQLite; required in both statements in the SQL grammar; and optional inROLLBACK
, but required inRELEASE
in MySQL. This PR makes theSAVEPOINT
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.