Re: When IMMUTABLE is not.

From: chap(at)anastigmatix(dot)net
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: When IMMUTABLE is not.
Date: 2023-06-15 13:58:39
Message-ID: 69234e25e34e68425f49630f79ef9991@anastigmatix.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2023-06-15 09:21, Tom Lane wrote:
> Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yura Sokolov 2023-06-15 14:06:44 Re: When IMMUTABLE is not.
Previous Message Yura Sokolov 2023-06-15 13:52:42 Re: When IMMUTABLE is not.