Re: A problem in deconstruct_distribute_oj_quals

2023-02-07 Thread Tom Lane
Richard Guo writes: > On Tue, Feb 7, 2023 at 2:12 PM Tom Lane wrote: >> I don't see any change in this query plan when I remove that code, so >> I'm not sure you're explaining your point very well. > To observe an obvious plan change, we can add unique constraint for 'a' > and look how outer-joi

Re: A problem in deconstruct_distribute_oj_quals

2023-02-07 Thread Richard Guo
On Tue, Feb 7, 2023 at 2:12 PM Tom Lane wrote: > Richard Guo writes: > > I noticed this code because I came across a problem with a query as > > below. > > > create table t (a int); > > > select t1.a from (t t1 left join t t2 on true) left join (t t3 left join > t > > t4 on t3.a = t4.a) on t2.a

Re: A problem in deconstruct_distribute_oj_quals

2023-02-06 Thread Tom Lane
Richard Guo writes: > In deconstruct_distribute_oj_quals, when we've identified a commutable > left join which provides join clause with flexible semantics, we try to > generate multiple versions of the join clause. Here we have the logic > that puts back any ojrelids that were removed from its m

A problem in deconstruct_distribute_oj_quals

2023-02-06 Thread Richard Guo
In deconstruct_distribute_oj_quals, when we've identified a commutable left join which provides join clause with flexible semantics, we try to generate multiple versions of the join clause. Here we have the logic that puts back any ojrelids that were removed from its min_righthand. /*