From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
Cc: | Richard Guo <guofenglinux(at)gmail(dot)com>, exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #18634: Wrong varnullingrels with merge ... when not matched by source |
Date: | 2024-09-27 15:43:21 |
Message-ID: | 491922.1727451801@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> writes:
> On Fri, 27 Sept 2024 at 13:52, Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
>> I think we can check the jointype of the join between the target and
>> the source relation when adding the vars in mergeJoinCondition. If it
>> is JOIN_LEFT, we mark the vars that belong to source as nullable by
>> this join.
> Another option is to do it in transform_MERGE_to_join(). That feels
> safer, because the jointree might have been modified by the time we
> reach preprocess_targetlist().
Yeah, I think it's critical that these Vars be already correctly
marked before we engage in all the slicing-and-dicing that
prepjointree et al will do. As an example, it seems not impossible
for join removal to make wrong decisions if they aren't.
> Something like the attached.
Could use some comments ... but actually, now I'm confused about why
any of this is the right thing at all:
+ * Similarly, any non-target Vars in the join condition will be added to
+ * the targetlist by preprocess_targetlist(), and so must be marked as
+ * nullable by the join, for LEFT and FULL joins.
Why do we need these Vars in the tlist? If they're for re-evaluating
the join condition, isn't the already-nulled form of them the wrong
thing?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | PG Bug reporting form | 2024-09-27 15:54:40 | BUG #18638: PANIC: could not open file "pg_logical/snapshots/B6-9EE5B820.snap": Permission denied |
Previous Message | Dean Rasheed | 2024-09-27 15:06:12 | Re: BUG #18634: Wrong varnullingrels with merge ... when not matched by source |