SHOW SAVEPOINT STATUS statement lists the active savepoints in the current transaction.
No privileges are required to create or show a savepoint. However, privileges are required for each statement within a transaction.
The following fields are returned for each savepoint.
||The name of the savepoint.|
||Whether the savepoint is the outermost savepoint in the transaction.|
Open a transaction using
BEGIN, and create a nested transaction using a savepoint:
> BEGIN; SAVEPOINT foo;
SHOW SAVEPOINT STATUSstatement to list the active savepoints in the current nested transaction.
> SHOW SAVEPOINT STATUS;
savepoint_name | is_initial_savepoint -----------------+----------------------- foo | true (1 row)
Currently, there is only one savepoint.
Commit this nested transaction by issuing the
RELEASE SAVEPOINTstatement, then clear the connection for the next transaction by issuing a
> RELEASE SAVEPOINT foo; COMMIT;
If we did not want to commit this nested transaction, but restart it instead, we would have issued a
ROLLBACK TO SAVEPOINT.