Re: SELECT and DATE Function question

Поиск
Список
Период
Сортировка
От Aaron Bono
Тема Re: SELECT and DATE Function question
Дата
Msg-id bf05e51c0609110803k2e9679d2ma200b00fa10f4651@mail.gmail.com
обсуждение исходный текст
Ответ на Re: SELECT and DATE Function question  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-admin
On 9/11/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"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).

 
I knew there was a better way but I forgot what it was and couldn't find it in the documentation.

Could the documentation be updated with this example?  This question appears every month or so and I know it is very useful to many people.

Thanks!

==================================================================
   Aaron Bono
   Aranya Software Technologies, Inc.
   http://www.aranya.com
   http://codeelixir.com
==================================================================

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

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