Re: Reduce "Var IS [NOT] NULL" quals during constant folding

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Junwang Zhao <zhjwpku(at)gmail(dot)com>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, Tomas Vondra <tomas(at)vondra(dot)me>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, David Rowley <dgrowleyml(at)gmail(dot)com>, Tender Wang <tndrwang(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Reduce "Var IS [NOT] NULL" quals during constant folding
Date: 2025-09-08 08:21:30
Message-ID: CAMbWs4_e05j-O+FtGnuDNXeWb72G_vSfvnB+vOnNp2_sKeaU2w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Sep 7, 2025 at 8:12 PM Junwang Zhao <zhjwpku(at)gmail(dot)com> wrote:
> While reading this thread, I found that it uses *Relids* to collect NOT NULL
> attribute numbers, I think this might be an oversight, since ISTM that
> Relids is used to represent the index of the relation in the range table.

Nice catch; it's better to use Bitmapset * rather than Relids in this
scenario. That was my oversight; will fix it.

> So I think it would be better to be consistent, anyway I post a trivial patch
> if the community agrees with me.

Your patch misses one spot: the notnullattnums in
get_relation_notnullatts() should also be fixed. Otherwise it LGTM.

- Richard

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nazir Bilal Yavuz 2025-09-08 08:25:39 Re: Update Windows CI Task Names: Server 2022 + VS 2022 Upgrade
Previous Message Andrei Klychkov 2025-09-08 08:08:34 Re: [PATCH] Fix ALTER SYSTEM empty string bug for GUC_LIST_QUOTE parameters