Re: BUG #18187: Unexpected error: "variable not found in subplan target lists" triggered by JOIN

Поиск
Список
Период
Сортировка
От Richard Guo
Тема Re: BUG #18187: Unexpected error: "variable not found in subplan target lists" triggered by JOIN
Дата
Msg-id CAMbWs4_WeARU0oYH1sMn03VYzw-qZQ_xwUNq7r6TbDTH+VgXng@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #18187: Unexpected error: "variable not found in subplan target lists" triggered by JOIN  (Richard Guo <guofenglinux@gmail.com>)
Ответы Re: BUG #18187: Unexpected error: "variable not found in subplan target lists" triggered by JOIN  (Andrei Lepikhov <a.lepikhov@postgrespro.ru>)
Re: BUG #18187: Unexpected error: "variable not found in subplan target lists" triggered by JOIN  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs

On Fri, Nov 10, 2023 at 4:20 PM Richard Guo <guofenglinux@gmail.com> wrote:
Looking closer at the codes, I think we still have some loose ends
regarding how SJE handles PHVs.

...

2) Currently remove_self_joins_one_group() checks PHVs as below

    /* there isn't any other place to eval PHV */
    if (bms_is_subset(phinfo->ph_eval_at, joinrelids) ||
        bms_is_subset(phinfo->ph_needed, joinrelids))
        break;

I'm wondering if we can relax this restriction because it seems to me
that a PHV evaluated/needed at or below the self join should not have
problem if we remove the self join.

After some more thought, I think PHVs should not impose any constraints
on removing self joins.  If the removed rel is contained in the relids
that a PHV is evaluated/needed at or laterally references, it can just
be replaced with the rel that is kept.

Attached is a patch to remove such constraints.  Any comments or
feedback are welcome.

Thanks
Richard
Вложения

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: BUG #18205: Performance regression with NOT NULL checks.
Следующее
От: vignesh C
Дата:
Сообщение: Re: BUG #18203: Logical Replication initial sync failure