Re: ERROR: no relation entry for relid 6

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ERROR: no relation entry for relid 6
Date: 2023-05-30 09:05:26
Message-ID: CAMbWs49=uXcRNfV3nH0LAgwpo2F=jYnbhOJqWOaaBT8x-vnHdw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 30, 2023 at 10:28 AM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:

> I haven't thought through how to fix it, but I suspect that we may need
> to do more checking before we decide to remove PHVs in
> remove_rel_from_query.
>

Hmm, maybe we can additionally check if the PHV needs to be evaluated
above the join. If so it cannot be removed.

--- a/src/backend/optimizer/plan/analyzejoins.c
+++ b/src/backend/optimizer/plan/analyzejoins.c
@@ -425,7 +425,8 @@ remove_rel_from_query(PlannerInfo *root, int relid,
SpecialJoinInfo *sjinfo)

Assert(!bms_is_member(relid, phinfo->ph_lateral));
if (bms_is_subset(phinfo->ph_needed, joinrelids) &&
- bms_is_member(relid, phinfo->ph_eval_at))
+ bms_is_member(relid, phinfo->ph_eval_at) &&
+ !bms_is_member(ojrelid, phinfo->ph_eval_at))
{
root->placeholder_list =
foreach_delete_current(root->placeholder_list,
l);

Does this make sense?

Thanks
Richard

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2023-05-30 10:03:19 Re: PG 16 draft release notes ready
Previous Message Daniel Gustafsson 2023-05-30 08:01:08 Re: [16Beta1][doc] Add BackendType for standalone backends