Re: ERROR: wrong varnullingrels (b 3) (expected (b)) for Var 2/1 - Mailing list pgsql-hackers

From Richard Guo
Subject Re: ERROR: wrong varnullingrels (b 3) (expected (b)) for Var 2/1
Date
Msg-id CAMbWs48qRX9P=YybwaXEWgX+ZR-SU_PLMUHRKRA4Y9pLewYtbQ@mail.gmail.com
Whole thread Raw
In response to Re: ERROR: wrong varnullingrels (b 3) (expected (b)) for Var 2/1  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: ERROR: wrong varnullingrels (b 3) (expected (b)) for Var 2/1  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

On Sat, Jun 10, 2023 at 12:08 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Richard Guo <guofenglinux@gmail.com> writes:
> We can identify in which form of identity 3 the plan is built up by
> checking the relids of the B/C join's outer rel.  If it's in the first
> form, the outer rel's relids must contain the A/B join.  Otherwise it
> should only contain B's relid.  So I'm considering that maybe we can
> adjust the nulling bitmap for nestloop parameters according to that.
> Attached is a patch for that.  Does this make sense?

Hmm.  I don't really want to do it in identify_current_nestloop_params
because that gets applied to all nestloop params, so it seems like
that risks masking bugs of other kinds.  I'd rather do it in
process_subquery_nestloop_params, which we know is only applied to
subquery LATERAL references.  So more or less as attached.

Yeah, that makes sense.  process_subquery_nestloop_params is a better
place to do this adjustments.  +1 to v2 patch.

Thanks
Richard

pgsql-hackers by date:

Previous
From: James Coleman
Date:
Subject: Re: Parallelize correlated subqueries that execute within each worker
Next
From: Michael Paquier
Date:
Subject: Re: Wrong results from Parallel Hash Full Join