From: | Szymon Guz <mabewlun(at)gmail(dot)com> |
---|---|
To: | Rafal Pietrak <rafal(at)zorro(dot)isa-geek(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: why VOLATILE attribute is required? |
Date: | 2011-09-22 14:57:24 |
Message-ID: | CAFjNrYvbNGf2_k63H-HcY2QNA4JFd6RTjRqKPg_j3917a9ZboA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 22 September 2011 16:29, Rafal Pietrak <rafal(at)zorro(dot)isa-geek(dot)com> 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(at)zorro(dot)isa-geek(dot)com>
> wrote:
> >
> > if you change the state of the database, including (and especially)
> > system catalogs, your function is volatile, period.
>
> Hmmm. To quote from the online documentation:
>
> "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?
>
regards
Szymon
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Adams | 2011-09-22 15:04:21 | Sending Results From One Function As Input into Another Function |
Previous Message | Eric Ridge | 2011-09-22 14:54:39 | OS X 10.7, psql, and tab completion? |