Timespan / interval calculations?

Поиск
Список
Период
Сортировка
От Petter Reinholdtsen
Тема Timespan / interval calculations?
Дата
Msg-id 200011020213.KAA18168@minerva.ee.uwa.edu.au
обсуждение исходный текст
Список pgsql-sql
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


В списке pgsql-sql по дате отправления:

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: Outer Joins
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: INSERT [IGNORE] INTO TABLE