Re: function side effects

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: function side effects
Дата
Msg-id 424.1266951778@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: function side effects  (Greg Stark <gsstark@mit.edu>)
Ответы Re: function side effects  (Robert Haas <robertmhaas@gmail.com>)
Re: function side effects  (Jaime Casanova <jcasanov@systemguards.com.ec>)
Re: function side effects  (Tatsuo Ishii <ishii@postgresql.org>)
Список pgsql-hackers
Greg Stark <gsstark@mit.edu> writes:
> On Tue, Feb 23, 2010 at 6:39 PM, Kevin Grittner
> <Kevin.Grittner@wicourts.gov> wrote:
>> I didn't realize tsearch functions were volatile. �Should they
>> really be so?

> Uhm, my mistake. They're stable.

IMMUTABLE/STABLE/VOLATILE is not really about side effects, it is about
how long the function value can be expected to hold still for.

There are quite a lot of cases of functions that are marked
conservatively as stable (or even volatile) but could be considered
immutable in particular queries, because the application developer is
prepared to assume that values such as GUCs won't change in his usage.
The traditional way to deal with that is to wrap them in an immutable
wrapper function.  There's actually code in the planner to make that
work --- we have to suppress inlining to avoid exposing the not-immutable
guts, else the planner will not do what's wanted.

There may be some value in inventing a "has no side effects" marker, but
that should not be confused with IMMUTABLE/STABLE.
        regards, tom lane


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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: pg_stop_backup does not complete
Следующее
От: Robert Haas
Дата:
Сообщение: Re: [PATCH] 8.5 TODO: Add comments to output indicating version of pg_dump and of the database server