Re: BUG #2150: PL/Python function delcared STABLE gets run repeatedly - Mailing list pgsql-bugs

From Jim C. Nasby
Subject Re: BUG #2150: PL/Python function delcared STABLE gets run repeatedly
Date
Msg-id 20060106194330.GP3902@pervasive.com
Whole thread Raw
In response to Re: BUG #2150: PL/Python function delcared STABLE gets run repeatedly  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #2150: PL/Python function delcared STABLE gets run repeatedly
List pgsql-bugs
On Fri, Jan 06, 2006 at 12:43:06PM -0500, Tom Lane wrote:
> Oh, you are misunderstanding the point of IMMUTABLE/STABLE.
> STABLE essentially gives the planner permission to use the function
> in an indexscan qualification.  It does *not* cause any caching of
> the function result in other contexts, which is what you seem to be
> wishing would happen.

Is caching of results for STABLE/IMMUTABLE functions called with a
constant something that would be reasonable to add? I certainly wish
this happened natively, but I've always hacked around it by

SELECT ... WHERE x = (SELECT foo(21))

so presumably some kind of query transform logic similar to what was
done for min/max might work.

I don't see anything about this on the TODO...
--
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: [GENERAL] Problems building pg 8.1.1
Next
From: Tom Lane
Date:
Subject: Re: BUG #2150: PL/Python function delcared STABLE gets run repeatedly