gfphoenix78 commented on code in PR #1594:
URL: https://github.com/apache/cloudberry/pull/1594#discussion_r2887012886
##########
src/backend/catalog/gp_matview_aux.c:
##########
@@ -109,43 +198,16 @@ GetViewBaseRelids(const Query *viewQuery, bool
*has_foreign)
if (contain_mutable_functions((Node*)viewQuery))
return NIL;
- if (list_length(viewQuery->jointree->fromlist) != 1)
- return NIL;
-
- mvjtnode = (Node *) linitial(viewQuery->jointree->fromlist);
- if (!IsA(mvjtnode, RangeTblRef))
- return NIL;
-
- RangeTblEntry *rte = rt_fetch(1, viewQuery->rtable);
- if (rte->rtekind != RTE_RELATION)
- return NIL;
-
- char relkind = get_rel_relkind(rte->relid);
-
- /*
- * Allow foreign table here, however we don't know if the data is
- * up to date or not of the view.
- * But if users want to query matview instead of query foreign tables
- * outside CBDB, let them decide with aqumv_allow_foreign_table.
- */
- if (relkind != RELKIND_RELATION &&
- relkind != RELKIND_PARTITIONED_TABLE &&
- relkind != RELKIND_FOREIGN_TABLE)
- return NIL;
-
if (has_foreign)
- *has_foreign = relkind == RELKIND_FOREIGN_TABLE;
+ *has_foreign = false;
- /*
- * inherit tables are not supported.
- */
- bool can_be_partition = (relkind == RELKIND_PARTITIONED_TABLE) ||
get_rel_relispartition(rte->relid);
-
- if (!can_be_partition &&
- (has_superclass(rte->relid) || has_subclass(rte->relid)))
+ if (!extract_base_relids_from_jointree((Node *) viewQuery->jointree,
+
viewQuery->rtable,
+
&relids, has_foreign))
return NIL;
- relids = list_make1_oid(rte->relid);
+ if (relids == NIL)
+ return NIL;
Review Comment:
These 2 lines are unnecessary.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]