mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Use the schema_search_path in prepared statements.
To allow the use of prepared statements when changing schemas in postgres, the schema search path is added to the sql key.
This commit is contained in:
@@ -1035,13 +1035,14 @@ module ActiveRecord
|
||||
end
|
||||
|
||||
def exec_cache(sql, binds)
|
||||
unless @statements.key? sql
|
||||
sql_key = "#{schema_search_path}-#{sql}"
|
||||
unless @statements.key? sql_key
|
||||
nextkey = @statements.next_key
|
||||
@connection.prepare nextkey, sql
|
||||
@statements[sql] = nextkey
|
||||
@statements[sql_key] = nextkey
|
||||
end
|
||||
|
||||
key = @statements[sql]
|
||||
key = @statements[sql_key]
|
||||
|
||||
# Clear the queue
|
||||
@connection.get_last_result
|
||||
|
||||
Reference in New Issue
Block a user