aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-10-06 20:08:05 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-10-06 20:08:05 -0700
commit3088d23647899212f20bb8969f2084393a9e71cd (patch)
tree83c5891254dcdd0f8b9a963a345fda975c5c7f8e /activerecord/lib
parent99888487b63b313ea4495edd24b666fc5a3c8fe0 (diff)
parentac659b8ed3d3a12f9cce67bf0eeacb4c231c2c08 (diff)
downloadrails-3088d23647899212f20bb8969f2084393a9e71cd.tar.gz
rails-3088d23647899212f20bb8969f2084393a9e71cd.tar.bz2
rails-3088d23647899212f20bb8969f2084393a9e71cd.zip
Merge pull request #3232 from Juanmcuello/pg_prepared_statements
Use the schema_search_path in prepared statements.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index 5402918b1d..d859843260 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -1035,13 +1035,14 @@ module ActiveRecord
end
def exec_cache(sql, binds)
- unless @statements.key? sql
+ sql_key = "#{schema_search_path}-#{sql}"
+ unless @statements.key? sql_key
nextkey = @statements.next_key
@connection.prepare nextkey, sql
- @statements[sql] = nextkey
+ @statements[sql_key] = nextkey
end
- key = @statements[sql]
+ key = @statements[sql_key]
# Clear the queue
@connection.get_last_result