immutable functions and enumerate type casts in indexes

From: Edoardo Panfili <edoardo(at)aspix(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: immutable functions and enumerate type casts in indexes
Date: 2008-09-01 16:24:47
Message-ID: 48BC174F.3050506@aspix.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Howard Cole 2008-09-01 17:10:51 Can I truncate statements in the log?
Previous Message Alvaro Herrera 2008-09-01 15:52:40 Re: refcursor