Does CREATE FUNCTION... WITH (ISCACHABLE) work? - Mailing list pgsql-general

From Joel Burton
Subject Does CREATE FUNCTION... WITH (ISCACHABLE) work?
Date
Msg-id 3975A1BD.30413.965FF81@localhost
Whole thread Raw
Responses Re: Does CREATE FUNCTION... WITH (ISCACHABLE) work?
List pgsql-general
I have a function that always returns the same answer given the
same input (no database lookups, etc.). The pg Users' Manual
documents the attribute 'iscachable' as allowing the database to
parse the results of the function and not keep looking it up.

Does this actually work yet? A simple test case:

CREATE FUNCTION f() RETURNS INT AS '
BEGIN
  raise notice ''foo'';
  return 1;
end;
' LANGUAGE 'plpgsql' WITH (ISCACHABLE);

SELECT o();
NOTICE: foo
o
___
1
(1 row)

SELECT o();
NOTICE: foo
o
____
(1 row)

It might be that the parser is smart enough to copy any output
(such as the RAISE NOTICE), my fear is that it is actually running
the function a second time.

Does anyone know if this caching actually happens yet, or is this a
future feature?

Thanks.
--
Joel Burton, Director of Information Systems -*- jburton@scw.org
Support Center of Washington (www.scw.org)

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: tcl/tk interface on Digital Unix
Next
From: "kurt miller"
Date:
Subject: Query problem - explicit casts