avamingli commented on code in PR #725:
URL: https://github.com/apache/cloudberry/pull/725#discussion_r1862368634


##########
src/backend/commands/createas.c:
##########
@@ -1808,3 +1820,38 @@ get_primary_key_attnos_from_query(Query *query, List 
**constraintList)
 
        return keys;
 }
+
+/* 
+ * Create auto-refresh task for Dynamic Tables.
+ */
+static void
+create_dynamic_table_auto_refresh_task(ParseState *pstate, Relation 
DynamicTableRel, char *schedule)
+{
+       ObjectAddress refaddr;
+       ObjectAddress address;
+       StringInfoData buf;
+       char *dtname = NULL;
+
+       if (schedule == NULL)
+               schedule = DYNAMIC_TABLE_DEFAULT_REFRESH_INTERVAL;
+
+       /* Create auto refresh task. */
+       CreateTaskStmt *task_stmt = makeNode(CreateTaskStmt);
+
+       initStringInfo(&buf);
+       appendStringInfo(&buf, "gp_dynamic_table_refresh_%u", 
RelationGetRelid(DynamicTableRel));
+       task_stmt->taskname = pstrdup(buf.data);
+       task_stmt->schedule = pstrdup(schedule);
+       task_stmt->if_not_exists = false; /* report error if failed. */
+       dtname = 
quote_qualified_identifier(get_namespace_name(RelationGetNamespace(DynamicTableRel)),
+                                                                               
         RelationGetRelationName(DynamicTableRel));
+       resetStringInfo(&buf);
+       appendStringInfo(&buf, "REFRESH DYNAMIC TABLE %s", dtname);

Review Comment:
   Done, also forbid users to create task using our dynamic table prefix.



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

Reply via email to