Hi Tatsuo,

> Therefore, I believe it only makes sense to add explicit initialization
> > for nfaStatesActive and nfaContextsActive, since these are the only two
> > that release_partition() also explicitly resets.
>
> That makes sense.
>

Thank you for confirming.

> ## Proposal for consistency
> >
> >   /* Initialize NFA free lists for row pattern matching */
> >   winstate->nfaContext = NULL;
> >   winstate->nfaContextTail = NULL;
> >   winstate->nfaContextFree = NULL;
> >   winstate->nfaStateFree = NULL;
> >   winstate->nfaLastProcessedRow = -1;
> >   winstate->nfaStatesActive = 0;        // Add this
> >   winstate->nfaContextsActive = 0;      // Add this
> >
> > Would you like me to include this change in the next patch?
>
> Yes, please.
>


Done. Please see the attached patch.

Best regards,
Henson
From d06525db781c3432d488706759c653d00a5e1980 Mon Sep 17 00:00:00 2001
From: Henson Choi <[email protected]>
Date: Thu, 5 Feb 2026 09:41:03 +0900
Subject: [PATCH] Initialize NFA per-partition counters in ExecInitWindowAgg

---
 src/backend/executor/nodeWindowAgg.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/backend/executor/nodeWindowAgg.c 
b/src/backend/executor/nodeWindowAgg.c
index 1176df04b2c..1e088615d19 100644
--- a/src/backend/executor/nodeWindowAgg.c
+++ b/src/backend/executor/nodeWindowAgg.c
@@ -3054,6 +3054,8 @@ ExecInitWindowAgg(WindowAgg *node, EState *estate, int 
eflags)
        winstate->nfaContextFree = NULL;
        winstate->nfaStateFree = NULL;
        winstate->nfaLastProcessedRow = -1;
+       winstate->nfaStatesActive = 0;
+       winstate->nfaContextsActive = 0;
 
        /*
         * Allocate varMatched array for NFA evaluation. With the new varNames
-- 
2.50.1 (Apple Git-155)

Reply via email to