Re: BUG #19944: Memoize caches volatile LATERAL scans across RTE_FUNCTION and RTE_VALUES, returning wrong results

From: ZhangChi <798604270(at)qq(dot)com>
To: shihao zhong <zhong950419(at)gmail(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
Date: 2026-12-01 01:02:58
Message-ID: tencent_0BAEBBE7DFC9EA4C40E2EC42F3962A76F709@qq.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Shihao,

I got it! Thanks for your work and explanation!

Best,
Chi

Original


From: shihao zhong <zhong950419(at)gmail(dot)com&gt;
Date: 2026-12-01 08:07
To: 798604270 <798604270(at)qq(dot)com&gt;, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org&gt;
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

In response to

Browse pgsql-bugs by date

  From Date Subject
Previous Message surya poondla 2026-12-01 01:00:27 Re: BUG #19897: Recovery fails after "LOG: consistent recovery state reached"