postgresql7.1 select CASE WHEN (now() - :date::timestamp) < 0 THEN 1 ELSE 0 END select CASE WHEN (:start_date::timestamp - :end_date::timestamp) < 0 THEN 1 ELSE 0 END select CASE WHEN (:start_date::timestamp - (now() + :future_years)) < 0 THEN 1 ELSE 0 END