Re: var_is_nonnullable() fails to handle invalid NOT NULL constraints

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: var_is_nonnullable() fails to handle invalid NOT NULL constraints
Date: 2026-04-15 00:51:03
Message-ID: CAMbWs48XfOUYPtVmW4ZFD6BfUch9zbWQNVkzNPX+cUe4zGvF=w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Apr 12, 2026 at 6:33 PM SATYANARAYANA NARLAPURAM
<satyanarlapuram(at)gmail(dot)com> wrote:
> I tested this patch against the current HEAD (155c03ee) and it looks good.
> Build & tests: Applies cleanly, compiles without warnings, all 247 regression tests
> pass including the new subselect test case. Reproduced the bug before the patch
> and verified it is fixed after the patch.

Thanks for testing.

> Looks like it needs to perform table_open/table_close multiple times depending upon
> the number of output columns? I don't see it as a major concern but let others comment.

I don't see it as a major concern either performance-wise. table_open
here is just a hash lookup and refcount increment, and table_close is
just a refcount decrement. And the call only happens in NOT IN cases,
and only after sublink_testexpr_is_not_nullable has already returned
true.

So I've committed this patch.

- Richard

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Haibo Yan 2026-04-15 00:53:31 Re: Implement missing join selectivity estimation for range types
Previous Message Michael Paquier 2026-04-15 00:47:19 Re: [PATCH] Miscellaneous little fixes