Re: nodeWindowAgg.c IGNORE NULLS abs overflow

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: reshkekirill(at)gmail(dot)com
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 07:11:17
Message-ID: 20261105.161117.869631680798715655.ishii@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>> 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.
>
> Hi!
> Discussion link in your v2 is wrong - for `IGNORE/RESPECT NULLS can be
> specified for (prokind == 'f'). ` thread

Opps. You are right.

> 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

Good point. If offset == -2147483648, -offset will be -2147483648 due to an
overflow. However, this is an old problem with leadlag_common, not
specific to IGNORE NULLS. So I think this issue does not belong to v19
open items. What do you think?

Regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Xuneng Zhou 2026-11-05 07:12:27 Re: [Bug Report + Patch] File descriptor leak when io_method=io_uring
Previous Message Tender Wang 2026-11-05 06:47:29 MERGE loses UPDATE transition rows when moving rows between partitions