From 3cc947013d99ba4e20b65bd1a9475d9f85421bae Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Sat, 13 Jun 2015 13:27:39 +0200 Subject: [PATCH] auto-decruft: Fix and reduce two SQL statements Thanks to Ansgar Burchardt for spotting these issues. Signed-off-by: Niels Thykier --- dak/auto_decruft.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/dak/auto_decruft.py b/dak/auto_decruft.py index 6157a4f3..a7c67fa3 100644 --- a/dak/auto_decruft.py +++ b/dak/auto_decruft.py @@ -358,20 +358,17 @@ def sources2removals(source_list, suite_id, session): params = {"suite_id": suite_id, "sources": tuple(source_list)} q = session.execute(""" SELECT s.source, s.version, 'source', s.id - FROM source s, + FROM source s JOIN src_associations sa ON sa.source = s.id - JOIN suite su ON sa.suite = su.id - WHERE su.id = :suite_id AND s.source IN :sources""", params) + WHERE sa.suite = :suite_id AND s.source IN :sources""", params) to_remove.extend(q) q = session.execute(""" SELECT b.package, b.version, a.arch_string, b.id FROM binaries b JOIN bin_associations ba ON b.id = ba.bin JOIN architecture a ON b.architecture = a.id - JOIN suite su ON ba.suite = su.id JOIN source s ON b.source = s.id - JOIN src_associations sa ON s.id = sa.source AND sa.suite = su.id - WHERE su.id = :suite_id AND s.source IN :sources""", params) + WHERE ba.suite = :suite_id AND s.source IN :sources""", params) to_remove.extend(q) return to_remove -- 2.39.5