Methods
Instance Public methods
build_explain_clause(options = [])
📝 Source code
# File activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb, line 96
def build_explain_clause(options = [])
return "EXPLAIN" if options.empty?
"EXPLAIN (#{options.join(", ").upcase})"
end
🔎 See on GitHub
explain(arel, binds = [], options = [])
📝 Source code
# File activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb, line 7
def explain(arel, binds = [], options = [])
sql = build_explain_clause(options) + " " + to_sql(arel, binds)
result = internal_exec_query(sql, "EXPLAIN", binds)
PostgreSQL::ExplainPrettyPrinter.new.pp(result)
end
🔎 See on GitHub
high_precision_current_timestamp()
📝 Source code
# File activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb, line 92
def high_precision_current_timestamp
HIGH_PRECISION_CURRENT_TIMESTAMP
end
🔎 See on GitHub
set_constraints(deferred, *constraints)
Set when constraints will be checked for the current transaction.
Not passing any specific constraint names will set the value for all deferrable constraints.
deferred
-
Valid values are
:deferred
or:immediate
.
See www.postgresql.org/docs/current/sql-set-constraints.html
📝 Source code
# File activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb, line 110
def set_constraints(deferred, *constraints)
unless %i[deferred immediate].include?(deferred)
raise ArgumentError, "deferred must be :deferred or :immediate"
end
constraints = if constraints.empty?
"ALL"
else
constraints.map { |c| quote_table_name(c) }.join(", ")
end
execute("SET CONSTRAINTS #{constraints} #{deferred.to_s.upcase}")
end
🔎 See on GitHub