immutable functions and enumerate type casts in indexes - Mailing list pgsql-general

From Edoardo Panfili
Subject immutable functions and enumerate type casts in indexes
Date
Msg-id 48BC174F.3050506@aspix.it
Whole thread Raw
Responses Re: immutable functions and enumerate type casts in indexes  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hello,

I have a problem with enumerated types in functions parameters.

my enumerated type is (this is a subset)
CREATE TYPE hibridation AS ENUM('none','genus','specie');

function declaration
CREATE FUNCTION ename(text,boolean,text,text RETURNS text AS
'funzioniGDB.so' LANGUAGE C IMMUTABLE;

index creation (the type of ibrido is hibridation)
CREATE INDEX i_specie_nome_specie ON specie
(esterna_nome(ibrido::text,proParte,genere,specie));

the result is
ERROR:  functions in index expression must be marked IMMUTABLE

Searching on google I found some explanation: the problem arises with
"non immutable" typea as "data" but I can't figure the problem (or
better, the solution) with enumerate types.

What can I do?

thank you
Edoardo







pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: refcursor
Next
From: Howard Cole
Date:
Subject: Can I truncate statements in the log?