Re: how to evaluate a function only once for a query? - Mailing list pgsql-general

From Nicolae Mihalache
Subject Re: how to evaluate a function only once for a query?
Date
Msg-id 3D11DCC7.60402@abcpages.com
Whole thread Raw
In response to how to evaluate a function only once for a query?  (Nicolae Mihalache <mache@abcpages.com>)
Responses Re: how to evaluate a function only once for a query?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Tom Lane wrote:
> Nicolae Mihalache <mache@abcpages.com> writes:
>
>>I've created a function timevalue(text) that returns a timestamp as
>>result. The function works just fine.
>>However, when I do a query like:
>>"select * from mytable where time<timevalue('something')" I see that my
>>function is evaluated once for each row in mytable.
>
>
> See the "isCachable" attribute in CREATE FUNCTION.
>
>             regards, tom lane

thanks for your quick answer.
I'm tring to use this attribute but I get an error:
robust=# create function testfunc () returns text as '' language 'pltcl'
with iscachable;
ERROR:  parser: parse error at or near "iscachable"

any ideea? Is it possible that my postgres 7.2.1 does not support this
attrributes? I also get error if I'm tring to use the other attribute
"isstrict"

Thanks,
Nicolae Mihalache


pgsql-general by date:

Previous
From: Jeff Eckermann
Date:
Subject: Re: how to evaluate a function only once for a query?
Next
From: "Bjoern Metzdorf"
Date:
Subject: Re: db grows and grows