Re: ERROR: no relation entry for relid 6

2023-06-08 Thread Richard Guo
On Fri, Jun 9, 2023 at 5:13 AM Tom Lane wrote: > Richard Guo writes: > > Hmm, maybe we can additionally check if the PHV needs to be evaluated > > above the join. If so it cannot be removed. > Yeah, that seems to make sense, and it squares with the existing > comment saying that PHVs used above

Re: ERROR: no relation entry for relid 6

2023-06-08 Thread Tom Lane
Richard Guo writes: > On Tue, May 30, 2023 at 10:28 AM Richard Guo wrote: >> I haven't thought through how to fix it, but I suspect that we may need >> to do more checking before we decide to remove PHVs in >> remove_rel_from_query. Oh, I like this example! It shows a place where we are now sma

Re: ERROR: no relation entry for relid 6

2023-05-30 Thread Richard Guo
On Tue, May 30, 2023 at 10:28 AM Richard Guo wrote: > I haven't thought through how to fix it, but I suspect that we may need > to do more checking before we decide to remove PHVs in > remove_rel_from_query. > Hmm, maybe we can additionally check if the PHV needs to be evaluated above the join.

Re: ERROR: no relation entry for relid 6

2023-05-29 Thread Richard Guo
On Sat, May 27, 2023 at 12:16 AM Tom Lane wrote: > Ah. I realized that we could make the problem testable by adding > assertions that a joinclause we're not removing doesn't contain > any surviving references to the target rel or join. That turns > out to fire (without the bug fix) in half a do

Re: ERROR: no relation entry for relid 6

2023-05-26 Thread Tom Lane
Richard Guo writes: > On Fri, May 26, 2023 at 6:06 AM Tom Lane wrote: >> Based on what deconstruct_distribute_oj_quals is doing, it seems >> likely to me that there are cases that require ignoring >> commute_above_r, but I've not tried to devise one. It'd be good to >> have one to include in the

Re: ERROR: no relation entry for relid 6

2023-05-26 Thread Richard Guo
On Fri, May 26, 2023 at 6:06 AM Tom Lane wrote: > 1. The test case you give upthread only needs to ignore commute_below_l, > that is it still passes without the lines > > +join_plus_commute = bms_add_members(join_plus_commute, > + > removable_sjinfo->commute_above_r); > > Based on what decons

Re: ERROR: no relation entry for relid 6

2023-05-25 Thread Tom Lane
Richard Guo writes: > On Wed, May 24, 2023 at 2:48 AM Tom Lane wrote: >> I wonder if we could do something involving recording the >> rinfo_serial numbers of all the clauses extracted from a particular >> syntactic join level (we could keep this in a bitmapset attached >> to each SpecialJoinInfo,

Re: ERROR: no relation entry for relid 6

2023-05-23 Thread Richard Guo
On Wed, May 24, 2023 at 2:48 AM Tom Lane wrote: > Richard Guo writes: > > Considering that clone clauses should always be outer-join clauses not > > filter clauses, I'm wondering if we can add an additional check for that > > in RINFO_IS_PUSHED_DOWN, something like > > > #define RINFO_IS_PUSHED

Re: ERROR: no relation entry for relid 6

2023-05-23 Thread Tom Lane
Richard Guo writes: >> create table t (a int unique, b int); >> >> explain (costs off) >> select 1 from t t1 >> left join t t2 on true >> inner join t t3 on true >> left join t t4 on t2.a = t4.a and t2.a = t3.a; >> ERROR: no relation entry for relid 6 Ugh. > Considering that clone clauses shou

Re: ERROR: no relation entry for relid 6

2023-05-23 Thread Richard Guo
On Tue, May 23, 2023 at 2:38 PM Richard Guo wrote: > I came across $subject on master and here is the query I'm running. > > create table t (a int unique, b int); > > explain (costs off) > select 1 from t t1 > left join t t2 on true >inner join t t3 on true > left join t t4 on t2.a =