Skip to content

Commit aecca3d

Browse files
Pass along with_raw_connection params in PG adapter
Prior to this commit we were passing `allow_retry` and `materialize_transactions` through from `execute_and_clear` to `exec_cache`/`exec_no_cache`, but then doing nothing with them. We've got a few internal queries using `execute_and_clear` (mostly via `internal_exec_query`) that are passing `allow_retry: true` and `materialize_transactions: false`. These calls will fail on connection errors that might have been retryable. It's also possible they are materializing transactions earlier than expected (although probably not—most of the methods look like they would be called only by us, always outside a transaction). This commit forwards the arguments through to `with_raw_connection` so the callers get the behavior they likely expect.
1 parent e3deb75 commit aecca3d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ def exec_no_cache(sql, name, binds, async:, allow_retry:, materialize_transactio
892892

893893
type_casted_binds = type_casted_binds(binds)
894894
log(sql, name, binds, type_casted_binds, async: async) do
895-
with_raw_connection do |conn|
895+
with_raw_connection(allow_retry: false, materialize_transactions: materialize_transactions) do |conn|
896896
result = conn.exec_params(sql, type_casted_binds)
897897
verified!
898898
result
@@ -905,7 +905,7 @@ def exec_cache(sql, name, binds, async:, allow_retry:, materialize_transactions:
905905

906906
update_typemap_for_default_timezone
907907

908-
with_raw_connection do |conn|
908+
with_raw_connection(allow_retry: false, materialize_transactions: materialize_transactions) do |conn|
909909
stmt_key = prepare_statement(sql, binds, conn)
910910
type_casted_binds = type_casted_binds(binds)
911911

0 commit comments

Comments
 (0)