Re: nodeWindowAgg.c IGNORE NULLS abs overflow

From: Kirill Reshke <reshkekirill(at)gmail(dot)com>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: jian(dot)universality(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: nodeWindowAgg.c IGNORE NULLS abs overflow
Date: 2026-11-05 06:02:16
Message-ID: CALdSSPg0fm6DvvvrUeNYEvfwAJXvJA-RP6OrBfFDn-Kvofe+Dg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 5 Nov 2026 at 09:18, Tatsuo Ishii <ishii(at)postgresql(dot)org> wrote:
>
> Hi Jian,
>
> > I confirmed the problem. It seems it's a corner case bug: only happens
> > when offset = -2147483648. Anyway, bug is a bug.
> >
> > Attached is a patch which should be ready for commit IMO. I haven't
> > changed the C code part from yours. I have changed the regression test
> > part to use low case SQL statements which fits in better with
> > surroundings.
>
> Attached is the v2 patch. I just added a test case for lag() to
> clarify that it is affected by the bug too. If there's no objection,
> I will push it to master and 19 branches.
>
> Regards,
> --
> Tatsuo Ishii
> SRA OSS K.K.
> English: http://www.sraoss.co.jp/index_en/
> Japanese:http://www.sraoss.co.jp

Hi!
Discussion link in your v2 is wrong - for `IGNORE/RESPECT NULLS can be
specified for (prokind == 'f'). ` thread

Also, is there one more issue with leadlag_common:

result = WinGetFuncArgInPartition(winobj, 0,
(forward ? offset : -offset),
WINDOW_SEEK_CURRENT,
const_offset,
&isnull, &isout);

forward ? offset : -offset - same overflow? looks like lag(v,
-2147483648) would be wrong

--
Best regards,
Kirill Reshke

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message surya poondla 2026-11-05 06:08:26 Re: Fix trigger memory leak
Previous Message Chao Li 2026-11-05 05:59:19 Clarify wait versus poll behavior in ExecAppendAsyncEventWait