Re: ERROR: wrong varnullingrels (b 3) (expected (b)) for Var 2/1
Richard Guo <guofenglinux@gmail.com>
From: Richard Guo <guofenglinux@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Markus Winand <markus.winand@winand.at>, pgsql-hackers@postgresql.org
Date: 2023-06-12T02:44:00Z
Lists: 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
Commits
-
Don't include outer join relids in lateral_relids bitmapsets.
- efeb12ef0bfe 16.0 landed
-
Centralize fixups for mismatched nullingrels in nestloop params.
- 0655c03ef9cc 16.0 landed
-
Fix "wrong varnullingrels" for Memoize's lateral references, too.
- 63e4f13d2a78 16.0 landed
-
Fix "wrong varnullingrels" for subquery nestloop parameters.
- bfd332b3fda5 16.0 landed