| From: | Nitin Motiani <nitinmotiani(at)google(dot)com> |
|---|---|
| To: | Richard Guo <guofenglinux(at)gmail(dot)com> |
| Cc: | Tender Wang <tndrwang(at)gmail(dot)com>, leis(at)in(dot)tum(dot)de, pgsql-bugs(at)lists(dot)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Subject: | Re: BUG #19765: Wrong result from a chain of LEFT JOINs since v16 |
| Date: | 2026-10-23 12:08:53 |
| Message-ID: | CAH5HC945wWOoCSJ2yzvNuAc_Dg1eYi=1wiFa==swVW6idPPpUw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
On Fri, Oct 23, 2026 at 1:10 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
>
> It's simpler, and its correctness doesn't depend on mirroring the
> rules in add_outer_joins_to_relids(). This is also in line with
> commit 716a051aa, where we stopped performing NullTest deduction for
> clone clauses because their nullingrel bits may not reflect reality.
> I don't think the redundant clauses cost enough to justify the extra
> complexity of the narrower check. But this is a judgment call, and
> neither approach is a clear win.
>
Thanks for the explanation regarding incompatible_relids and the
selectivity fields. Since the narrow check doesn't cover all the
cases, it does seem better to keep it simple.
Attached is v4 based on your suggestions, which keeps all cloned
outer-join clauses and sets norm_selec = 1.0 and outer_selec = 1.0 on
them. I also added a second test case where the
c/d outer join is written inside the RHS of the b/c outer join, which
also returns wrong results on master.
Regards,
Nitin Motiani
Google
| Attachment | Content-Type | Size |
|---|---|---|
| v4-0001-Keep-all-cloned-outer-join-clauses.patch | application/x-patch | 8.8 KB |
| From | Date | Subject | |
|---|---|---|---|
| Previous Message | Michael Paquier | 2026-10-23 08:02:06 | Re: pg_stat_statements replaces SQL/JSON ON EMPTY / ON ERROR keywords with parameters |