David Rowley <dgrowleyml@gmail.com> writes:
> On Tue, 13 Jan 2026 at 21:57, PG Bug reporting form
> <noreply@postgresql.org> wrote:
>> It's weird that in the first query postgres doesn't seem to treat
>> st_makevalid($0) as a constant and I think re-evaluate st_makevalue($0) for
>> every row. Is that an expected behaviour?
> Yes, it's expected. We don't do anything special to try and walk up
> function call chains of immutable functions for init plan parameters
> to push function calls down to the init plan. Perhaps something is
> possible here, but anyone proposing we change this would need to come
> armed with proof that it's safe to do this.
It would be a fairly hard sell, I think, because traditionally
PG users have understood that a scalar sub-SELECT like this is an
optimization fence. Pushing stuff across that fence is likely to
break some hand-optimized queries.
regards, tom lane