From 86827f7bb3490f9bfcc1440d6cb37f309509c460 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Mar 05 2020 12:50:48 +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 46db0c5..1015777 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -7939,7 +7939,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 @@ -7948,7 +7948,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))"""