Permalink
Browse files

refs #3232. Prepared statements and postgreSQL schemas.

Add tests for prepared statements with multiple schemas in
postgreSQL.
  • Loading branch information...
1 parent cfc95d8 commit ac659b8ed3d3a12f9cce67bf0eeacb4c231c2c08 @Juanmcuello committed Oct 5, 2011
Showing with 19 additions and 0 deletions.
  1. +19 −0 activerecord/test/cases/adapters/postgresql/schema_test.rb
View
19 activerecord/test/cases/adapters/postgresql/schema_test.rb
@@ -38,6 +38,10 @@ class Thing4 < ActiveRecord::Base
set_table_name 'test_schema."Things"'
end
+ class Thing5 < ActiveRecord::Base
+ set_table_name 'things'
+ end
+
def setup
@connection = ActiveRecord::Base.connection
@connection.execute "CREATE SCHEMA #{SCHEMA_NAME} CREATE TABLE #{TABLE_NAME} (#{COLUMNS.join(',')})"
@@ -236,6 +240,21 @@ def test_current_schema
end
end
+ def test_prepared_statements_with_multiple_schemas
+
+ @connection.schema_search_path = SCHEMA_NAME
+ Thing5.create(:id => 1, :name => "thing inside #{SCHEMA_NAME}", :email => "thing1@localhost", :moment => Time.now)
+
+ @connection.schema_search_path = SCHEMA2_NAME
+ Thing5.create(:id => 1, :name => "thing inside #{SCHEMA2_NAME}", :email => "thing1@localhost", :moment => Time.now)
+
+ @connection.schema_search_path = SCHEMA_NAME
+ assert_equal 1, Thing5.count
+
+ @connection.schema_search_path = SCHEMA2_NAME
+ assert_equal 1, Thing5.count
+ end
+
def test_schema_exists?
{
'public' => true,

0 comments on commit ac659b8

Please sign in to comment.