Received: from minerva.ee.uwa.edu.au (pere.dialup.ee.uwa.edu.au [130.95.70.69]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eA22ENl13943 for ; Wed, 1 Nov 2000 21:14:25 -0500 (EST) (envelope-from pere@hungry.com) Received: (from pere@localhost) by minerva.ee.uwa.edu.au (8.9.3/8.9.3) id KAA18168; Thu, 2 Nov 2000 10:13:59 +0800 Date: Thu, 2 Nov 2000 10:13:59 +0800 Message-Id: <200011020213.KAA18168@minerva.ee.uwa.edu.au> X-Authentication-Warning: minerva.ee.uwa.edu.au: pere set sender to pere@hungry.com using -f To: pgsql-sql@postgresql.org Subject: Timespan / interval calculations? From: Petter Reinholdtsen X-Archive-Number: 200011/9 X-Sequence-Number: 40 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