From 02128d628c4084eccd93c41db40f4d83db17f53c Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 21 Oct 2010 11:27:28 -0700 Subject: setting the authorized session clears the statement cache --- .../cases/adapters/postgresql/schema_authorization_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'activerecord/test/cases') diff --git a/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb b/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb index dc4f8fb955..881631fb19 100644 --- a/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb +++ b/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb @@ -50,6 +50,17 @@ class SchemaAuthorizationTest < ActiveRecord::TestCase end end + def test_setting_auth_clears_stmt_cache + assert_nothing_raised do + set_session_auth + USERS.each do |u| + set_session_auth u + assert_equal u, @connection.exec("SELECT name FROM #{TABLE_NAME} WHERE id = $1", 'SQL', [[nil, 1]]).first['name'] + set_session_auth + end + end + end + def test_auth_with_bind assert_nothing_raised do set_session_auth -- cgit v1.2.3