Re: Assert failure of the cross-check for nullingrels
От | Richard Guo |
---|---|
Тема | Re: Assert failure of the cross-check for nullingrels |
Дата | |
Msg-id | CAMbWs48fObJJ=YVb4ip8tnwxwixUNKUThfnA1eGfPzJxJRRgZQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Assert failure of the cross-check for nullingrels (Richard Guo <guofenglinux@gmail.com>) |
Ответы |
Re: Assert failure of the cross-check for nullingrels
|
Список | pgsql-hackers |
On Fri, Mar 10, 2023 at 4:13 PM Richard Guo <guofenglinux@gmail.com> wrote:
I wonder if we should consider syn_xxxhand rather than min_xxxhand in
clause_is_computable_at when we check if clause mentions any nullable
Vars. But I'm not sure about that.
No, considering syn_xxxhand is not right. After some join order
commutation we may form the join with only its min_lefthand and
min_righthand. In this case if we check against syn_xxxhand rather than
min_xxxhand in clause_is_computable_at, we may end up with being unable
to find a proper place for some quals. I can see this problem in below
query.
select * from t1 left join ((select t2.x from t2 left join t3 on t2.x where t3.x is null) s left join t4 on s.x) on s.x = t1.x;
Suppose we've formed join t1/t2 and go ahead to form the join of t1/t2
to t3. If we consider t1/t2 join's syn_xxxhand, then the pushed down
qual 't3.x is null' would not be computable at this level because it
mentions nullable Vars from t1/t2 join's syn_righthand and meanwhile is
not marked with t1/t2 join. This is not correct and would trigger an
Assert.
Back to the original issue, if a join has more than one quals, actually
we treat them as a whole when we check if identity 3 applies as well as
when we adjust them to be suitable for commutation according to identity
3. So when we check if a qual is computable at a given level, I think
we should also consider the join's quals as a whole. I'm thinking that
we use a 'group' notion for RestrictInfos and then use the clause_relids
of the 'group' in clause_is_computable_at. Does this make sense?
Thanks
Richard
commutation we may form the join with only its min_lefthand and
min_righthand. In this case if we check against syn_xxxhand rather than
min_xxxhand in clause_is_computable_at, we may end up with being unable
to find a proper place for some quals. I can see this problem in below
query.
select * from t1 left join ((select t2.x from t2 left join t3 on t2.x where t3.x is null) s left join t4 on s.x) on s.x = t1.x;
Suppose we've formed join t1/t2 and go ahead to form the join of t1/t2
to t3. If we consider t1/t2 join's syn_xxxhand, then the pushed down
qual 't3.x is null' would not be computable at this level because it
mentions nullable Vars from t1/t2 join's syn_righthand and meanwhile is
not marked with t1/t2 join. This is not correct and would trigger an
Assert.
Back to the original issue, if a join has more than one quals, actually
we treat them as a whole when we check if identity 3 applies as well as
when we adjust them to be suitable for commutation according to identity
3. So when we check if a qual is computable at a given level, I think
we should also consider the join's quals as a whole. I'm thinking that
we use a 'group' notion for RestrictInfos and then use the clause_relids
of the 'group' in clause_is_computable_at. Does this make sense?
Thanks
Richard
В списке pgsql-hackers по дате отправления: