Re: subtratcing dates

Поиск
Список
Период
Сортировка
От Fran Fabrizio
Тема Re: subtratcing dates
Дата
Msg-id 3AF6AFC9.79284552@exchange.webmd.net
обсуждение исходный текст
Ответ на subtratcing dates  (Fran Fabrizio <ffabrizio@exchange.webmd.net>)
Ответы Re: subtratcing dates  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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@exchange.webmd.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


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: select error with null string -- error code -209
Следующее
От: Vince Vielhaber
Дата:
Сообщение: Re: v7.1.1 Branched, Packaged and Released ...