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: Geoff Winkless <pgsqladmin(at)geoff(dot)dj>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: ERROR: functions in index expression must be marked IMMUTABLE
Date: 2017-03-03 10:43:32
Message-ID: CAEzk6fd=+moBVZj9tKiYCkLszvL_Qe8cHUK=imakO=8iVfk7WQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 1 March 2017 at 14:23, Sven R. Kunze <srkunze(at)mail(dot)de> wrote:

> I don't consider rolling an UDF the best alternative especially after
> having looked through many solution proposals on the Web which just take an
> mutable expression and wrap them up in an immutable function.
>

​One alternative would be to make to_date accept all language variants of
months simultaneously. A quick search of google suggests that there aren't
any overlaps between languages (ie where one language uses "Foo" for March
and another uses "Foo" for May), although you would have to​ do some more
intense research to be sure. As far as I can see there's no other reason
why to_date would need to be marked as stable/volatile, is there?

On the down side I imagine it would involve some
potentially-prohibitively-large lookup tables; it would also end up with a
technical incompatibility in that what ANSI SQL would reject as not-a-date
might be parsed as a date. I'm not in a position to judge if either of
those would be acceptable.

​Geoff​

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sven R. Kunze 2017-03-03 11:44:27 Re: ERROR: functions in index expression must be marked IMMUTABLE
Previous Message Sven R. Kunze 2017-03-03 09:51:16 Re: DISTINCT vs GROUP BY - was Re: is (not) distinct from