X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 9F8F0CB849 for ; Sun, 13 Jul 2003 01:01:30 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 21158-08 for ; Sun, 13 Jul 2003 01:01:17 +0000 (GMT) Received: from smtp.noos.fr (nan-smtp-08.noos.net [212.198.2.77]) by svr1.postgresql.org (Postfix) with ESMTP id A5276CB844 for ; Sat, 12 Jul 2003 22:00:58 -0300 (ADT) Received: (qmail 8472420 invoked by uid 0); 13 Jul 2003 01:01:18 -0000 Received: from unknown (HELO gmendola) ([212.198.37.110]) (envelope-sender ) by 212.198.2.77 (qmail-ldap-1.03) with SMTP for ; 13 Jul 2003 01:01:18 -0000 Message-ID: <002201c348ea$ab5f4300$10d4a8c0@mm.eutelsat.org> From: "Mendola Gaetano" To: , Subject: Function immutable is not during a reindex ? Date: Sun, 13 Jul 2003 04:58:42 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200307/119 X-Sequence-Number: 9459 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