From: | Richard Guo <guofenglinux(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Assert failure of the cross-check for nullingrels |
Date: | 2023-03-13 09:03:11 |
Message-ID: | CAMbWs48fObJJ=YVb4ip8tnwxwixUNKUThfnA1eGfPzJxJRRgZQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Mar 10, 2023 at 4:13 PM Richard Guo <guofenglinux(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | houzj.fnst@fujitsu.com | 2023-03-13 09:42:47 | RE: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher |
Previous Message | Julien Rouhaud | 2023-03-13 08:33:14 | Re: pg_dump versus hash partitioning |