Copilot commented on code in PR #1817:
URL: https://github.com/apache/cloudberry/pull/1817#discussion_r3620770859


##########
src/backend/utils/adt/ruleutils.c:
##########
@@ -13209,7 +13211,10 @@ pg_get_dynamic_table_schedule(PG_FUNCTION_ARGS)
        task = (Form_pg_task) GETSTRUCT(heapTuple);
 
        resetStringInfo(&buf);
-       appendStringInfo(&buf, "%s", text_to_cstring(&task->schedule));
+       datum = heap_getattr(heapTuple, Anum_pg_task_schedule,
+                                                RelationGetDescr(pg_task), 
&isnull);

Review Comment:
   `task` is assigned from GETSTRUCT() but never used after switching schedule 
access to heap_getattr(). This is dead code and will also contribute to 
unused-but-set warnings; remove the assignment.



##########
src/backend/utils/adt/ruleutils.c:
##########
@@ -13158,14 +13158,16 @@ flatten_reloptions(Oid relid)
 Datum
 pg_get_dynamic_table_schedule(PG_FUNCTION_ARGS)
 {
-       Oid                     relid = PG_GETARG_OID(0);
-       Relation        pg_task;
-       StringInfoData buf;
-       char            *username;
+       Oid                             relid = PG_GETARG_OID(0);
+       Relation                pg_task;
+       StringInfoData  buf;
+       char                    *username;
        SysScanDesc             scanDescriptor = NULL;
-       ScanKeyData scanKey[2];
+       ScanKeyData             scanKey[2];
        HeapTuple               heapTuple = NULL;
        Form_pg_task    task = NULL;
+       bool                    isnull;
+       Datum                   datum;

Review Comment:
   After switching to heap_getattr() for pg_task.schedule, the local 
Form_pg_task variable is no longer used; with typical build flags this will 
trigger an unused/unused-but-set variable warning (often treated as an error). 
Remove the unused `task` declaration.



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