Re: Stable function Repeatedly Called - Mailing list pgsql-general

From dev@archonet.com
Subject Re: Stable function Repeatedly Called
Date
Msg-id 1124.192.168.1.16.1042192474.squirrel@mainbox.archonet.com
Whole thread Raw
In response to Stable function Repeatedly Called  ("CN LIOU" <cnliou@graffiti.net>)
Responses Re: Stable function Repeatedly Called
List pgsql-general
>
> 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

pgsql-general by date:

Previous
From: Francois Suter
Date:
Subject: Re: PostgreSQL/PHP: transactions: how-to abstract out?
Next
From: "karthikeyan.balasubramanian"
Date:
Subject: PostgreSQL on Windows