aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-01-14 17:38:43 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2014-01-14 17:38:43 -0800
commite0b623a938583f8c02d925d2f812cc32dfed879e (patch)
treedf3b5103bed520d937873077809771b5fe593eaa /activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
parent7d14e03d71861fac7926119dab903c984b89b568 (diff)
downloadrails-e0b623a938583f8c02d925d2f812cc32dfed879e.tar.gz
rails-e0b623a938583f8c02d925d2f812cc32dfed879e.tar.bz2
rails-e0b623a938583f8c02d925d2f812cc32dfed879e.zip
translate exceptions on prepared statement failure
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb6
1 files changed, 5 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 7e188907e1..ebbe918442 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -853,7 +853,11 @@ module ActiveRecord
sql_key = sql_key(sql)
unless @statements.key? sql_key
nextkey = @statements.next_key
- @connection.prepare nextkey, sql
+ begin
+ @connection.prepare nextkey, sql
+ rescue => e
+ raise translate_exception(e, sql)
+ end
# Clear the queue
@connection.get_last_result
@statements[sql_key] = nextkey