Skip to content

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

fix: disallow change PENDING task statement (#1886)

p0ny4cbf9e06448a
diff --git a/server/task.go b/server/task.go
index 5cd0c47120..ce8aaaf2c5 100644
--- a/server/task.go
+++ b/server/task.go
@@ -82,7 +82,10 @@ func (s *Server) registerTaskRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusBadRequest, err.Error()).SetInternal(err)
}
- if task.Status != api.TaskPending && task.Status != api.TaskPendingApproval && task.Status != api.TaskFailed {
+ // Allow frontend to change the SQL statement of
+ // a PendingApproval task, which hasn't started yet
+ // a Failed task, which can be retried
+ if task.Status != api.TaskPendingApproval && task.Status != api.TaskFailed {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Can not update task in %v state", task.Status))
}
newStatement = *taskPatch.Statement