From: Ian Jackson Subject: [OSSTEST PATCH 07/12] sg-report-job-history: Cope if history too short Date: Mon, 15 Jun 2015 18:13:08 +0100 Message-ID: <1434388394-26099-8-git-send-email-ian.jackson@eu.citrix.com> References: <1434388394-26099-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z4YPK-0000SO-Ai for xen-devel@lists.xenproject.org; Mon, 15 Jun 2015 17:42:50 +0000 In-Reply-To: <1434388394-26099-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org If there have been less than 99 relevant flights, the inner SELECT (to determine the minimum flight number) would return NULL. And anything > NULL is NULL and NULL is treated as false. So the host runvar identification would break. Signed-off-by: Ian Jackson --- sg-report-job-history | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sg-report-job-history b/sg-report-job-history index e4f35bf..76cb146 100755 --- a/sg-report-job-history +++ b/sg-report-job-history @@ -182,10 +182,11 @@ END FROM runvars JOIN flights USING (flight) WHERE ($cond) - AND flight >= ( + AND flight >= COALESCE( + ( SELECT flight $fromstuff LIMIT 1 OFFSET $offset - ) + ), 0) ORDER BY name; END $hostsq->execute(@params, @params); # sql text contains $cond twice -- 1.7.10.4