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

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: 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: Re: [SQL] ERROR: DefineIndex: index function must be marked iscachable
Date: 2003-07-25 19:21:15
Message-ID: 20030725121618.G37941-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tomasz Myrta 2003-07-25 19:22:28 Re: ERROR: DefineIndex: index function must be marked iscachable
Previous Message Elielson Fontanezi 2003-07-25 19:09:27 ERROR: DefineIndex: index function must be marked iscachable

Browse pgsql-sql by date

  From Date Subject
Next Message Tomasz Myrta 2003-07-25 19:22:28 Re: ERROR: DefineIndex: index function must be marked iscachable
Previous Message Elielson Fontanezi 2003-07-25 19:09:27 ERROR: DefineIndex: index function must be marked iscachable