Re: [GENERAL] ERROR: functions in index expression must be marked IMMUTABLE - Mailing list pgsql-general

From Geoff Winkless
Subject Re: [GENERAL] ERROR: functions in index expression must be marked IMMUTABLE
Date
Msg-id CAEzk6fdvUWfyignuG548pwSmQG-05szzn_Kf7mKYrb-hOVu8mg@mail.gmail.com
Whole thread Raw
In response to [GENERAL] ERROR: functions in index expression must be marked IMMUTABLE  ("Sven R. Kunze" <srkunze@mail.de>)
Responses Re: [GENERAL] ERROR: functions in index expression must be markedIMMUTABLE  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
On 26 February 2017 at 10:09, Sven R. Kunze <srkunze@mail.de> wrote:
>>># create index docs_birthdate_idx ON docs using btree (((meta->>'birthdate')::date));
ERROR:  functions in index expression must be marked IMMUTABLE

So, what is the problem here?

​Date functions are inherently not immutable because of timezones. Your solution of using to_timestamp doesn't help because it automatically returns a value in WITH TIMESTAMP. Do you get anywhere by using "::timestamp without time zone" instead, as suggested here?


Geoff

pgsql-general by date:

Previous
From: "Frazer McLean"
Date:
Subject: [GENERAL] Configuring ssl_crl_file
Next
From: Adrian Klaver
Date:
Subject: Re: [GENERAL] ERROR: functions in index expression must be markedIMMUTABLE