Re: BUG #19834: eager aggregation still evaluates volatile join clauses when the volatile function is inside a SubPl

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: 303677365(at)qq(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, Guofenglinux <guofenglinux(at)gmail(dot)com>
Subject: Re: BUG #19834: eager aggregation still evaluates volatile join clauses when the volatile function is inside a SubPl
Date: 2026-11-12 15:22:41
Message-ID: 3830412.1794496961@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

shihao zhong <zhong950419(at)gmail(dot)com> writes:
> If I understand correctly, you mean the following case,
> A table t with 100 rows,
> SELECT count(*) FROM t WHERE (SELECT random()) < 0.5;
> returns either 100 or 0, because the sub-select runs only once.

Right.

> I think technically that is one of the correct answers....It is just a
> result the caller would almost never see otherwise.
> I am okay to revert the patch..

To be clear, I'm fine with 27c844034 as it stands. I just don't think
it'd be consistent with our past practice to extend the volatility
check into subplans.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Atisss hh 2026-11-12 15:40:23 Re: BUG #19839: Assert in ReorderBufferRestoreCleanup for aborted, spilled transaction
Previous Message zengman 2026-11-12 14:50:10 Re: BUG #19625: SQL/JSON boolean DEFAULT expression silently replaced with 'false'