From 6c2a091d61842fbd458de57c8d056520962e5597 Mon Sep 17 00:00:00 2001 From: Steffen Deusch Date: Thu, 5 Dec 2024 10:32:22 +0100 Subject: [PATCH] don't compare with structs (#60) Fixes #58 --- lib/ecto_psql_extras/diagnose_logic.ex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ecto_psql_extras/diagnose_logic.ex b/lib/ecto_psql_extras/diagnose_logic.ex index 9c2a2e2..7829e8a 100644 --- a/lib/ecto_psql_extras/diagnose_logic.ex +++ b/lib/ecto_psql_extras/diagnose_logic.ex @@ -141,7 +141,9 @@ defmodule EctoPSQLExtras.DiagnoseLogic do format: :raw ).rows |> Enum.filter(fn(el) -> - Enum.at(el, 3) > Decimal.from_float(@bloat_min_value) + # el = [type, schemaname, object_name, bloat, waste] + bloat = Decimal.to_float(Enum.at(el, 3)) |> Float.round(6) + bloat > @bloat_min_value end) [ok, message] = case bloated_objects do