Re: BUG #18634: Wrong varnullingrels with merge ... when not matched by source - Mailing list pgsql-bugs

From Richard Guo
Subject Re: BUG #18634: Wrong varnullingrels with merge ... when not matched by source
Date
Msg-id CAMbWs4-OGaVXXBYmk41WtQQyLaaPS6WJ5KqrhJBAdpED-MOdbA@mail.gmail.com
Whole thread Raw
In response to Re: BUG #18634: Wrong varnullingrels with merge ... when not matched by source  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Fri, Sep 27, 2024 at 11:43 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 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?

I have the same concern.  I think we should NOT mark the vars in
mergeJoinCondition as nullable, as mergeJoinCondition acts as join
quals rather than filter quals at that outer join.  Instead, we should
mark them nullable when they are pulled out and ready to be added to
the targetlist, if they are really needed in the targetlist.

Thanks
Richard



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #18639: Unexpected behavior with SET ROLE and CREATE ROLE interaction
Next
From: PG Bug reporting form
Date:
Subject: BUG #18640: Replica Sync Failure After Downtime in Patroni HA Setup Due to Missing WAL Segments