Re: Assert failure of the cross-check for nullingrels

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Assert failure of the cross-check for nullingrels
Date: 2023-05-18 06:37:43
Message-ID: CAMbWs49HwGv6UU1E23J60yU0qFc4m4j_mxyg6xUU3tN2ocks+A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 18, 2023 at 3:34 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> After some poking at it I hit on what seems like a really simple
> solution: we should be checking syn_righthand not min_righthand
> to see whether a Var should be considered nullable by a given OJ.
> Maybe that's still not quite right, but it seems like it might be
> right given that the last fix reaffirmed our conviction that Vars
> should be marked according to the syntactic structure.

I thought about this solution before but proved it was not right in
https://www.postgresql.org/message-id/CAMbWs48fObJJ%3DYVb4ip8tnwxwixUNKUThfnA1eGfPzJxJRRgZQ%40mail.gmail.com

I checked the query shown there and it still fails with v3 patch.

explain (costs off)
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;
server closed the connection unexpectedly

The failure happens when we are forming the join of (t1/t2) to t3.
Consider qual 't3.x is null'. It's a non-clone filter clause so
clause_is_computable_at is supposed to think it's applicable here. We
have an Assert for that. However, when checking outer join t1/t2, which
has been performed but is not listed in the qual's nullingrels,
clause_is_computable_at would think it'd null vars of the qual if we
check syn_righthand not min_righthand, and get a conclusion that the
qual is not applicable here. This is how the Assert is triggered.

Thanks
Richard

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2023-05-18 06:47:42 Re: Assert failure of the cross-check for nullingrels
Previous Message Pavel Stehule 2023-05-18 06:35:26 Re: Should CSV parsing be stricter about mid-field quotes?