Re: Error: timestamp with timezone + interval is not immutable while creating index
В списке pgsql-general по дате отправления:
| От | David Salisbury |
|---|---|
| Тема | Re: Error: timestamp with timezone + interval is not immutable while creating index |
| Дата | |
| Msg-id | 4E9771E4.2000005@globe.gov обсуждение исходный текст |
| Ответ на | Error: timestamp with timezone + interval is not immutable while creating index (Phil Couling <couling@gmail.com>) |
| Список | pgsql-general |
On 10/13/11 4:38 PM, Phil Couling wrote: > 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. > I believe the problem is that you have a TZ on your timestamp, and that makes things mutable. functions that deal with time can't be marked as immutable do to this reason. -Dave
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера