> The idea here is to have a formula that says "select * from flights
> where date was less than 30 days ago" and have that formula work
> properly.
How about:
select *
from flights
where date < cast(current_date + interval '30 days ago' as date);
(assuming there is a date column (of type date) on flights).
So if I want to subtract two dates for this purpose, then I am
> going to need a today() function which I also have not found.
>
> I see now how the extract(epoch from interval) could be used, but then
> why is there no extract(days|months|hours from interval), or why can I
> not format an interval as "XXXXX seconds" or "YYY days"? Would make
> things so much simpler!
You can do this. For example
select current_timestamp + interval '1000000 seconds';
You can find the documentation on how to use the interval type in "Data
Types" / "Date/Time Types".
Cheers,
Alex