From: | Richard Guo <guofenglinux(at)gmail(dot)com> |
---|---|
To: | Andrei Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru> |
Cc: | Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Vik Fearing <vik(at)postgresfriends(dot)org>, zuming(dot)jiang(at)inf(dot)ethz(dot)ch, pgsql-bugs(at)lists(dot)postgresql(dot)org, Alexander Korotkov <akorotkov(at)postgresql(dot)org> |
Subject: | Re: BUG #18170: Unexpected error: no relation entry for relid 3 |
Date: | 2023-10-27 14:10:31 |
Message-ID: | CAMbWs494m3AjhHry_HFCFi_SJ+6-PaeMRbx7jK39ZHmK0MVOUA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Fri, Oct 27, 2023 at 7:00 PM Andrei Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
wrote:
> So, I can propose two options. First - don't clean only the current root
> structure, but also make cleanup of the parent. Although it looks safe,
> I am not happy with this approach - it seems too simple: we should have
> a genuine reason for such a cleaning because it potentially adds overhead.
> The second option is to add a flag for not altering queries in
> remove_nulling_relids() - it looks like a mistake when we have two
> different query trees in the root and its parent. Also, it reduces
> memory usage a bit.
> So, if my analysis is correct, it is better to use the second way (see
> attachment).
Alternatively, can we look at subroot->parse->targetList instead of
subquery->targetList where we call estimate_num_groups on the output of
the subquery?
--- a/src/backend/optimizer/prep/prepunion.c
+++ b/src/backend/optimizer/prep/prepunion.c
@@ -341,7 +341,7 @@ recurse_set_operations(Node *setOp, PlannerInfo *root,
*pNumGroups = subpath->rows;
else
*pNumGroups = estimate_num_groups(subroot,
-
get_tlist_exprs(subquery->targetList, false),
+
get_tlist_exprs(subroot->parse->targetList, false),
subpath->rows,
NULL,
NULL);
BTW, I'm a little surprised that QTW_DONT_COPY_QUERY doesn't seem to be
used anywhere currently.
Thanks
Richard
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2023-10-27 14:41:26 | Re: BUG #18170: Unexpected error: no relation entry for relid 3 |
Previous Message | hubert depesz lubaczewski | 2023-10-27 13:33:13 | Logical replication is missing block of rows when sending initial sync? |