Re: SELECT and DATE Function question

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SELECT and DATE Function question
Дата
Msg-id 22488.1157983704@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: SELECT and DATE Function question  ("Aaron Bono" <postgresql@aranya.com>)
Ответы Re: SELECT and DATE Function question
Список pgsql-admin
"Aaron Bono" <postgresql@aranya.com> writes:
> Use:

> select start_date + (cast(number_of_days as text) || ' days')::interval from
> blah

This is a pretty awful way to do it, much better is

    select start_date + number_of_days * '1 day'::interval ...

which reduces to basically one multiplication instead of conversion to
text, text string append, parse interval string value (relying on a
couple of undocumented cast abilities).

But the real question here is whether you actually want sub-day
precision in your result.  Should the column have been 'date' rather
than 'timestamp' to begin with?  If not, what behavior are you expecting
at DST boundaries?

            regards, tom lane

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

Предыдущее
От: "Purusothaman A"
Дата:
Сообщение: Re: [GENERAL] Problem with lo_export() and lo_import() from remote machine.
Следующее
От: "Marco Bizzarri"
Дата:
Сообщение: Re: [GENERAL] Problem with lo_export() and lo_import() from remote machine.