Re: Unclear documentation (IMMUTABLE functions)

Поиск
Список
Период
Сортировка
От Daniel Schreiber
Тема Re: Unclear documentation (IMMUTABLE functions)
Дата
Msg-id 200309051757.43578.daniel.schreiber@s1999.tu-chemnitz.de
обсуждение исходный текст
Ответ на Re: Unclear documentation (IMMUTABLE functions)  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Список pgsql-bugs
Am Freitag, 5. September 2003 16:01 schrieb Stephan Szabo:
> 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>

The explanation that Tom gave, was quite clear I think.
What about:
<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 at any time of the
function with all-constant arguments can be immediately replaced with the
function value. What you are basically controlling here is whether the
planner will deem it safe to pre-evaluate a call of the function.
</para>

Thanks for the quick help,

Daniel
--
Daniel Schreiber | ICQ: 220903493
GPG encrypted Mail welcome! Key ID: 25A6B489
Chemnitzer Linux-Tag:
http://www.tu-chemnitz.de/linux/tag/

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Unclear documentation (IMMUTABLE functions)
Следующее
От: Daniel Schreiber
Дата:
Сообщение: Re: Unclear documentation (IMMUTABLE functions)