Re: BUG #4421: convert_to() should be immutable - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #4421: convert_to() should be immutable
Date
Msg-id 20831.1221673615@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #4421: convert_to() should be immutable  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: BUG #4421: convert_to() should be immutable
List pgsql-bugs
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> andipeer@gmx.net wrote:
>> The function convert_to(string text, dest_encoding name) is not allowed to
>> be used in a index expression, because it is not marked as "IMMUTABLE".

> You can change the way a conversion is done with CREATE/DROP CONVERSION.
> That's why it can't be IMMUTABLE.

The other reason is that it depends on the database encoding.  I suppose
you could make an argument that that's fixed for as long as IMMUTABLE
needs to think about --- but we'd have to remember to undo the marking
if database encoding ever becomes less fixed.

Just out of curiosity, what's the use-case for this function in an index
anyway?

            regards, tom lane

pgsql-bugs by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: BUG #4422: select ... where ... NOT EXISTS / NOT IN
Next
From: ITAGAKI Takahiro
Date:
Subject: 0x1A in control file on Windows