>
> CREATE OR REPLACE FUNCTION f1(TEXT) RETURNS TEXT AS'
> DECLARE
> MyNumber TEXT;
> BEGIN
> SELECT c2 INTO MyNumber FROM tt2 WHERE c1 = $1;
> RAISE NOTICE ''%'',MyNumber; --for debug
> RETURN MyNumber;
> END' LANGUAGE 'plpgsql' WITH (iscachable);
Try adding the "WITH (iscachable)" to the end of the definition (instead
of the STABLE that was there - is that an ORACLEism?). This tells PG that
f1('x') always returns the same value.
See the SQL reference for CREATE FUNCTION for details.
- Richard Huxton