Re: BUG #19412: Wrong query result with not null constraint

Richard Guo <guofenglinux@gmail.com>

From: Richard Guo <guofenglinux@gmail.com>
To: Sergey Shinderuk <s.shinderuk@postgrespro.ru>
Cc: pgsql-bugs@lists.postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>, David Rowley <dgrowleyml@gmail.com>
Date: 2026-02-19T01:49:44Z
Lists: pgsql-bugs
On Wed, Feb 18, 2026 at 9:03 PM Sergey Shinderuk
<s.shinderuk@postgrespro.ru> wrote:
> I'm not familiar with the code, just curios. There is a long comment
> above saying "You might think we need to adjust var->varnullingrels, but
> that shouldn't need any changes." Doesn't it need an update?

No, I don't think we need to update it.  That comment explains why
varnullingrels do not require translation (since they are outer join
relids, not baserel relids).  It's unrelated to what this patch does,
which is about propagating varnullingrels into the translated Var.

- Richard



Commits

  1. Fix computation of varnullingrels when translating appendrel Var

  2. Fix IS [NOT] NULL qual optimization for inheritance tables