Re: Fix duplicate detection for null-treatment window functions

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: kdbase(dot)hack(at)gmail(dot)com
Cc: li(dot)evan(dot)chao(at)gmail(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Fix duplicate detection for null-treatment window functions
Date: 2026-07-16 11:13:10
Message-ID: 20260716.201310.1151595744258525672.ishii@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ewan, Chao,

Thank you for the finding and patches.
I will take care of this.

> Thanks, Chao. Patch attached.
>
> It drops the redundant "&& wfunc->ignore_nulls == perfunc[i].ignore_nulls"
> term together with WindowStatePerFuncData.ignore_nulls, and rewords the
> now-stale comment, leaving equal() to distinguish calls that differ only
> in null treatment -- which it already does, since WindowFunc.ignore_nulls
> is a plain scalar field that _equalWindowFunc() compares. This fixes the
> same bug your v2 fixed, but removes the hand-maintained shadow copy that
> was the root cause, so it can't silently drift out of sync again.
>
> Testing:
> - Since the patch changes the layout of WindowStatePerFuncData, I also
> built the whole tree with -fsanitize=alignment,undefined
> -fno-sanitize-recover=alignment and re-ran make check under it: 245/245,
> no runtime errors. The removed byte sat right before an 8-byte-aligned
> pointer (winobj), so it was absorbed by padding and no following field
> offset changes.
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2026-07-16 11:29:38 Re: Wrong query result w/ propgraph single lateral col reference
Previous Message shveta malik 2026-07-16 10:32:14 Re: Support EXCEPT for TABLES IN SCHEMA publications