Bryn Llewellyn <bryn@yugabyte.com> writes:
> The attached self-contained testcase, "pg-bad-invalidation-bug.sql", seems to me definitely to demonstrate a bug.
I'veattached the spooled output as "pg-bad-invalidation-bug.txt" Do you agree that this is a bug?
No. You marked the functions as "immutable", and then you broke that
promise by changing what they'd need to output. The planner had
already inlined the original output value of f1() into the calling
expressions in f2(), on the strength of it being allegedly immutable.
There is no mechanism for undoing that (short of a forced cache flush
or session end), nor should there need to be.
If I mark the functions as either stable or volatile, I see the
desired behavior.
regards, tom lane