No soy un experto en Postgres, pero creo que new
es para disparadores y no para funciones regulares.
Creo que quieres algo como:
CREATE FUNCTION check_available_flightID(date)
RETURNS integer AS
$$
declare newfid int;
BEGIN
SELECT FlightID into newfid FROM Flight WHERE FlightDate::date = $1;
IF newfid IS NULL THEN
RAISE EXCEPTION 'No flight in the date you enter';
END IF;
RETURN query SELECT FlightID FROM Flight WHERE FlightDate::date = $1;
end;
$$