On 22 September 2011 16:29, Rafal Pietrak <rafal@xxxxxxxxxxxxxxxxxx> wrote:
On Thu, 2011-09-22 at 07:50 -0500, Merlin Moncure wrote:
> On Thu, Sep 22, 2011 at 5:28 AM, Rafal Pietrak <rafal@xxxxxxxxxxxxxxxxxx> wrote:
>
> if you change the state of the database, including (and especially)Hmmm. To quote from the online documentation:
> system catalogs, your function is volatile, period.
"VOLATILE indicates that the function value can change even within a
single table scan"
this funciton return value does not change. Further we read:
"any function that has side-effects must be classified volatile, even if
its result is quite predictable, to prevent calls from being optimized
away;"
Well. In this caase, I'd like it being optimised away. This is the
expected result. And the above documentation fragment states it as only
a precausion, not an ERROR.
Are there other reasons for that ERROR (e.g. not a warrning)?
Yes, the reason is that caching that function could be a problem.
And why do you want to optimize that?
Does it take too much time, or do you want to call that thousands of times?
Have you checked how much the function lasts?
Szymon