Re: BUG #18170: Unexpected error: no relation entry for relid 3
Richard Guo <guofenglinux@gmail.com>
From: Richard Guo <guofenglinux@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andrei Lepikhov <a.lepikhov@postgrespro.ru>,
Alexander Korotkov <aekorotkov@gmail.com>, Vik Fearing <vik@postgresfriends.org>, zuming.jiang@inf.ethz.ch, pgsql-bugs@lists.postgresql.org, Alexander Korotkov <akorotkov@postgresql.org>
Date: 2023-10-30T02:01:02Z
Lists: pgsql-bugs
On Fri, Oct 27, 2023 at 10: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.
Hmm, I understand that we cannot look at subroot->processed_tlist here
because of the "varno 0" hack explained in the comment. But what I
proposed is to look at subroot->parse->targetList, which should be fine
because the tlist generated by generate_append_tlist would only be
returned into processed_tlist not the original parse->targetList. For
instance, the query below still works if we look at
subroot->parse->targetList, even though the subquery is itself a setop.
(SELECT 1,2,3 UNION SELECT 4,5,6 ORDER BY 1,2) INTERSECT SELECT 4,5,6;
?column? | ?column? | ?column?
----------+----------+----------
4 | 5 | 6
(1 row)
Thanks
Richard
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