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

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: 303677365(at)qq(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: 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-09 05:16:41
Message-ID: CAGRkXqTtO9ahgZ_aXTpWW_5xOohjvkzLY-+3aqvDPd++=wVDYg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thanks for the report. This follows up on [1], where we fixed volatile
join clauses. contain_volatile_functions() does not look into SubPlans,
so a volatile function in a correlated sub-select still gets through.

The query in the report does not show it, because its sub-select is
uncorrelated and runs once as an initplan.

The attached patch also refuses SubPlans, like we do when moving HAVING
to WHERE. I think it should go back to 19.

[1]
https://postgr.es/m/CAGRkXqSc_qtpuPm34qoS1z0LVx4+Hc+JcJkbDEVC=z2ai4VQ1w@mail.gmail.com

Thanks,
Shihao

Attachment Content-Type Size
v1-0001-Fix-eager-aggregation-with-volatile-functions-ins.patch application/octet-stream 5.3 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message shihao zhong 2026-11-09 05:21:21 Re: BUG #19816: PL/Python SD dictionary is split by input collation in 19rc1
Previous Message shihao zhong 2026-11-09 05:10:33 Re: BUG #19849: queries fail after ANALYZE with expression stats on arrays