Separate 15.13 condition for future pg15 drop

pull/7986/head
naisila 2025-05-22 12:53:52 +02:00
parent dd6c8587c4
commit c10b1083c9
1 changed files with 13 additions and 5 deletions

View File

@ -2245,16 +2245,24 @@ SelectsFromDistributedTable(List *rangeTableList, Query *query)
continue;
}
#if PG_VERSION_NUM >= 150013 && PG_VERSION_NUM < PG_VERSION_16
if (rangeTableEntry->rtekind == RTE_SUBQUERY && rangeTableEntry->relkind == 0)
{
/*
* In PG15.13 commit https://github.com/postgres/postgres/commit/317aba70e
* relid is retained when converting views to subqueries,
* so we need an extra check identifying those views
*/
continue;
}
#endif
if (rangeTableEntry->relkind == RELKIND_VIEW ||
rangeTableEntry->relkind == RELKIND_MATVIEW ||
(rangeTableEntry->rtekind == RTE_SUBQUERY && rangeTableEntry->relkind == 0))
rangeTableEntry->relkind == RELKIND_MATVIEW)
{
/*
* Skip over views, which would error out in GetCitusTableCacheEntry.
* Distributed tables within (regular) views are already in rangeTableList.
* In PG15.13 commit https://github.com/postgres/postgres/commit/317aba70e
* relid is retained when converting views to subqueries,
* so we need an extra check identifying those views
*/
continue;
}