Skip to main content

Module tx

Module tx 

Source
Expand description

The rules of an interactive transaction, as a pure state machine: what an open or failed transaction admits, where it stands afterwards, and which savepoints it holds. Whatever holds the connection applies them.

Enums§

Next
Where the slot goes after an operation.
Outcome
How an operation that ran came back: fine, refused before reaching the server (the transaction is untouched), or failed on the server (which aborts the transaction).
Phase
Where an open transaction stands. After a statement error Postgres has aborted the transaction and only a rollback (to a savepoint or whole) is accepted.
SavepointOp
SlotOp

Functions§

admit
Whether op may run in phase; a failed transaction answers every statement, savepoint and release with the error Postgres would give.
budget_of
The route budget the native test host stands for: the one whose platform timeout at the start is statement_timeout.
effective_statement_timeout
What a statement runs under: the platform’s timeout, or the guest’s where it is shorter. A guest’s value below the platform’s floor stands, since the floor only keeps a nearly spent budget usable.
guest_statement_timeout
A guest’s own statement_timeout in milliseconds, as StatementTimeout carries it. Zero, which Postgres reads as no timeout, and anything past the invocation’s whole budget are refused.
in_failed_transaction
What a failed transaction answers until it is rolled back.
invalid_savepoint
isolation_sql
next
The slot’s phase after an admitted op ran with outcome. Commit and rollback end the transaction whatever happened; a server error inside it aborts it; a successful rollback to a savepoint recovers it.
parameters_outside_transaction
Parameters on a statement that cannot be prepared inside a transaction.
rolled_back_by_commit
A COMMIT of a failed transaction, which the server answers by rolling it back.
savepoint_sql
The SQL for a savepoint operation, when the name it refers to exists: RELEASE and ROLLBACK TO an unknown savepoint would abort the whole transaction on the server, so they are refused first.
savepoints_after
The savepoint stack after a successful operation: RELEASE drops the savepoint and every later one, ROLLBACK TO keeps it and drops the later ones.
statement_timeout_for
The platform’s statement_timeout with remaining of the invocation left: half a second short of the deadline, and never under a second, so a nearly spent budget can still run a statement.
transaction_control_refused
Transaction control inside a statement, which the host owns.
transaction_limit
transaction_not_found
unknown_savepoint
valid_savepoint
Savepoint names are interpolated into SQL, so only the SDK’s own sp_{depth} shape is accepted.