Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Only include status where clause when finding task_run if any status is specified

天舟c9b092a093f7
diff --git a/backend/store/task_run.go b/backend/store/task_run.go
index 9426aa8aeb..615eda6416 100644
--- a/backend/store/task_run.go
+++ b/backend/store/task_run.go
@@ -158,11 +158,13 @@ func (s *TaskRunService) findTaskRunList(ctx context.Context, tx *sql.Tx, find *
where, args = append(where, "task_id = ?"), append(args, *v)
}
- statusList := []string{}
- for _, status := range find.StatusList {
- statusList = append(statusList, fmt.Sprintf("%v", status))
+ if len(find.StatusList) > 0 {
+ statusList := []string{}
+ for _, status := range find.StatusList {
+ statusList = append(statusList, fmt.Sprintf("%v", status))
+ }
+ where, args = append(where, "`status` IN (?)"), append(args, strings.Join(statusList, ", "))
}
- where, args = append(where, "`status` IN (?)"), append(args, strings.Join(statusList, ", "))
rows, err := tx.QueryContext(ctx, `
SELECT