From 45304190fae0fef8db034e658a913ab5779c9961 Mon Sep 17 00:00:00 2001 From: naisila Date: Tue, 20 May 2025 16:31:23 +0200 Subject: [PATCH] Identify views in pg15.13 Relevant PG commit: https://github.com/postgres/postgres/commit/317aba70e Previously, when views were converted to RTE_SUBQUERY the relid would be cleared in PG15. In this patch of PG15, relid is retained. Therefore we add a check with the "relkind and rtekind" to identify the converted views. --- src/backend/distributed/planner/multi_router_planner.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/distributed/planner/multi_router_planner.c b/src/backend/distributed/planner/multi_router_planner.c index a8e76902c..6aa96de05 100644 --- a/src/backend/distributed/planner/multi_router_planner.c +++ b/src/backend/distributed/planner/multi_router_planner.c @@ -2246,7 +2246,8 @@ SelectsFromDistributedTable(List *rangeTableList, Query *query) } if (rangeTableEntry->relkind == RELKIND_VIEW || - rangeTableEntry->relkind == RELKIND_MATVIEW) + rangeTableEntry->relkind == RELKIND_MATVIEW || + (rangeTableEntry->rtekind == RTE_SUBQUERY && rangeTableEntry->relkind == 0)) { /* * Skip over views, which would error out in GetCitusTableCacheEntry.