Re: Does IMMUTABLE have any effect on functions?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Does IMMUTABLE have any effect on functions?
Дата
Msg-id 21294.1109863501@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Does IMMUTABLE have any effect on functions?  (Thomas Schoen <t.schoen@vitrado.de>)
Список pgsql-general
Thomas Schoen <t.schoen@vitrado.de> writes:
> In my expectations the 2nd function call should not have added a new row
> to table "foo", beacause it was called with the same parameter and is
> immutable.

IMMUTABLE is a promise from you to the database (a promise which you
broke, in this case) ... not vice versa.  There is no commitment to
avoid duplicate evaluations in all cases, and certainly not to do so
across multiple queries.

BTW, PG 8.0 will flat out reject this function, because it is violating
the requirement that immutable functions not have side-effects.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [Auth] "ident" method and LDAP user accounts
Следующее
От: Terry Lee Tucker
Дата:
Сообщение: Re: Disabling triggers in a transaction