RELEASE SAVEPOINT cockroach_restart

On this page Carat arrow pointing down
Warning:
As of April 30, 2020, CockroachDB v2.1 is no longer supported. For more details, refer to the Release Support Policy.

When using client-side transaction retries, the RELEASE SAVEPOINT cockroach_restart statement commits the transaction.

If statements in the transaction generated any non-retryable errors, RELEASE SAVEPOINT cockroach_restart is equivalent to ROLLBACK, which aborts the transaction and discards all updates made by its statements.

Despite committing the transaction, you must still issue a COMMIT statement to prepare the connection for the next transaction.

Warning:
CockroachDB’s SAVEPOINT implementation only supports the cockroach_restart savepoint and does not support all savepoint functionality, such as nested transactions.

Synopsis

RELEASE SAVEPOINT name

Required privileges

No privileges are required to release a savepoint. However, privileges are required for each statement within a transaction.

Examples

Commit a Transaction

After declaring SAVEPOINT cockroach_restart, commit the transaction with RELEASE SAVEPOINT cockroach_restart and then prepare the connection for the next transaction with COMMIT.

icon/buttons/copy
> BEGIN;

> SAVEPOINT cockroach_restart;

> UPDATE products SET inventory = 0 WHERE sku = '8675309';

> INSERT INTO orders (customer, sku, status) VALUES (1001, '8675309', 'new');

> RELEASE SAVEPOINT cockroach_restart;

> COMMIT;
Warning:
This example assumes you're using client-side intervention to handle transaction retries.

See also


Yes No
On this page

Yes No