From: | Richard Guo <guofenglinux(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | tender wang <tndrwang(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: wrong query result due to wang plan |
Date: | 2023-02-20 09:51:30 |
Message-ID: | CAMbWs48rtnkepkgyvMzj3Cmuo9BcR3xNM2mpwdGHfO7AV-Azhg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Feb 20, 2023 at 3:01 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> We still have to fix process_implied_equality though, and in that
> context we do have all the SpecialJoinInfos, so the strip-the-outer-joins
> fix seems to work. See attached.
Yeah, process_implied_equality is also broken for variable-free clause.
I failed to notice that :-(. I'm looking at the strip-the-outer-joins
codes. At first I wondered why it only removes JOIN_LEFT outer joins
from below a JoinDomain's relids. After a second thought I think it's
no problem here since only left outer joins have chance to commute with
joins outside the JoinDomain.
I'm thinking that maybe we can do the strip-the-outer-joins work only
when it's not the top JoinDomain. When we are in the top JoinDomain, it
seems to me that it's safe to push the qual to the top of the tree.
- /* eval at join domain level */
- relids = bms_copy(qualscope);
+ /* eval at join domain's safe level */
+ if (!bms_equal(qualscope,
+ ((JoinDomain *)
linitial(root->join_domains))->jd_relids))
+ relids = get_join_domain_min_rels(root, qualscope);
+ else
+ relids = bms_copy(qualscope);
Thanks
Richard
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2023-02-20 09:51:40 | Re: Introduce list_reverse() to make lcons() usage less inefficient |
Previous Message | e.indrupskaya | 2023-02-20 09:47:54 | Re: SQL/JSON revisited |