aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-10-18 11:12:18 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-10-18 11:20:13 -0700
commit6a28c512e358a95bbabd24af9d2b0608df787158 (patch)
treeb48f932e57c615bb1b25ef68ccbe5a1fa67a6e5c /activerecord/test
parentd44702c830669e2647c073133bd6b09d7016424d (diff)
downloadrails-6a28c512e358a95bbabd24af9d2b0608df787158.tar.gz
rails-6a28c512e358a95bbabd24af9d2b0608df787158.tar.bz2
rails-6a28c512e358a95bbabd24af9d2b0608df787158.zip
reset prepared statement when schema changes imapact statement results. fixes #3335
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/adapters/postgresql/schema_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/schema_test.rb b/activerecord/test/cases/adapters/postgresql/schema_test.rb
index b01eabc840..c8f8714f66 100644
--- a/activerecord/test/cases/adapters/postgresql/schema_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/schema_test.rb
@@ -62,6 +62,14 @@ class SchemaTest < ActiveRecord::TestCase
@connection.execute "DROP SCHEMA #{SCHEMA_NAME} CASCADE"
end
+ def test_schema_change_with_prepared_stmt
+ @connection.exec_query "select * from developers where id = $1", 'sql', [[nil, 1]]
+ @connection.exec_query "alter table developers add column zomg int", 'sql', []
+ @connection.exec_query "select * from developers where id = $1", 'sql', [[nil, 1]]
+ ensure
+ @connection.exec_query "alter table developers drop column if exists zomg", 'sql', []
+ end
+
def test_table_exists?
[Thing1, Thing2, Thing3, Thing4].each do |klass|
name = klass.table_name