From: Ian Jackson Subject: [OSSTEST PATCH 07/25] sg-report-job-history: Cope if history too short Date: Wed, 17 Jun 2015 17:45:03 +0100 Message-ID: <1434559521-8751-8-git-send-email-ian.jackson@eu.citrix.com> References: <1434559521-8751-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.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z5GTK-0004c3-L2 for xen-devel@lists.xenproject.org; Wed, 17 Jun 2015 16:45:54 +0000 In-Reply-To: <1434559521-8751-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 Acked-by: Ian Campbell --- 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