Search Postgresql Archives

Re: Why *exactly* is date_trunc() not immutable ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Feb 18, 2007, at 20:29 , Karsten Hilbert wrote:

What I don't understand, however, is exactly *why* date_trunc is not immutable ?

I believe it's because the result of date_trunc depends on the time zone setting for the session.

test=# select date_trunc('day', current_timestamp);
       date_trunc
------------------------
2007-02-18 00:00:00+09
(1 row)

test=# set time zone 'EST5EDT';
SET
test=# select date_trunc('day', current_timestamp);
       date_trunc
------------------------
2007-02-18 00:00:00-05
(1 row)

So, given the same arguments, ('day', and current_timestamp), date_trunc is returning two different results. (Casting to date has the same issue.)

Michael Glaesemann
grzm seespotcode net




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux