Обсуждение: Timespan / interval calculations?

Поиск
Список
Период
Сортировка

Timespan / interval calculations?

От
Petter Reinholdtsen
Дата:
I'm using PostgreSQL 6.5.  I have a table with a timestamp field.  I
want to extract all rows with a timestamp less then an hour ago.  I've
tried several things, but nothing seem to work.  How should it be
done?

I've tried 
 select * from syslog    where stamp between timestamp('now') - interval('1 hour') and 'now';
 select * from syslog    where stamp between timestamp('now') - timestamp('1 hour') and 'now';

but none of these works.

It seem to be something wrong with the interval and timespan types.
 pere=> select interval('1 hour'); ERROR:  parser: parse error at or near "(" pere=> select timespan('1 hour'); ERROR:
Function'timespan(unknown)' does not exist       Unable to identify a function which satisfies the given argument types
     You will have to retype your query using explicit typecasts pere=> 
 

Should this work, or is it my mistake?

(I'm not on the mailing list, please copy replies to me. :-)
-- 
##>  Petter Reinholdtsen  <##  |  pere@td.org.uit.no