pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mendola Gaetano <mendola@bigfoot.com>
To: pgsql-bugs@postgresql.org
To: pgsql-admin@postgresql.org
Subject: Function immutable is not during a reindex ?
Date: Sun, 13 Jul 2003 04:58:42 +0200
Message-ID: <002201c348ea$ab5f4300$10d4a8c0@mm.eutelsat.org> (raw)

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
















view thread (5+ messages)  latest in thread

Message-ID: <002201c348ea$ab5f4300$10d4a8c0@mm.eutelsat.org>
Permalink:  ../002201c348ea$ab5f4300$10d4a8c0@mm.eutelsat.org/
Also on:    postgresql.org/message-id/002201c348ea$ab5f4300$10d4a8c0@mm.eutelsat.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mendola@bigfoot.com, pgsql-bugs@postgresql.org
  Subject: Re: Function immutable is not during a reindex ?
  In-Reply-To: <002201c348ea$ab5f4300$10d4a8c0@mm.eutelsat.org>
  References: <002201c348ea$ab5f4300$10d4a8c0@mm.eutelsat.org>

* 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