Re: When IMMUTABLE is not.

Поиск
Список
Период
Сортировка
От chap@anastigmatix.net
Тема Re: When IMMUTABLE is not.
Дата
Msg-id 4c32f84bc097dee0081e4cc3e733ef8d@anastigmatix.net
обсуждение исходный текст
Ответ на Re: When IMMUTABLE is not.  (chap@anastigmatix.net)
Ответы Re: When IMMUTABLE is not.  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-hackers
On 2023-06-15 09:58, chap@anastigmatix.net wrote:
> 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.

I just re-read that and realized I should anticipate the obvious
response "but how can it matter what the function can see, if
it's IMMUTABLE and depends on no data?".

So, I ran into the effect while working on PL/Java, where the
code of a function isn't all found in pg_proc.prosrc; that just
indicates what code has to be fetched from sqlj.jar_entry.

So one could take a strict view that "no PL/Java function should
ever be marked IMMUTABLE" because every one depends on fetching
something (once, at least).

But on the other hand, it would seem punctilious to say that
f(int x, int y) { return x + y; } isn't IMMUTABLE, only because
it depends on a fetch /of its own implementation/, and overall
its behavior is better described by marking it IMMUTABLE.

Regards,
-Chap



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: When IMMUTABLE is not.
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: When IMMUTABLE is not.