Re: Stable function Repeatedly Called

From: dev(at)archonet(dot)com
To: "CN LIOU" <cnliou(at)graffiti(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Stable function Repeatedly Called
Date: 2003-01-10 09:54:34
Message-ID: 1124.192.168.1.16.1042192474.squirrel@mainbox.archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message karthikeyan.balasubramanian 2003-01-10 12:26:14 PostgreSQL on Windows
Previous Message Francois Suter 2003-01-10 08:49:08 Re: PostgreSQL/PHP: transactions: how-to abstract out?