aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2014-03-08 01:14:26 +1030
committerMatthew Draper <matthew@trebex.net>2014-03-18 10:31:31 +1030
commitcc0d54bcc09a8ab834041787df69f6795a468b91 (patch)
treeb032e3fe551dabafed50b080cce9c3beb5eb9cbf /activerecord/lib/active_record/connection_adapters
parent4a69c933cf07ee296a4ae1e2612c31922019eeab (diff)
downloadrails-cc0d54bcc09a8ab834041787df69f6795a468b91.tar.gz
rails-cc0d54bcc09a8ab834041787df69f6795a468b91.tar.bz2
rails-cc0d54bcc09a8ab834041787df69f6795a468b91.zip
Teach PostgreSQLAdapter#reset! to actually reset
It wasn't doing anything beyond clearing the statement cache.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index e5f7913c70..49d1a20659 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -616,7 +616,12 @@ module ActiveRecord
def reset!
clear_cache!
- super
+ reset_transaction
+ unless @connection.transaction_status == ::PG::PQTRANS_IDLE
+ @connection.query 'ROLLBACK'
+ end
+ @connection.query 'DISCARD ALL'
+ configure_connection
end
# Disconnects from the database if already connected. Otherwise, this