Re: Does IMMUTABLE property propagate? - Mailing list pgsql-sql

From Louis-David Mitterrand
Subject Re: Does IMMUTABLE property propagate?
Date
Msg-id 20100325061616.GA4629@apartia.fr
Whole thread Raw
In response to Re: Does IMMUTABLE property propagate?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Does IMMUTABLE property propagate?  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-sql
On Sat, Mar 06, 2010 at 04:31:55PM -0500, Tom Lane wrote:
> Petru Ghita <petrutz@venaver.info> 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,


pgsql-sql by date:

Previous
From: Josh Kupershmidt
Date:
Subject: Re: window function to sort times series data?
Next
From: Pavel Stehule
Date:
Subject: Re: Does IMMUTABLE property propagate?