Oliver Jowett <oliver(at)opencloud(dot)com> writes:
> I guess that ExprState does not live long enough to be useful.
Actually the opposite: it lasts too long, namely the entire execution of
a query. I don't think there's any convenient way to reset it on the
timescale appropriate for STABLE values (ie, once per scan, as opposed
to once per query).
> How about introducing a function modifier that provides stronger
> guarantees than STABLE, along the lines of "immutable during execution
> of a single SQL statement"?
Why?
I suspect that if we did have two flavors of STABLE, we'd just have a
lot of people getting it wrong :-(. A big advantage of the current
definition is exactly that it is pretty weak...
regards, tom lane