Re: Inconsistent nullingrels due to oversight in deconstruct_distribute_oj_quals

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Inconsistent nullingrels due to oversight in deconstruct_distribute_oj_quals
Дата
Msg-id 4180876.1676054430@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Inconsistent nullingrels due to oversight in deconstruct_distribute_oj_quals  (Richard Guo <guofenglinux@gmail.com>)
Список pgsql-hackers
Richard Guo <guofenglinux@gmail.com> writes:
> However, for 'above_sjinfo' case, we should not use
> othersj->syn_righthand,  because othersj->syn_righthand contains relids
> in sjinfo's righthand which should not be nulled by othersj after the
> commutation.  It seems what we should use here is sjinfo->syn_lefthand.

I had a hard time wrapping my brain around that to start with, but
now I think you're right.  othersj is syntactically above the current
join, so its syn_righthand will cover all of the current join, but
we only want to add nulling bits to Vars of the current join's LHS.
(That is, we need to transform Pbc to Pb*c, not Pb*c*.)

I also realized that there was a fairly critical nearby bug:
make_outerjoininfo was failing to check whether the upper join's qual
is actually of the form "Pbc", without any references to the lower join's
LHS.  So that led us to setting commute bits in some cases where we
shouldn't, further confusing deconstruct_distribute_oj_quals.  (I think
this snuck in because its other code path doesn't need to make such a
check, it being syntactically impossible to have such a reference if
we start from the other form of the identity.)

Fix pushed.  This seems to take care of Robins' latest example in
the bug #17781 thread [1], too.

            regards, tom lane

[1] https://postgr.es/m/CAEP4nAx9C5gXNBfEA0JBfz7B+5f1Bawt-RWQWyhev-wdps8BZA@mail.gmail.com



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Nikita Malakhov
Дата:
Сообщение: Re: [PATCH] Compression dictionaries for JSONB
Следующее
От: Nathan Bossart
Дата:
Сообщение: Re: pg_usleep for multisecond delays