Re: Convert NOT IN sublinks to anti-joins when safe

Japin Li <japinli@hotmail.com>

From: Japin Li <japinli@hotmail.com>
To: Richard Guo <guofenglinux@gmail.com>
Cc: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-03-09T05:14:38Z
Lists: pgsql-hackers
On Sun, 08 Mar 2026 at 17:16, Richard Guo <guofenglinux@gmail.com> wrote:
> On Thu, Mar 5, 2026 at 10:57 AM Japin Li <japinli@hotmail.com> wrote:
>> Just a quick note: I think `foreach_ptr` is more appropriate here than `foreach`.
>
> Agreed.
>
> For homogeneous lists, it is better to use foreach_node so we get the
> additional type-safety assertions in dev builds.  For heterogeneous
> lists, we should use foreach_ptr.
>
> Attached is an updated version of the patch that replaces foreach with
> foreach_ptr or foreach_node accordingly.  Nothing else has changed.
>
> I plan to do one more round of self-review on this.  Unless there are
> any further thoughts or concerns, I'm hoping to commit this in a week
> or two.  Please let me know if anyone spots anything else I might have
> missed.
>

Thanks for updating the patch. LGTM.

-- 
Regards,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.



Commits

  1. Convert NOT IN sublinks to anti-joins when safe