Skip to content

Commit 73d7b5b

Browse files
committed
Save a query when starting an isolated txn in Postgres
It's not a common operation, but still, no point running two queries when one will do.
1 parent 0e8f429 commit 73d7b5b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ def begin_db_transaction # :nodoc:
109109
end
110110

111111
def begin_isolated_db_transaction(isolation) # :nodoc:
112-
begin_db_transaction
113-
execute "SET TRANSACTION ISOLATION LEVEL #{transaction_isolation_levels.fetch(isolation)}"
112+
execute("BEGIN ISOLATION LEVEL #{transaction_isolation_levels.fetch(isolation)}", "TRANSACTION")
114113
end
115114

116115
# Commits a transaction.

0 commit comments

Comments
 (0)