From: | Amit Langote <amitlangote09(at)gmail(dot)com> |
---|---|
To: | David Steele <david(at)pgmasters(dot)net> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: Views no longer in rangeTabls? |
Date: | 2023-06-10 06:57:22 |
Message-ID: | CA+HiwqFaMfM-082vwNYSAWU13T9nd62DObeNLbSTisSh6odOog@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, Jun 10, 2023 at 15:51 David Steele <david(at)pgmasters(dot)net> wrote:
> On 6/9/23 19:14, Tom Lane wrote:
> > David Steele <david(at)pgmasters(dot)net> writes:
> >> Thank you, this was very helpful. I am able to get the expected result
> >> now with:
> >
> >> /* We only care about tables/views and can ignore subqueries, etc. */
> >> if (!(rte->rtekind == RTE_RELATION ||
> >> (rte->rtekind == RTE_SUBQUERY && OidIsValid(rte->relid))))
> >> continue;
> >
> > Right, that matches places like add_rtes_to_flat_rtable().
>
> Good to have confirmation of that, thanks!
>
> >> One thing, though, rte->relkind is not set for views, so I still need to
> >> call get_rel_relkind(rte->relid). Not a big deal, but do you think it
> >> would make sense to set rte->relkind for views?
> >
> > If you see "rte->rtekind == RTE_SUBQUERY && OidIsValid(rte->relid)",
> > it's dead certain that relid refers to a view, so you could just wire
> > in that knowledge.
>
> Yeah, that's a good trick. Even so, I wonder why relkind is not set when
> relid is set?
I too have been thinking that setting relkind might be a good idea, even if
only as a crosscheck that only view relations can look like that in the
range table.
> --
Thanks, Amit Langote
EDB: http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | David Steele | 2023-06-10 07:30:29 | Re: Views no longer in rangeTabls? |
Previous Message | David Steele | 2023-06-10 06:51:34 | Re: Views no longer in rangeTabls? |