nodeWindowAgg.c IGNORE NULLS abs overflow

Started by jian he4 days ago2 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

appliessuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t254298
psql -h localhost -U postgres

Built from patchset v1 (message #1), October 25, 2026 at 04:45 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t254298_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t254298_1 && git checkout t254298_1

Patchset v1 (message #1) is on t254298_1

Jump to latest
#1jian he
jian.universality@gmail.com

Hi.

SELECT v,
lead(v, -2147483648) OVER w AS respect_nulls,
lead(v, -2147483648) IGNORE NULLS OVER w AS ignore_nulls
FROM (VALUES (1), (2)) AS t(v)
WINDOW w AS (ORDER BY v);

should return all NULL values for column ignore_nulls.

The fix is to replace the abs function in nodeWindowAgg.c with pg_abs_s32.

--
jian
https://www.enterprisedb.com/

Attachments:

t254298_1
fix_abs_overflow_nodeWindowAgg.c.difftext/x-patch; charset=US-ASCII; name=fix_abs_overflow_nodeWindowAgg.c.diffDownload+23-6
#2Tatsuo Ishii
ishii@postgresql.org
In reply to: jian he (#1)
Re: nodeWindowAgg.c IGNORE NULLS abs overflow

Hi Jian,

Hi.

SELECT v,
lead(v, -2147483648) OVER w AS respect_nulls,
lead(v, -2147483648) IGNORE NULLS OVER w AS ignore_nulls
FROM (VALUES (1), (2)) AS t(v)
WINDOW w AS (ORDER BY v);

should return all NULL values for column ignore_nulls.

The fix is to replace the abs function in nodeWindowAgg.c with pg_abs_s32.

Thank you for the report and the fix. Unfortunately I have no time to
take care this for now (till November 3rd). I will work on this after
November 4th unless someone beats me.

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