Re: BUG #19460: FULL JOIN rewriting issue on empty queries
| От | Tom Lane |
|---|---|
| Тема | Re: BUG #19460: FULL JOIN rewriting issue on empty queries |
| Дата | |
| Msg-id | 88899.1776652344@sss.pgh.pa.us обсуждение |
| Ответ на | Re: BUG #19460: FULL JOIN rewriting issue on empty queries (Richard Guo <guofenglinux@gmail.com>) |
| Ответы |
Re: BUG #19460: FULL JOIN rewriting issue on empty queries
|
| Список | pgsql-bugs |
Richard Guo <guofenglinux@gmail.com> writes:
> On Mon, Apr 20, 2026 at 10:26 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Thanks for looking at it! There is a loose end still bothering me:
>> if you remove the lower "WHERE t.id = ..." clause, or change it to be
>> something other than an equality constraint on t.id, the bug doesn't
>> manifest. The reason for that is un-obvious.
> The reason seems to be that the equality constraint is a restriction
> clause for the inner relation 't', and is needed to determine that the
> relation has a matching unique index and is therefore distinct. If we
> remove it, or change it to something that isn't mergejoinable, we
> won't be able to prove the inner side of the left join is distinct,
> and thus won't be able to remove that left join.
Hmm. The bug also goes away if "t" doesn't have a unique/pkey
constraint, and I find that easy to understand: we can't apply outer
join removal unless rel_supports_distinctness/rel_is_distinct_for
succeed, so that this buggy code in remove_rel_from_restrictinfo
is not reached. But that logic doesn't consider WHERE constraints
AFAICS. So I think there is some other code path involved.
It might turn out to not be all that interesting to run this to
ground, but I want to do so because it might inform our estimate
of the patch's blast radius.
regards, tom lane
В списке pgsql-bugs по дате отправления: