Re: Why extract( ... from timestamp ) is not immutable?

Поиск
Список
Период
Сортировка
От hubert depesz lubaczewski
Тема Re: Why extract( ... from timestamp ) is not immutable?
Дата
Msg-id 20120125163017.GA13120@depesz.com
обсуждение исходный текст
Ответ на Re: Why extract( ... from timestamp ) is not immutable?  (Adrian Klaver <adrian.klaver@gmail.com>)
Ответы Re: Why extract( ... from timestamp ) is not immutable?  (Adrian Klaver <adrian.klaver@gmail.com>)
Список pgsql-general
On Wed, Jan 25, 2012 at 08:22:26AM -0800, Adrian Klaver wrote:
> The issue seems to be the definition of same arguments. Since epoch is anchored
> at 1970-01-01 00:00:00 UTC the timestamp passed to extract need to be normalized
> to UTC.  Once a timestamp is in UTC then the epoch can be determined. The
> variability lies in the initial data fed to the function. Since time does not
> stand still, every time you do now() you are getting a different argument. Throw
> in time zone considerations and you see the results you are getting.

??? Sorry?
what are you talking about?

Simple:
extract(epoch from '2012-01-01 12:34:56'::timestamp)
which doesn't contain now(), is not immutable.

Personally, I think that extract(epoch from timestamp) should assume
that the timestamp is UTC.
Or that there should be a way to do it - by "it" i mean - extract epoch
value from timestamp value in immutable way.

Best regards,

depesz

--
The best thing about modern society is how easy it is to avoid contact with it.
                                                             http://depesz.com/

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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Why extract( ... from timestamp ) is not immutable?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Why extract( ... from timestamp ) is not immutable?