From 1ee1126896f51f8d5c66f8b46b0979e08fd8c433 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 29 May 2015 14:14:41 +0000 Subject: [PATCH] sg-report-job-history: Cope if history too short 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 -- 2.39.5