Re: wrong query result due to wang plan

Поиск
Список
Период
Сортировка
От Richard Guo
Тема Re: wrong query result due to wang plan
Дата
Msg-id CAMbWs48rtnkepkgyvMzj3Cmuo9BcR3xNM2mpwdGHfO7AV-Azhg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: wrong query result due to wang plan  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: wrong query result due to wang plan  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers

On Mon, Feb 20, 2023 at 3:01 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
We still have to fix process_implied_equality though, and in that
context we do have all the SpecialJoinInfos, so the strip-the-outer-joins
fix seems to work.  See attached.
 
Yeah, process_implied_equality is also broken for variable-free clause.
I failed to notice that :-(.  I'm looking at the strip-the-outer-joins
codes.  At first I wondered why it only removes JOIN_LEFT outer joins
from below a JoinDomain's relids.  After a second thought I think it's
no problem here since only left outer joins have chance to commute with
joins outside the JoinDomain.

I'm thinking that maybe we can do the strip-the-outer-joins work only
when it's not the top JoinDomain.  When we are in the top JoinDomain, it
seems to me that it's safe to push the qual to the top of the tree.

-    /* eval at join domain level */
-    relids = bms_copy(qualscope);
+    /* eval at join domain's safe level */
+    if (!bms_equal(qualscope,
+                   ((JoinDomain *) linitial(root->join_domains))->jd_relids))
+        relids = get_join_domain_min_rels(root, qualscope);
+    else
+        relids = bms_copy(qualscope);

Thanks
Richard

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

Предыдущее
От: e.indrupskaya@postgrespro.ru
Дата:
Сообщение: Re: SQL/JSON revisited
Следующее
От: David Rowley
Дата:
Сообщение: Re: Introduce list_reverse() to make lcons() usage less inefficient