45.9. Transaction Management
In a procedure called from the top level or an anonymous code block (DO
command) called from the top level it is possible to control transactions. To commit the current transaction, call plpy.commit()
. To roll back the current transaction, call plpy.rollback()
. (Note that it is not possible to run the SQL commands COMMIT
or ROLLBACK
via plpy.execute
or similar. It has to be done using these functions.) After a transaction is ended, a new transaction is automatically started, so there is no separate function for that.
Here is an example:
Transactions cannot be ended when an explicit subtransaction is active.
Last updated