Hi Shihao,
I got it! Thanks for your work and explanation!
Best,
Chi
Original
From: shihao zhong <zhong950419(at)gmail(dot)com>
Date: 2026-12-01 08:07
To: 798604270 <798604270(at)qq(dot)com>, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #19944: Memoize caches volatile LATERAL scans across RTE_FUNCTION and RTE_VALUES, returning wrong results
Hi Chi,
Thanks for the clear report. I can reproduce it, but I am leaning into this is not
a bug.
We don't promise how many times a volatile function runs, and
David made that point about Memoize in [1]. Tom recently said similar
things about volatile functions in sub-selects [2] and in WHERE [3].
[1] https://postgr.es/m/CAApHDvopmkAOecfQczbOvkVvo=OK89rABXujVYsFevsk77Dqdw@mail.gmail.com
[2] https://postgr.es/m/3410601.1794431320@sss.pgh.pa.us
[3] https://postgr.es/m/844264.1795464073@sss.pgh.pa.us
Thanks,
Shihao