Re: Convert NOT IN sublinks to anti-joins when safe
Richard Guo <guofenglinux@gmail.com>
From: Richard Guo <guofenglinux@gmail.com>
To: Japin Li <japinli@hotmail.com>
Cc: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-03-09T04:01:14Z
Lists: pgsql-hackers
Attachments
- v6-0001-Convert-NOT-IN-sublinks-to-anti-joins-when-safe.patch (application/octet-stream) patch v6-0001
On Sun, Mar 8, 2026 at 5:16 PM Richard Guo <guofenglinux@gmail.com> wrote: > 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. I just finished a final self-review and noticed a subtle issue in query_outputs_are_not_nullable(). When preparing a target expression for the non-nullability check, the previous code flattened join aliases Vars before grouping Vars. However, because the parser processes FROM/JOIN clauses before the GROUP BY clause, a grouping Var can actually wrap a join alias Var, not the reverse. So we should flatten grouping Vars first. Attached is an updated patch that fixes that issue. I plan to commit this in a week or two, barring any objections. - Richard
Commits
-
Convert NOT IN sublinks to anti-joins when safe
- 383eb21ebffe 19 (unreleased) landed