Function immutable is not during a reindex ? - Mailing list pgsql-bugs

From Mendola Gaetano
Subject Function immutable is not during a reindex ?
Date
Msg-id 002201c348ea$ab5f4300$10d4a8c0@mm.eutelsat.org
Whole thread Raw
Responses Re: [ADMIN] Function immutable is not during a reindex ?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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














pgsql-bugs by date:

Previous
From: Jonas Lindholm
Date:
Subject: Re: Daylight saving bug in PostgreSQL 7.2.1 ?
Next
From: Tom Lane
Date:
Subject: Re: [ADMIN] Function immutable is not during a reindex ?