RES: [SQL] ERROR: DefineIndex: index function must be marked iscachable

From: Elielson Fontanezi <ElielsonF(at)prodam(dot)sp(dot)gov(dot)br>
To: 'Stephan Szabo' <sszabo(at)megazone(dot)bigpanda(dot)com>, Elielson Fontanezi <ElielsonF(at)prodam(dot)sp(dot)gov(dot)br>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>, pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: RES: [SQL] ERROR: DefineIndex: index function must be marked iscachable
Date: 2003-07-25 19:27:45
Message-ID: A799F7647794D311924A005004ACEA9709699784@cprodamibs249.prodam
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Oh sorry!

Linux netlab142.prodam 2.4.8-26mdk #1 Sun Sep 23 17:06:39 CEST 2001
i686 unknown
pg_ctl (PostgreSQL) 7.2.1

-----Mensagem original-----
De: Stephan Szabo [mailto:sszabo(at)megazone(dot)bigpanda(dot)com]
Enviada em: sexta-feira, 25 de julho de 2003 16:25
Para: Elielson Fontanezi
Cc: pgsql-general; pgsql-sql
Assunto: Re: [GENERAL] [SQL] ERROR: DefineIndex: index function must be
marked iscachable

On Fri, 25 Jul 2003, Stephan Szabo wrote:

> On Fri, 25 Jul 2003, Elielson Fontanezi wrote:
>
> > What can I do in this case?
> > I could not found anything about iscachable.
>
>
> >
> > postgres$ cat in.sql
> > create index bt_proposta_f01 on proposta
> > using btree (func_cod_secretaria(nr_proponente));
> >
> > postgres$ psql -d escola -f in.sql
> > psql:in.sql:2: ERROR: DefineIndex: index function must be marked
iscachable
>
> Check the create function reference page, I believe you'd need to add WITH
> (iscachable) to the end of the function creation.
>
> iscachable means that the function always returnes the same result when
> given the same arguments. It's a prereq to using the function in an
> index. If your function doesn't meet those requirements (for example if it
> does a query on a table) making an index on that function is a bad idea.

Almost forgot. In recent versions you'd specify that the function was
IMMUTABLE and I believe the error message would use such as well. What
version are you using (it might be worth considering an upgrade to 7.4
when it comes out)

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-07-25 19:39:38 Re: Query analyse
Previous Message Stephan Szabo 2003-07-25 19:24:56 Re: [SQL] ERROR: DefineIndex: index function must be

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2003-07-25 19:39:38 Re: Query analyse
Previous Message Stephan Szabo 2003-07-25 19:24:56 Re: [SQL] ERROR: DefineIndex: index function must be