Re: Views no longer in rangeTabls?

Поиск
Список
Период
Сортировка
От David Steele
Тема Re: Views no longer in rangeTabls?
Дата
Msg-id edb0f313-648e-bbca-5ce0-225b9cce046d@pgmasters.net
обсуждение исходный текст
Ответ на Re: Views no longer in rangeTabls?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Views no longer in rangeTabls?  (Amit Langote <amitlangote09@gmail.com>)
Список pgsql-hackers
On 6/9/23 19:14, Tom Lane wrote:
> David Steele <david@pgmasters.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?

Regards,
-David



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Cleaning up threading code
Следующее
От: Amit Langote
Дата:
Сообщение: Re: Views no longer in rangeTabls?