Re: ERROR: wrong varnullingrels (b 3) (expected (b)) for Var 2/1

Markus Winand <markus.winand@winand.at>

From: Markus Winand <markus.winand@winand.at>
To: Richard Guo <guofenglinux@gmail.com>
Cc: pgsql-hackers@postgresql.org
Date: 2023-05-31T07:03:56Z
Lists: pgsql-hackers
> On 31.05.2023, at 08:36, Richard Guo <guofenglinux@gmail.com> wrote:
> 
> Attached is a patch for that.  Does this make sense?
> 
> Thanks
> Richard
> <v1-0001-Fix-nulling-bitmap-for-nestloop-parameters.patch>

All I can say is that it fixes the error for me — also for the non-simplified original query that I have.

-markus


Commits

  1. Don't include outer join relids in lateral_relids bitmapsets.

  2. Centralize fixups for mismatched nullingrels in nestloop params.

  3. Fix "wrong varnullingrels" for Memoize's lateral references, too.

  4. Fix "wrong varnullingrels" for subquery nestloop parameters.