Re: Remove an unnecessary check on semijoin_target_ok() on postgres_fdw.c - Mailing list pgsql-hackers

From Alexander Pyhalov
Subject Re: Remove an unnecessary check on semijoin_target_ok() on postgres_fdw.c
Date
Msg-id 0e65bee95bcc980044bac61dd71137cc@postgrespro.ru
Whole thread Raw
Responses Re: Remove an unnecessary check on semijoin_target_ok() on postgres_fdw.c
List pgsql-hackers
Tender Wang писал(а) 2024-10-09 10:26:
> Hi,
>    When I debug FDW join pushdown codes, I found below codes in
> semijoin_target_ok():
>     if (bms_is_member(var->varno, innerrel->relids) &&
> 
>         !bms_is_member(var->varno, outerrel->relids))
> 
> As far as I know, if a var belongs to the innerrel of joinrel, it's
> not possible that it
> may belong to the outerrel. So if the bms_is_member(var->varno,
> innerrel->relids)
> returns TRUE, then !bms_is_member(var->varno, outerrel->relids) must
> be TRUE.
> If bms_is_member(var->varno, innerrel->relids) returns FALSE,
> !bms_is_member(var->varno, outerrel->relids) will not execute due to
> short circuit.
> 
> So I think we can remove the "!bms_is_member(var->varno,
> outerrel->relids)" from if.
> Any thoughts?

Hi.
Seems good to me.
-- 
Best regards,
Alexander Pyhalov,
Postgres Professional



pgsql-hackers by date:

Previous
From: Kirill Reshke
Date:
Subject: Re: [PATCH] SVE popcount support
Next
From: Dmitry Dolgov
Date:
Subject: Re: Changing shared_buffers without restart