Skip to content

docs: Say that a rolled-back savepoint stays established - #959

Open
yeegz wants to merge 2 commits into
serverpod:mainfrom
yeegz:docs/release-savepoint-after-rollback
Open

yeegz wants to merge 2 commits into
serverpod:mainfrom
yeegz:docs/release-savepoint-after-rollback

Conversation

@yeegz

@yeegz yeegz commented Nov 30, 2026

Copy link
Copy Markdown

ROLLBACK TO SAVEPOINT undoes the work after a savepoint but keeps the savepoint established, and only RELEASE SAVEPOINT ends it (PostgreSQL docs). The Transactions page didn't say this, so code that catches an error and rolls back leaves a savepoint open until the transaction ends.

This adds a short paragraph and an example under "Rolling back to savepoints" that release the savepoint after rolling back. The wording matches the Savepoint.rollback() dartdoc added in serverpod/serverpod#6019, which the reviewer asked to have documented here.

Only docs/ is changed, not the versioned docs. markdownlint passes on the page; I didn't run the full Docusaurus build.

🤖 Generated with Claude Code

ROLLBACK TO SAVEPOINT keeps the savepoint, so it should be released once
it is no longer needed. Matches the Savepoint.rollback() dartdoc added in
serverpod/serverpod#6019.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

In the example, we create a savepoint after inserting a company. We then insert an employee but invoke a rollback to our savepoint. This results in the database preserving the company but not the employee insertion.

The savepoint stays established after a rollback, so you can roll back to it again. Call `release` once you no longer need it. Otherwise, it keeps a nesting level open until the transaction ends. When you catch an error and roll back, release the savepoint afterwards:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: "keeps a nesting level open" is database jargon most readers won't know. This says the same in plain words:

Suggested change
The savepoint stays established after a rollback, so you can roll back to it again. Call `release` once you no longer need it. Otherwise, it keeps a nesting level open until the transaction ends. When you catch an error and roll back, release the savepoint afterwards:
The savepoint stays established after a rollback, so you can roll back to it again. Call `release` once you no longer need it, or it stays open until the transaction ends. When you catch an error and roll back, release the savepoint afterwards:

@developerjamiu

Copy link
Copy Markdown
Contributor

Suggestion: The same behavior ships in 4.0.0 and 4.1.x, and the savepoint sections in versioned_docs/version-4.0.0 and versioned_docs/version-4.1.0 match docs/. Could you add the paragraph and example to both, so readers on the current version see it too?

This branch has not been deployed

No deployments
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.

2 participants