"Oleg" <sero...@gmail.com> writes:
> Please mark function date_trunc as IMMUTABLE for using in index.

The version for timestamp without time zone already is marked immutable.
The version for timestamp with time zone can't be marked immutable,
because it isn't: its behavior depends on the timezone setting.

Depending on what it is you hope to accomplish, you might be able to do
something like this:

regression=# create table t1 (f1 timestamptz);
CREATE TABLE
regression=# create index ii on t1 (date_trunc('day', f1 AT TIME ZONE 'UTC'));
CREATE INDEX

This is immutable because the truncation happens with respect to a fixed
timezone.  (Doesn't have to be UTC, any constant timezone name will do.)

                        regards, tom lane

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to