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 <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
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