pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Elielson Fontanezi <ElielsonF@prodam.sp.gov.br>
Cc: pgsql-general <pgsql-general@postgresql.org>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: [SQL] ERROR:  DefineIndex: index function must be
Date: Fri, 25 Jul 2003 12:24:56 -0700 (PDT)
Message-ID: <20030725122348.L37941-100000@megazone.bigpanda.com> (raw)
In-Reply-To: <20030725121618.G37941-100000@megazone.bigpanda.com>

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)




view thread (6+ messages)  latest in thread

Message-ID: <20030725122348.L37941-100000@megazone.bigpanda.com>
Permalink:  ../20030725122348.L37941-100000@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20030725122348.L37941-100000@megazone.bigpanda.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sszabo@megazone.bigpanda.com, ElielsonF@prodam.sp.gov.br, pgsql-general@postgresql.org
  Subject: Re: [SQL] ERROR:  DefineIndex: index function must be
  In-Reply-To: <20030725122348.L37941-100000@megazone.bigpanda.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox