On Sun, Jun 28, 2026 at 1:53 AM Chengpeng Yan <chengpeng_yan@outlook.com> wrote:
> The attached patch takes the conservative route: int8inc_support() no
> longer reports count() as monotonic when the window frame has
> FRAMEOPTION_EXCLUSION. The added regression tests cover the reported
> case, related EXCLUDE variants, and a count(*) case. They also check
> that the excluded-frame query keeps a normal Filter instead of a
> WindowAgg Run Condition.
I think the fix is on the right track. One nit is that it might be
better to use if/else if structure here. The other nit is that the
test case is over-heavy; it should be kept as minimal as possible.
> Thoughts welcome on whether this is the right boundary, or whether some
> narrower excluded-frame cases should still prove monotonicity
> separately.
I wonder if we should still support count(*) with EXCLUDE CURRENT ROW,
as that always removes exactly one row, so it is still monotonic.
+ if ((frameOptions & FRAMEOPTION_EXCLUSION) &&
+ ((frameOptions & FRAMEOPTION_EXCLUSION) !=
FRAMEOPTION_EXCLUDE_CURRENT_ROW ||
+ req->window_func->winfnoid != F_COUNT_))
+ monotonic = MONOTONICFUNC_NONE;
- Richard