From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | chap(at)anastigmatix(dot)net |
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 14:10:03 |
Message-ID: | 2126661.1686838203@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
chap(at)anastigmatix(dot)net writes:
> 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)?
Right. We can't realistically enforce that either, so it's
up to the user.
> 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.)
Well, it is a bit odd at first sight, but these properties play
together well. See
https://www.postgresql.org/docs/current/xfunc-volatility.html
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | chap | 2023-06-15 14:16:12 | Re: When IMMUTABLE is not. |
Previous Message | Yura Sokolov | 2023-06-15 14:06:44 | Re: When IMMUTABLE is not. |