From: | Richard Guo <guofenglinux(at)gmail(dot)com> |
---|---|
To: | Andrei Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>, Alexander Korotkov <aekorotkov(at)gmail(dot)com> |
Cc: | zuming(dot)jiang(at)inf(dot)ethz(dot)ch, pgsql-bugs(at)lists(dot)postgresql(dot)org, PG Bug reporting form <noreply(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: BUG #18187: Unexpected error: "variable not found in subplan target lists" triggered by JOIN |
Date: | 2023-11-20 08:49:13 |
Message-ID: | CAMbWs4_WeARU0oYH1sMn03VYzw-qZQ_xwUNq7r6TbDTH+VgXng@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Fri, Nov 10, 2023 at 4:20 PM Richard Guo <guofenglinux(at)gmail(dot)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
Attachment | Content-Type | Size |
---|---|---|
v2-0001-Don-t-constrain-self-join-removal-due-to-PHVs.patch | application/octet-stream | 5.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | vignesh C | 2023-11-20 09:23:16 | Re: BUG #18203: Logical Replication initial sync failure |
Previous Message | Andres Freund | 2023-11-19 23:08:37 | Re: BUG #18205: Performance regression with NOT NULL checks. |