Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ function mixinTransaction(PostgreSQL) {
self.releaseConnection(connection, err);
cb(err);
});
//If we don't set txId to null and wait for the callback
//of ROLLBACK query to execute, another query can be executed in the
//same transaction because the callback will be called asynchronously
if (typeof connection.autorelease === 'function') {
connection.txId = null;
}
};

PostgreSQL.prototype.releaseConnection = function(connection, err) {
Expand Down