Re: how to add seconds to a TimestampTz

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: how to add seconds to a TimestampTz
Дата
Msg-id 20070315130639.GA5645@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: how to add seconds to a TimestampTz  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane wrote:
> Alvaro Herrera <alvherre@commandprompt.com> writes:
> > Is there a better way than going to time_t and back?
> 
> Isn't the standard SQL-level locution
>     timestamptz + numeric_value * '1 second'::interval
> ?  I'm not sure what would be the most convenient realization
> of this at the C level, but please stay away from time_t ...

Yes, it is, but we would have to be calling interval input,
interval-times-integer, then interval-plus-timestamp, each time we
scheduled a worker (to calculate the "time of next worker start"), which
sounds like too much work ... an idea would be to store the result of
interval input and multiplication, and recalculate each time we got
SIGHUP.

But then, maybe this is premature optimization on my part.  I'll write
it in the natural form for now, and then we'll see if we should rewrite
it; and then, maybe it's easier to write something equivalent to
TimestampDifference ...

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


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

Предыдущее
От: Grzegorz Jaskiewicz
Дата:
Сообщение: [RFC] CLUSTER VERBOSE
Следующее
От: Grzegorz Jaskiewicz
Дата:
Сообщение: Re: how to add seconds to a TimestampTz