Re: wrong query result due to wang plan
Richard Guo <guofenglinux@gmail.com>
From: Richard Guo <guofenglinux@gmail.com>
To: tender wang <tndrwang@gmail.com>
Cc: pgsql-hackers@postgresql.org
Date: 2023-02-16T10:14:40Z
Lists: pgsql-hackers
Attachments
- v1-0001-Fix-variable-free-clause-distribution.patch (application/octet-stream) patch v1-0001
On Thu, Feb 16, 2023 at 5:50 PM Richard Guo <guofenglinux@gmail.com> wrote: > It seems we still need to check whether a variable-free qual comes from > somewhere that is below the nullable side of an outer join before we > decide that it can be evaluated at join domain level, just like we did > before. So I wonder if we can add a 'below_outer_join' flag in > JoinTreeItem, fill its value during deconstruct_recurse, and check it in > distribute_qual_to_rels() like > > /* eval at join domain level if not below outer join */ > - relids = bms_copy(jtitem->jdomain->jd_relids); > + relids = jtitem->below_outer_join ? > + bms_copy(qualscope) : bms_copy(jtitem->jdomain->jd_relids); > To be concrete, I mean something like attached. Thanks Richard
Commits
-
Fix some issues with wrong placement of pseudo-constant quals.
- a75ff55c8334 16.0 landed