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

From: Geoff Winkless <pgsqladmin(at)geoff(dot)dj>
To: "Sven R(dot) Kunze" <srkunze(at)mail(dot)de>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: ERROR: functions in index expression must be marked IMMUTABLE
Date: 2017-02-26 15:56:22
Message-ID: CAEzk6fdvUWfyignuG548pwSmQG-05szzn_Kf7mKYrb-hOVu8mg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 26 February 2017 at 10:09, Sven R. Kunze <srkunze(at)mail(dot)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?

https://www.postgresql.org/message-id/4E039D16.20704%40pinpointresearch.com

Geoff


In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2017-02-26 16:09:39 Re: ERROR: functions in index expression must be marked IMMUTABLE
Previous Message Frazer McLean 2017-02-26 14:42:52 Configuring ssl_crl_file