Re: BUG #18170: Unexpected error: no relation entry for relid 3
Alexander Korotkov <aekorotkov@gmail.com>
From: Alexander Korotkov <aekorotkov@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Richard Guo <guofenglinux@gmail.com>,
Andrei Lepikhov <a.lepikhov@postgrespro.ru>, Vik Fearing <vik@postgresfriends.org>, zuming.jiang@inf.ethz.ch, pgsql-bugs@lists.postgresql.org, Alexander Korotkov <akorotkov@postgresql.org>
Date: 2023-11-01T22:29:41Z
Lists: pgsql-bugs
Attachments
- fix_estimate_num_groups_with_self_join_removal.patch (application/octet-stream) patch
On Wed, Nov 1, 2023 at 12:29 PM Alexander Korotkov <aekorotkov@gmail.com> wrote: > On Sat, Oct 28, 2023 at 12:12 AM Alexander Korotkov > <aekorotkov@gmail.com> wrote: > > > > On Fri, Oct 27, 2023 at 5:41 PM Tom Lane <tgl@sss.pgh.pa.us> wrote: > > > Richard Guo <guofenglinux@gmail.com> writes: > > > > Alternatively, can we look at subroot->parse->targetList instead of > > > > subquery->targetList where we call estimate_num_groups on the output of > > > > the subquery? > > > > > > Please read the comment just above that. > > > > Thank you, Tom, This is clear. > > > Hmm... I just found that I wasn't attentive enough. The proposed > change is to use subroot->parse->targetList, not > subroot->processed_tlist. I don't know what could be the problem > here. My proposal is to use the attached patch as a hotfix for the bug considered. And for future I propose to consider two questions (each should probably go to its own thread): 1) Getting rid of having two distinct copies of parse tree (have one copy instead). 2) Introduce relation aliases to simplify self-join removal. Any thoughts? ------ Regards, Alexander Korotkov
Commits
-
Disable run condition optimization for some WindowFuncs
- 7e5d20bbd13f 15.7 landed
- 9d36b883bfaa 16.3 landed
-
Fix allocation of UniqueRelInfo
- 93c85db3b5b8 17.0 landed
-
Make UniqueRelInfo a node
- 2b26a6945545 17.0 cited
-
Add "Add trailing commas to enum definitions" to .git-blame-ignore-revs
- 26f988212ead 17.0 cited
-
Remove useless self-joins
- d3d55ce57136 17.0 cited