[GENERAL] Immutable functions and cache invalidation. - Mailing list pgsql-general

From Tim Uckun
Subject [GENERAL] Immutable functions and cache invalidation.
Date
Msg-id CAGuHJrPgApqUd3C0AQCeqCzAYpgMC63rP_GPpw+hhksP6PNtLA@mail.gmail.com
Whole thread Raw
List pgsql-general
Say I have a function like this.

CREATE OR REPLACE FUNCTION some_constant(
)
    RETURNS text
    LANGUAGE 'plpgsql'
    COST 100
    IMMUTABLE 
    ROWS 0
AS $BODY$
begin
return 'some_string';
end;
$BODY$;

Then I have another function that calls it but is also immutable

CREATE OR REPLACE FUNCTION some_proc(
)
    RETURNS text
    LANGUAGE 'plpgsql'
    COST 100
    IMMUTABLE 
    ROWS 0
AS $BODY$
declare 
  x textl;
begin

x := some_constant();
....
end;
$BODY$;

will postgres know to invalidate the cache on some_proc() if I change the returned value in some_constant()?

Thanks.

pgsql-general by date:

Previous
From: Gabriel Furstenheim Milerud
Date:
Subject: Re: [GENERAL] Extension coverage
Next
From: Dmitry Lazurkin
Date:
Subject: Re: [GENERAL] Change location of function/type installed from C-extension