cast not IMMUTABLE?

Поиск
Список
Период
Сортировка
От Gaetano Mendola
Тема cast not IMMUTABLE?
Дата
Msg-id c7ei84$j0e$1@floppy.pyrenet.fr
обсуждение исходный текст
Ответы Re: cast not IMMUTABLE?
Re: cast not IMMUTABLE?
Re: cast not IMMUTABLE?
Список pgsql-admin
Hi all,
I have a table with ~ 3e+6 rows on it.

I do select on this table in this way:


(1) select * from user_logs where login_time::date = now()::date;


consider that login_time is a TIMESTAMPTZ with an index on it.

If I use the select in this way:

select * from user_logs where login_time = now();

the the index is used.

I'm trying to use define and index in order to help the query (1):


test# create index idx on user_logs ( (login_time::date) );
ERROR:  functions in index expression must be marked IMMUTABLE


why that cast is not considered IMMUTABLE ?


How can I define an index for the query (1) ?


Regards
Gaetano Mendola











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

Предыдущее
От: Martin Brommer
Дата:
Сообщение: Meta data corruption
Следующее
От: Sam Barnett-Cormack
Дата:
Сообщение: Re: cast not IMMUTABLE?