Re: wrong query result due to wang plan

2023-02-22 Thread Tom Lane
Richard Guo writes: > 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. Yeah, because there's nothing to commute with. Might as wel

Re: wrong query result due to wang plan

2023-02-20 Thread Richard Guo
On Mon, Feb 20, 2023 at 3:01 AM Tom Lane 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 cla

Re: wrong query result due to wang plan

2023-02-19 Thread Tom Lane
I wrote: > So that leads to a conclusion that we could just forget the whole > thing and always use the syntactic qualscope here. I tried that > and it doesn't break any existing regression tests, which admittedly > doesn't prove a lot in this area :-(. Hmm, I thought it worked, but when I tried

Re: wrong query result due to wang plan

2023-02-17 Thread Tom Lane
Richard Guo writes: > It occurs to me that we can leverage JoinDomain to tell if we are below > the nullable side of a higher-level outer join if the clause is not an > outer-join clause. If we are belew outer join, the current JoinDomain > is supposed to be a proper subset of top JoinDomain. Ot

Re: wrong query result due to wang plan

2023-02-16 Thread Richard Guo
On Thu, Feb 16, 2023 at 5:50 PM Richard Guo 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

Re: wrong query result due to wang plan

2023-02-16 Thread Richard Guo
On Thu, Feb 16, 2023 at 5:50 PM Richard Guo 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

Re: wrong query result due to wang plan

2023-02-16 Thread Richard Guo
On Thu, Feb 16, 2023 at 3:16 PM tender wang wrote: > select ref_1.r_comment as c0, subq_0.c1 as c1 from public.region as > sample_0 right join public.partsupp as sample_1 right join public.lineitem > as sample_2 on (cast(null as path) = cast(null as path)) on (cast(null as > "timestamp") < cast(n

wrong query result due to wang plan

2023-02-15 Thread tender wang
Hi hackers, I have this query as shown below: select ref_1.r_comment as c0, subq_0.c1 as c1 from public.region as sample_0 right join public.partsupp as sample_1 right join public.lineitem as sample_2 on (cast(null as path) = cast(null as path)) on (cast(null as "timestamp") < cast(null as "timest