Skip to content
Browse files

ACTIVERECORD_JDBC-91: Fix schema search path (Alex Kuebo)

  • Loading branch information...
1 parent def7433 commit 912c6c5641e3f4a5ac96fe44df12f2a40a3f3534 @nicksieger committed Feb 8, 2010
Showing with 9 additions and 2 deletions.
  1. +5 −0 History.txt
  2. +4 −2 lib/jdbc_adapter/jdbc_postgre.rb
View
5 History.txt
@@ -1,3 +1,8 @@
+== 0.9.3
+
+- ACTIVERECORD_JDBC-91: Fix schema search path for PostgreSQL (Alex
+ Kuebo)
+
== 0.9.2
- The main, highly awaited fix for this release is a solution to the
View
6 lib/jdbc_adapter/jdbc_postgre.rb
@@ -13,7 +13,9 @@ def postgresql_connection(config)
config[:url] ||= "jdbc:postgresql://#{config[:host]}:#{config[:port]}/#{config[:database]}"
config[:url] << config[:pg_params] if config[:pg_params]
config[:driver] ||= "org.postgresql.Driver"
- jdbc_connection(config)
+ conn = jdbc_connection(config)
+ conn.execute("SET SEARCH_PATH TO #{config[:schema_search_path]}") if config[:schema_search_path]
+ conn
end
end
@@ -261,7 +263,7 @@ def insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)
end
def columns(table_name, name=nil)
- schema_name = nil
+ schema_name = @config[:schema_search_path]
if table_name =~ /\./
parts = table_name.split(/\./)
table_name = parts.pop

0 comments on commit 912c6c5

Please sign in to comment.
Something went wrong with that request. Please try again.