Andriy Tkachuk wrote:

On Thu, 9 Oct 2003, Gaetano Mendola wrote:
Andriy Tkachuk wrote:
On Wed, 8 Oct 2003, Tom Lane wrote:
Andriy Tkachuk <[EMAIL PROTECTED]> writes:
At second. calc_total() is immutable function:
but it seems that it's not cached in one session:

It's not supposed to be.

but it's written id doc:

             IMMUTABLE indicates that the function always  returns  the  same
             result when given the same argument values; that is, it does not
             do database lookups or otherwise use  information  not  directly
             present in its parameter list. If this option is given, any call
             of the function with all-constant arguments can  be  immediately
             replaced with the function value.

The doc say "can be" not must and will be.

ok, but on what it depends on?

For example in:

select * from T where f_immutable ( 4 ) =;

in this case f_immutable will be evaluated once.

select * from T where f_immutable ( ) = X;

here f_immutable will be avaluated for each different

Gaetano Mendola

---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings

Reply via email to