Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id C0A776333C4 for ; Thu, 25 Mar 2010 03:16:29 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 33317-03 for ; Thu, 25 Mar 2010 06:16:19 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sargon.lncsa.com (mail.lncsa.com [213.215.28.11]) by mail.postgresql.org (Postfix) with ESMTP id 38DCA632817 for ; Thu, 25 Mar 2010 03:16:19 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by sargon.lncsa.com (Postfix) with ESMTP id DE78A3020C70 for ; Thu, 25 Mar 2010 07:16:17 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at lncsa.com Received: from sargon.lncsa.com ([127.0.0.1]) by localhost (sargon.lncsa.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yEaIOIOi3uDf for ; Thu, 25 Mar 2010 07:16:17 +0100 (CET) Received: from zenon.apartia.fr (zenon.apartia.fr [10.0.3.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "zenon.apartia.fr", Issuer "ca.apartia.fr" (verified OK)) by sargon.lncsa.com (Postfix) with ESMTP id BDB51300E35F for ; Thu, 25 Mar 2010 07:16:17 +0100 (CET) Received: from delos.apartia.fr (delos.apartia.fr [10.0.3.107]) by zenon.apartia.fr (Postfix) with ESMTP id 66DF35B93F70B for ; Thu, 25 Mar 2010 07:16:17 +0100 (CET) Received: by delos.apartia.fr (Postfix, from userid 1000) id 4E46A20036D8F; Thu, 25 Mar 2010 07:16:17 +0100 (CET) Date: Thu, 25 Mar 2010 07:16:17 +0100 From: Louis-David Mitterrand To: pgsql-sql@postgresql.org Subject: Re: Does IMMUTABLE property propagate? Message-ID: <20100325061616.GA4629@apartia.fr> Mail-Followup-To: pgsql-sql@postgresql.org References: <4B91C184.4090906@venaver.info> <407d949e1003060645i408e0648te67dfd722172f76a@mail.gmail.com> <4B927FED.60209@venaver.info> <4150.1267911115@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4150.1267911115@sss.pgh.pa.us> User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201003/179 X-Sequence-Number: 33886 On Sat, Mar 06, 2010 at 04:31:55PM -0500, Tom Lane wrote: > Petru Ghita writes: > > "..immediately replaced with the function value" doesn't mean that the > > results of a previously evaluated function for the same parameters are > > stored and reused? > > No, it means what it says: the function is executed once and replaced > with a constant representing the result value. So for example a function like: CREATE OR REPLACE FUNCTION shorten_cruise_type(intext text) RETURNS text AS $$ declare outtext text; begin outtext = trim(regexp_replace(intext, E'\\s*Short( Break)?', '', 'i')); return outtext; end; $$ LANGUAGE plpgsql; could/should be declared immutable? Thanks,