Re: Should IGNORE NULLS cache nullness for volatile arguments?

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org, ojford(at)gmail(dot)com
Subject: Re: Should IGNORE NULLS cache nullness for volatile arguments?
Date: 2026-05-15 03:08:54
Message-ID: FB71EF4E-AFBC-4658-8A3D-2F29F7CFEB29@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On May 14, 2026, at 20:56, Tatsuo Ishii <ishii(at)postgresql(dot)org> wrote:
>
> Hi Chao,
>
>>> The attached patch makes a small change in that direction. It only uses the IGNORE NULLS nullness cache when the argument is safe to reuse. For non-cacheable arguments, the nullness is treated as unknown and the argument is evaluated again.
>>>
>>> See the attached patch for details.
>>
>> I will look into the patches.
>
> @@ -3454,7 +3455,10 @@ ignorenulls_getfuncarginframe(WindowObject winobj, int argno,
> if (isout)
> *isout = false;
>
> - v = get_notnull_info(winobj, abs_pos, argno);
> + if (winobj->notnull_info_cacheable[argno])
>
> What about moving this if statement inside get_notnull_info() so that
> the caller does not care about this argno is cacheable or not?
>
> + /* record the row status if it is safe to reuse */
> + if (winobj->notnull_info_cacheable[argno])
> + put_notnull_info(winobj, abs_pos, argno, *isnull);
>
> Similary, we can move "if (winobj->notnull_info_cacheable[argno])" inside put_notnull_info().
>

Yep, good idea. Addressed in attached v2.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachment Content-Type Size
v2-0001-Fix-IGNORE-NULLS-nullness-cache-for-volatile-wind.patch application/octet-stream 8.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message jian he 2026-05-15 02:52:07 Re: [PATCH] Rebuild CHECK constraints after generated column SET EXPRESSION