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 CAEzk6fcZbUzUykw-tjkBT9p=rOmqUhcH1=S_po-+twu=oT1qbA@mail.gmail.com
Whole thread Raw
In response to Re: [GENERAL] ERROR: functions in index expression must be markedIMMUTABLE  ("Sven R. Kunze" <srkunze@mail.de>)
Responses Re: [GENERAL] ERROR: functions in index expression must be markedIMMUTABLE  ("Sven R. Kunze" <srkunze@mail.de>)
List pgsql-general
On 27 February 2017 at 10:52, Sven R. Kunze <srkunze@mail.de> wrote:

So, what can I do to parse texts to date(times) in a safe manner?


You know best the format of your data; if you know that your date field is always in a particular style and timezone, you can write a function that can be considered safe to set IMMUTABLE, where a more generic​ system todate function cannot.

It might be sensible to call the function something that describes it exactly, rather than my_to_date you could call it utc_yyyymmdd_todate or something, just in case someone comes along later and sees an immutable todate function and thinks they can use it for something else.

Geoff

pgsql-general by date:

Previous
From: "Sven R. Kunze"
Date:
Subject: Re: [GENERAL] ERROR: functions in index expression must be markedIMMUTABLE
Next
From: Thomas Güttler
Date:
Subject: Re: [GENERAL] via psycopg2 or pg2pg? Move rows from one database toother