On-commit functions only work with autocommit modeĪnd the atomic() (or ATOMIC_REQUESTS) transaction API. When in autocommit mode and outside of an atomic() block, the function Implicit transaction, preventing the connection from going back into autocommit The commit (because otherwise any queries done in a callback would open an Two-phase commit such as the psycopg Two-Phase Commit protocol support and the optional Two-Phase Commit ExtensionsĬallbacks are not run until autocommit is restored on the connection following Then you don’t want to use the on_commit() hook. If it’s not (if your follow-up action is soĬritical that its failure should mean the failure of the transaction itself), For the intended use cases (mail notifications, background They are executedĬonditionally upon the success of the transaction, but they are not part of Your callbacks are executed after a successful commit, so a failure in aĬallback will not cause the transaction to roll back. Savepoints, even for the outermost block. You may use atomic when autocommit is turned off. The overhead of savepoints is noticeable. If there is one, and the outermost block otherwise. Perform the rollback when exiting the first parent block with a savepoint You can disable the creation of savepoints for inner blocks by setting the
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |