Re: Unclear documentation (IMMUTABLE functions)

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Daniel Schreiber <daniel(dot)schreiber(at)s1999(dot)tu-chemnitz(dot)de>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Unclear documentation (IMMUTABLE functions)
Date: 2003-09-05 14:01:12
Message-ID: 20030905065610.R73820-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, 5 Sep 2003, Daniel Schreiber wrote:

> Hi,
>
> A question on IMMUTABLE functions: do they only have to return the same value
> during a session/connection or during the databse server's lifetime? The
> documentation does not say anything about that.

The function should always return the same value result the same inputs.
I think you'll want to rewrite to take it as an argument (otherwise there
might be uses that get converted to a constant where you want it to vary).

This is the section in create function reference page about immutable. I'd
thought it was clear, but do you have a better suggested wording?

<para>
<literal>IMMUTABLE</literal> 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.
</para>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2003-09-05 15:05:48 Re: Unclear documentation (IMMUTABLE functions)
Previous Message Rod Taylor 2003-09-05 13:33:41 Re: Is it bug???