ROLLBACK
Aborts the current transaction and discards all uncommitted changes.
Syntax
Section titled “Syntax”ROLLBACKThis command takes no parameters.
Return Value
Section titled “Return Value”Simple string: OK on success.
Behavior
Section titled “Behavior”The command cancels the active FoundationDB transaction bound to the current session and releases all associated resources. After cancellation, the session resets its transaction state: the BEGIN flag is cleared, auto-commit is re-enabled, post-commit hooks are discarded, and the user version counter is reset.
The session returns to its default state and is ready to accept new commands or start a new transaction with BEGIN.
Errors
Section titled “Errors”| Error Code | Description |
|---|---|
TRANSACTION | There is no transaction in progress on the session. |
Examples
Section titled “Examples”Roll back a transaction:
> BEGINOK
> ROLLBACKOKAttempt to roll back without an active transaction:
> ROLLBACK(error) TRANSACTION there is no transaction in progress.