instance method
internal_set_config
Ruby on Rails edge
Since edge Private — implementation detail, not part of the public APISignature
internal_set_config(setting, value)
Sets a PostgreSQL session configuration variable. Uses parameter_status to skip redundant SET commands when the server already has the desired value. Pass nil as value to SET TO DEFAULT.
Parameters
-
settingreq -
valuereq
Source
# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 1240
def internal_set_config(setting, value)
unless value.nil?
with_raw_connection(allow_retry: false, materialize_transactions: false) do |conn|
return if (conn.parameter_status(setting) || conn.parameter_status(setting.downcase)) == value.to_s
end
end
quoted_value = value.nil? ? "DEFAULT" : quote(value)
query_command("SET SESSION #{setting} TO #{quoted_value}", "SCHEMA")
end
Defined in activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb line 1240
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::PostgreSQLAdapter