Re: problems with date and interval queries.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: problems with date and interval queries.
Дата
Msg-id 15567.1044901285@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: problems with date and interval queries.  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Ответы Re: problems with date and interval queries.  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-sql
Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> interval <stuff> is the form for an interval literal.  If the column is
> already an interval, you probably don't need it at all.  If you need to
> cast it you should do a cast CAST (num_min AS INTERVAL)

I don't believe there is a cast from any numeric type to interval.

I'd recommend the interval-times-float operator.  It should work to
write
num_min * interval '1 min'

This approach has the advantage that it trivially adapts to whatever
unit you happen to have the column stated in (seconds, minutes, days, ...)
        regards, tom lane


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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: problems with date and interval queries.
Следующее
От: Jean-Luc Lachance
Дата:
Сообщение: Re: order by date desc but NULLs last