Skip to content

Commit c24b09b

Browse files
committed
Postgres, fix reset! method, several test were failing due this issue
1 parent 7cd1c60 commit c24b09b

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lib/arjdbc/postgresql/adapter.rb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -481,11 +481,16 @@ def write_query?(sql) # :nodoc:
481481
# end
482482

483483
def reset!
484-
clear_cache!
485-
reset_transaction
486-
@connection.rollback # Have to deal with rollbacks differently than the AR adapter
487-
@connection.execute 'DISCARD ALL'
488-
@connection.configure_connection
484+
@lock.synchronize do
485+
return connect! unless @raw_connection
486+
487+
# Have to deal with rollbacks differently than the AR adapter
488+
@raw_connection.rollback
489+
490+
@raw_connection.execute("DISCARD ALL")
491+
492+
super
493+
end
489494
end
490495

491496
def default_sequence_name(table_name, pk = "id") #:nodoc:

0 commit comments

Comments
 (0)