From: Petter Reinholdtsen <pere@hungry.com>
To: pgsql-sql@postgresql.org
Subject: Timespan / interval calculations?
Date: Thu, 2 Nov 2000 10:13:59 +0800
Message-ID: <200011020213.KAA18168@minerva.ee.uwa.edu.au> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: pere@hungry.com
Subject: Re: Timespan / interval calculations?
In-Reply-To: <200011020213.KAA18168@minerva.ee.uwa.edu.au>
References: <200011020213.KAA18168@minerva.ee.uwa.edu.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox