Re: When IMMUTABLE is not.

Поиск
Список
Период
Сортировка
От chap@anastigmatix.net
Тема Re: When IMMUTABLE is not.
Дата
Msg-id 69234e25e34e68425f49630f79ef9991@anastigmatix.net
обсуждение исходный текст
Ответ на Re: When IMMUTABLE is not.  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: When IMMUTABLE is not.  (Yura Sokolov <y.sokolov@postgrespro.ru>)
Re: When IMMUTABLE is not.  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: When IMMUTABLE is not.  (chap@anastigmatix.net)
Список pgsql-hackers
On 2023-06-15 09:21, Tom Lane wrote:
> Yura Sokolov <y.sokolov@postgrespro.ru> writes:
>> not enough to be sure function doesn't manipulate data.
> 
> Of course not.  It is the user's responsibility to mark functions
> properly.

And also, isn't it the case that IMMUTABLE should mark a function,
not merely that "doesn't manipulate data", but whose return value
doesn't depend in any way on data (outside its own arguments)?

The practice among PLs of choosing an SPI readonly flag based on
the IMMUTABLE/STABLE/VOLATILE declaration seems to be a sort of
peculiar heuristic, not something inherent in what that declaration
means to the optimizer. (And also influences what snapshot the
function is looking at, and therefore what it can see, which has
also struck me more as a tacked-on effect than something inherent
in the declaration's meaning.)

Regards,
-Chap



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

Предыдущее
От: Yura Sokolov
Дата:
Сообщение: Re: When IMMUTABLE is not.
Следующее
От: Yura Sokolov
Дата:
Сообщение: Re: When IMMUTABLE is not.