New answers tagged transaction
--single-transaction is used to ensure the dump is consistent when dumping, it has nothing to do with import/restore. Loading a dump is not generally possible in a single transaction because many CREATE statements do an implicit commit. It is often not even desirable because for a rollback to be possible, the transaction needs to keep undo logs and if you ...
If this is a job consisting of a Transact-SQL step, you can specify a SET TRANSACTION ISOLATION LEVEL statement at the beginning of your Transact-SQL script: SET TRANSACTION ISOLATION LEVEL SNAPSHOT; … /* the rest of your script */
PostgreSQL does not support sub-transactions, but the SAVEPOINT feature can effectively answer your need. Quoting from the documentation for Advanced access layer to PG via promises by Vitaly Tomilov on GitHub: PostgreSQL doesn't have proper support for nested transactions, it only supports partial rollbacks via savepoints inside transactions. The ...
Is it really possible for the transaction count to be < 1 in this code snippet? The table might have a DELETE trigger that rolls back the transaction and throws an error.
Its a defensive programming practice to only do an action (rollback) if it's possible to do.
The Question mentions that the "code is failing" but there is no indication of any error message or what specifically is failing. Including at least one, if not both, of those pieces of information always helps get better answers. For the moment, I see something that appears to be an incorrect assumption about Triggers and Transactions: you increment the ...
A trigger is already always operating within an implicit transaction, see the related question: Is there a way to ensure that a SQL Server trigger will be executed? You can catch an error and prevent an abort/rollback, but you cannot "commit" the transaction from within the trigger.
Top 50 recent answers are included