Function immutable is not during a reindex ?

From: "Mendola Gaetano" <mendola(at)bigfoot(dot)com>
To: <pgsql-bugs(at)postgresql(dot)org>, <pgsql-admin(at)postgresql(dot)org>
Subject: Function immutable is not during a reindex ?
Date: 2003-07-13 02:58:42
Message-ID: 002201c348ea$ab5f4300$10d4a8c0@mm.eutelsat.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-bugs

Hi all,
I'm running the followin example on Postgres 7.3.3
I notice that if I declare an immutable function like this:

CREATE OR REPLACE FUNCTION test (integer) RETURNS integer
AS '
declare
begin
raise notice ''test called'';
return $1+1;
end;'
LANGUAGE plpgsql IMMUTABLE;

and I use this function for a partial index:

create table t_a
(
a integer,
b integer
);

insert into t_a values ( 1, 0 );
insert into t_a values ( 1, 1 );
insert into t_a values ( 1, 2 );

Now creating an index on that table:

create index idxv on t_a ( b ) where test(3) = b;
NOTICE: test called
NOTICE: test called
NOTICE: test called
CREATE INDEX

the function is immutable but is executed 3 times
( one for each row).

The same if I reindex the table:

reindex table t_a;
NOTICE: test called
NOTICE: test called
NOTICE: test called
REINDEX

Regards
Gaetano Mendola

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Deepak Malhotra 2003-07-13 08:08:53 How to backup and Restore single table in Postgresql DB
Previous Message Tom Lane 2003-07-13 02:19:07 Re: Function immutable is not during a reindex ?

Browse pgsql-bugs by date

  From Date Subject
Next Message Mendola Gaetano 2003-07-13 12:12:15 Re: Function immutable is not during a reindex ?
Previous Message Tom Lane 2003-07-13 02:19:07 Re: Function immutable is not during a reindex ?