lib/pghero/methods/explain.rb in pghero-2.5.1 vs lib/pghero/methods/explain.rb in pghero-2.6.0
- old
+ new
@@ -4,10 +4,10 @@
def explain(sql)
sql = squish(sql)
explanation = nil
# use transaction for safety
- with_transaction(statement_timeout: (explain_timeout_sec * 1000), rollback: true) do
+ with_transaction(statement_timeout: (explain_timeout_sec * 1000).round, rollback: true) do
if (sql.sub(/;\z/, "").include?(";") || sql.upcase.include?("COMMIT")) && !explain_safe?
raise ActiveRecord::StatementInvalid, "Unsafe statement"
end
explanation = select_all("EXPLAIN #{sql}").map { |v| v[:"QUERY PLAN"] }.join("\n")
end