From 43a7143e27fed2db4489cdd2792ef5aca1246b7b Mon Sep 17 00:00:00 2001 From: Michael Hohn Date: Thu, 17 Jul 2025 10:28:31 -0700 Subject: [PATCH] fix: code logic updates: make sessionID consistent with original --- pkg/state/state_postgres.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/state/state_postgres.go b/pkg/state/state_postgres.go index 1cf0894..28f2678 100644 --- a/pkg/state/state_postgres.go +++ b/pkg/state/state_postgres.go @@ -321,9 +321,7 @@ func (s *PGState) AddJob(job queue.AnalyzeJob) { // 2. determine next job_repo_id for this session ------------ var nextID int err = s.pool.QueryRow(ctx, ` - SELECT COALESCE(MAX(job_repo_id)+1, 0) - FROM job_repo_map - WHERE session_id = $1 + SELECT COUNT(*) FROM job_repo_map WHERE session_id = $1 `, js.SessionID).Scan(&nextID) if err != nil { slog.Error("AddJob: lookup next job_repo_id failed", "session", js.SessionID, "error", err)