ERROR: functions in index expression must be marked IMMUTABLE in Postgres

后端 未结 5 540
予麋鹿
予麋鹿 2020-11-30 10:01

I want to create a Multicolumn expression index, but when I create the index, the following message is output:

--detail message 
wapgrowth=> create index          


        
5条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-30 10:26

    to_char of a timestamp-without-timezone is not an immutable function, because the conversion depends on your local time-zone setting. That means the index wouldn't be portable to another computer in a different time zone, and Postgres won't allow it. I think the problem will go away if you declare create_time as a time with timezone.

提交回复
热议问题