Re: Views no longer in rangeTabls?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Steele <david(at)pgmasters(dot)net>
Cc: Amit Langote <amitlangote09(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Views no longer in rangeTabls?
Date: 2023-06-09 16:14:46
Message-ID: 470644.1686327286@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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().

> 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.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2023-06-09 16:41:35 Re: Meson build updates
Previous Message Tom Lane 2023-06-09 16:08:30 Re: ERROR: wrong varnullingrels (b 3) (expected (b)) for Var 2/1