From a017f2ac7584279e34e1cf86e1ddf38a3fa04a0a Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Mar 05 2020 12:56:20 +0000 Subject: PR#2060: build_references: fix the type of event_id used by max Merges #2060 https://pagure.io/koji/pull-request/2060 Fixes: #1961 https://pagure.io/koji/issue/1961 SQL effectivity for build_references --- diff --git a/hub/kojihub.py b/hub/kojihub.py index 2a21329..6a39619 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -7728,7 +7728,7 @@ def build_references(build_id, limit=None, lazy=False): FROM buildroot_listing WHERE rpm_id IN %(rpm_ids)s )""" - event_id = _fetchSingle(q, {'rpm_ids': build_rpm_ids}) or 0 + event_id = (_fetchSingle(q, {'rpm_ids': build_rpm_ids}) or (0,))[0] or 0 if build_archive_ids: q = """SELECT MAX(create_event) FROM standard_buildroot @@ -7737,7 +7737,7 @@ def build_references(build_id, limit=None, lazy=False): FROM buildroot_archives WHERE archive_id IN %(archive_ids)s )""" - event_id2 = _fetchSingle(q, {'archive_ids': build_archive_ids}) or 0 + event_id2 = (_fetchSingle(q, {'archive_ids': build_archive_ids}) or (0,))[0] or 0 event_id = max(event_id, event_id2) if event_id: q = """SELECT EXTRACT(EPOCH FROM get_event_time(%(event_id)i))"""