From 7df1c2bed020a3c3c789fe99836022b741ac7fe0 Mon Sep 17 00:00:00 2001 From: Jan Dobes Date: Wed, 6 Dec 2023 17:23:34 +0100 Subject: [PATCH] fix(manager): systems_affected columns should never be NULL when applying filters ...and for some reason postgresql executes the query faster RHINENG-5256 --- manager/filters.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manager/filters.py b/manager/filters.py index bde64b9fa..a14bb35b9 100644 --- a/manager/filters.py +++ b/manager/filters.py @@ -671,9 +671,9 @@ def _filter_cve_by_affecting_host_type(query, args, kwargs): expr = None for arg in affecting: if arg == HostType.RPMDNF: - expr |= fn.COALESCE(count_subquery.c.systems_affected_rpmdnf_, 0) != 0 + expr |= count_subquery.c.systems_affected_rpmdnf_ != 0 elif arg == HostType.EDGE: - expr |= fn.COALESCE(count_subquery.c.systems_affected_edge_, 0) != 0 + expr |= count_subquery.c.systems_affected_edge_ != 0 elif arg == HostType.NONE: expr |= (fn.COALESCE(count_subquery.c.systems_affected_rpmdnf_, 0) + fn.COALESCE(count_subquery.c.systems_affected_edge_, 0)) == 0 if expr: