From: | Fran Fabrizio <ffabrizio(at)exchange(dot)webmd(dot)net> |
---|---|
To: | |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: subtratcing dates |
Date: | 2001-05-07 14:23:05 |
Message-ID: | 3AF6AFC9.79284552@exchange.webmd.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thanks for the tip Tom!
At first, I accidentally tried to do reltime(limit*60) where limit was
accidentally an interval instead of an integer, and my database crashed
and exited horribly. Perhaps that's why it's a poorly documented
function! ;-)
-Fran
> Fran Fabrizio <ffabrizio(at)exchange(dot)webmd(dot)net> writes:
> > I want to have a query that tells me whether or not the timestamp is
> > within 'limit' minutes of the current time.
>
> A poorly documented fact is that you can coerce an integer number of
> seconds into a reltime, which can then be added to or subtracted from
> a timestamp. So:
>
> select tstamp > now() - reltime(limit*60) from ...
>
> should do it.
>
> regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-05-07 14:23:51 | Re: select error with null string -- error code -209 |
Previous Message | Einar Karttunen | 2001-05-07 14:20:46 | Re: DB Getting Slower and Slower and Slower.... |