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)