Error: timestamp with timezone + interval is not immutable while creating index

Поиск
Список
Период
Сортировка
От Phil Couling
Тема Error: timestamp with timezone + interval is not immutable while creating index
Дата
Msg-id CANWftz+bkiewmkLBFHjxOfHn8V8duhP+KXYJqbRGBYbVycPgrQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: Error: timestamp with timezone + interval is not immutable while creating index
Список pgsql-general
Hi All

I've got a table with (amongst others) two fields:
last_updated timestamp with time zone;
update_cycle interval;

I'd like to create an index on these, to index time "next update" time
(last_updated + update_cycle).

When I try this I get an error though:

main=> create index foo_next_update on foo( (last_updated + update_cycle) ) ;
ERROR:  functions in index expression must be marked IMMUTABLE

Does anyone know why adding two fields like this results in anything
other than an immutable function?  Under what circumstances could it
return a different result?

Thanks very much for any help.

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

Предыдущее
От: Rich Shepard
Дата:
Сообщение: Re: I need to load mysql dump to postgres...
Следующее
От: Phil Couling
Дата:
Сообщение: Error: timestamp with timezone + interval is not immutable while creating index