Skip to content

Commit f961ec4

Browse files
committed
Merge pull request rails#5437 from kennyj/fix_5430
Fix GH rails#5430. A Payload name for schema_search_path should be SCHEMA.
2 parents 8f5f92c + 2d787f8 commit f961ec4

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ def drop_schema schema_name
10061006
# This should be not be called manually but set in database.yml.
10071007
def schema_search_path=(schema_csv)
10081008
if schema_csv
1009-
execute "SET search_path TO #{schema_csv}"
1009+
execute("SET search_path TO #{schema_csv}", 'SCHEMA')
10101010
@schema_search_path = schema_csv
10111011
end
10121012
end

activerecord/test/cases/adapters/postgresql/explain_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ def test_explain_with_eager_loading
2222
assert_match %(EXPLAIN for: SELECT "audit_logs".* FROM "audit_logs" WHERE "audit_logs"."developer_id" IN (1)), explain
2323
assert_match %(Seq Scan on audit_logs), explain
2424
end
25+
26+
def test_dont_explain_for_set_search_path
27+
queries = Thread.current[:available_queries_for_explain] = []
28+
ActiveRecord::Base.connection.schema_search_path = "public"
29+
assert queries.empty?
30+
end
31+
2532
end
2633
end
2734
end

0 commit comments

Comments
 (0)