Re: Reduce "Var IS [NOT] NULL" quals during constant folding - Mailing list pgsql-hackers

From Junwang Zhao
Subject Re: Reduce "Var IS [NOT] NULL" quals during constant folding
Date
Msg-id CAEG8a3LrKxGUEV_gnZbVau0r9=ePAb1CVTkQmRpCygdpz3DArA@mail.gmail.com
Whole thread Raw
In response to Re: Reduce "Var IS [NOT] NULL" quals during constant folding  (Richard Guo <guofenglinux@gmail.com>)
List pgsql-hackers
On Mon, Sep 8, 2025 at 4:21 PM Richard Guo <guofenglinux@gmail.com> wrote:
>
> On Sun, Sep 7, 2025 at 8:12 PM Junwang Zhao <zhjwpku@gmail.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.

True, attached v2 adds that missing spot, thanks for the review.

>
> - Richard



--
Regards
Junwang Zhao

Attachment

pgsql-hackers by date:

Previous
From: Aleksander Alekseev
Date:
Subject: Re: [BUG] PostgreSQL crashes with ThreadSanitizer during early initialization
Next
From: Holger Hoffstätte
Date:
Subject: [PATCH] jit: fix build with LLVM-21