aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-08-27 23:41:29 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-09-11 20:48:50 -0300
commitf13b278568a1d629dd4d90b16ed87b715c4e689d (patch)
treeb97b8d904a17559b952216296a1d28756e303f63 /activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
parent3d60e9d5503b5f657336a8b7ee6345552ddb6c83 (diff)
downloadrails-f13b278568a1d629dd4d90b16ed87b715c4e689d.tar.gz
rails-f13b278568a1d629dd4d90b16ed87b715c4e689d.tar.bz2
rails-f13b278568a1d629dd4d90b16ed87b715c4e689d.zip
Check if the SQL is not a prepared statement
When the adapter is with prepared statement disabled and the binds array is not empty the connection adapter will try to set the binds values and will fail. Now we are checking if the adapter has the prepared statement disabled. Fixes #12023
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
index 527d13b9b0..86b96a77fb 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
@@ -135,8 +135,8 @@ module ActiveRecord
def exec_query(sql, name = 'SQL', binds = [])
log(sql, name, binds) do
- result = binds.empty? ? exec_no_cache(sql, binds) :
- exec_cache(sql, binds)
+ result = without_prepared_statement?(binds) ? exec_no_cache(sql, binds) :
+ exec_cache(sql, binds)
types = {}
fields = result.fields