Thread: indexing tables using my owns functions

indexing tables using my owns functions

From
"Pau Marc Munoz Torres"
Date:

Hi every body
 
 Recently i wrote my own function into postgesql... and it works perfecly!!, now i would like use it to index a table like this guy do at the link ( http://www.faqs.org/docs/ppbook/r24254.htm)

but i get the following error

mhc2db=> create index h2iab on precalc (idr(p1,p4,p6,p7,p9,'H-2*IAb'));
ERROR:  functions in index expression must be marked IMMUTABLE
mhc2db=>

in this indexation p1,p4,p6,p7,p9 are variables that depends on the field.

could anyone help me?

--
Pau Marc Muñoz Torres

Laboratori de Biologia Computacional  
Institut de  Biotecnologia   i Biomedicina Vicent Villar                                    
Universitat Autonoma de Barcelona
E-08193 Bellaterra (Barcelona)
              
telèfon: 93 5812807
Email : paumarc.munoz@bioinf.uab.cat

Re: indexing tables using my owns functions

From
Martijn van Oosterhout
Date:
On Mon, Nov 26, 2007 at 04:54:10PM +0100, Pau Marc Munoz Torres wrote:
> Hi every body
>
>  Recently i wrote my own function into postgesql... and it works perfecly!!,
> now i would like use it to index a table like this guy do at the link (
> http://www.faqs.org/docs/ppbook/r24254.htm)
>
> but i get the following error
>
> mhc2db=> create index h2iab on precalc (idr(p1,p4,p6,p7,p9,'H-2*IAb'));
> ERROR:  functions in index expression must be marked IMMUTABLE

Where you declare the function, add the modifier IMMUTABLE.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
>  -- John F Kennedy

Attachment